diff options
author | Tim Angus <tim@ngus.net> | 2002-01-13 17:15:50 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2002-01-13 17:15:50 +0000 |
commit | 88f875b5c2ce0eff085084535c6fa23f2b30470c (patch) | |
tree | 87d5d6f3e5d00d965cc6805f6e88fd1e5048a149 /src | |
parent | 4ad94a5b05565c08e34d8f575373627c7f6ac9e8 (diff) |
Staging transitions. Battpack. Half jetpack
Diffstat (limited to 'src')
-rw-r--r-- | src/game/bg_misc.c | 37 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 4 | ||||
-rw-r--r-- | src/game/bg_public.h | 2 | ||||
-rw-r--r-- | src/game/g_active.c | 6 | ||||
-rw-r--r-- | src/game/g_buildable.c | 46 | ||||
-rw-r--r-- | src/game/g_cmds.c | 15 | ||||
-rw-r--r-- | src/game/g_combat.c | 64 | ||||
-rw-r--r-- | src/game/g_local.h | 11 | ||||
-rw-r--r-- | src/game/g_main.c | 40 | ||||
-rw-r--r-- | src/game/g_spawn.c | 18 |
10 files changed, 181 insertions, 62 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index f2bc1d54..2ffb8407 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -1940,6 +1940,7 @@ weaponAttributes_t bg_weapons[ ] = 3, //int clips; 3, //int maxClips; qfalse, //int infiniteAmmo; + qfalse, //int usesEnergy; 100, //int repeatRate; 2000, //int reloadTime; qfalse, //qboolean hasAltMode; @@ -1960,6 +1961,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qfalse, //int infiniteAmmo; + qfalse, //int usesEnergy; 40, //int repeatRate; 0, //int reloadTime; qfalse, //qboolean hasAltMode; @@ -1980,6 +1982,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qfalse, //int infiniteAmmo; + qfalse, //int usesEnergy; 50, //int repeatRate; 0, //int reloadTime; qfalse, //qboolean hasAltMode; @@ -2000,6 +2003,7 @@ weaponAttributes_t bg_weapons[ ] = 2, //int clips; 3, //int maxClips; qfalse, //int infiniteAmmo; + qtrue, //int usesEnergy; 1000, //int repeatRate; 2000, //int reloadTime; qfalse, //qboolean hasAltMode; @@ -2020,6 +2024,7 @@ weaponAttributes_t bg_weapons[ ] = 3, //int clips; 3, //int maxClips; qfalse, //int infiniteAmmo; + qtrue, //int usesEnergy; 50, //int repeatRate; 2000, //int reloadTime; qfalse, //qboolean hasAltMode; @@ -2040,6 +2045,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qtrue, //int infiniteAmmo; + qfalse, //int usesEnergy; 1000, //int repeatRate; 0, //int reloadTime; qtrue, //qboolean hasAltMode; @@ -2060,6 +2066,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qtrue, //int infiniteAmmo; + qfalse, //int usesEnergy; 1000, //int repeatRate; 0, //int reloadTime; qtrue, //qboolean hasAltMode; @@ -2080,6 +2087,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qtrue, //int infiniteAmmo; + qfalse, //int usesEnergy; 1000, //int repeatRate; 0, //int reloadTime; qtrue, //qboolean hasAltMode; @@ -2100,6 +2108,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qtrue, //int infiniteAmmo; + qfalse, //int usesEnergy; 1000, //int repeatRate; 0, //int reloadTime; qtrue, //qboolean hasAltMode; @@ -2120,6 +2129,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qtrue, //int infiniteAmmo; + qfalse, //int usesEnergy; 500, //int repeatRate; 0, //int reloadTime; qfalse, //qboolean hasAltMode; @@ -2140,6 +2150,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qtrue, //int infiniteAmmo; + qfalse, //int usesEnergy; 500, //int repeatRate; 0, //int reloadTime; qtrue, //qboolean hasAltMode; @@ -2160,6 +2171,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qtrue, //int infiniteAmmo; + qfalse, //int usesEnergy; 1500, //int repeatRate; 0, //int reloadTime; qfalse, //qboolean hasAltMode; @@ -2180,6 +2192,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qtrue, //int infiniteAmmo; + qfalse, //int usesEnergy; 1500, //int repeatRate; 0, //int reloadTime; qtrue, //qboolean hasAltMode; @@ -2200,6 +2213,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qtrue, //int infiniteAmmo; + qfalse, //int usesEnergy; 750, //int repeatRate; 0, //int reloadTime; qfalse, //qboolean hasAltMode; @@ -2220,6 +2234,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qtrue, //int infiniteAmmo; + qfalse, //int usesEnergy; 500, //int repeatRate; 0, //int reloadTime; qfalse, //qboolean hasAltMode; @@ -2240,6 +2255,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qtrue, //int infiniteAmmo; + qtrue, //int usesEnergy; 500, //int repeatRate; 0, //int reloadTime; qfalse, //qboolean hasAltMode; @@ -2260,6 +2276,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qtrue, //int infiniteAmmo; + qtrue, //int usesEnergy; 500, //int repeatRate; 0, //int reloadTime; qfalse, //qboolean hasAltMode; @@ -2477,6 +2494,26 @@ qboolean BG_FindInfinteAmmoForWeapon( int weapon ) /* ============== +BG_FindUsesEnergyForWeapon +============== +*/ +qboolean BG_FindUsesEnergyForWeapon( int weapon ) +{ + int i; + + for( i = 0; i < bg_numWeapons; i++ ) + { + if( bg_weapons[ i ].weaponNum == weapon ) + { + return bg_weapons[ i ].usesEnergy; + } + } + + return qfalse; +} + +/* +============== BG_FindRepeatRateForWeapon ============== */ diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 42281d8d..ce976a8e 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -2175,6 +2175,10 @@ static void PM_Weapon( void ) BG_FindAmmoForWeapon( pm->ps->weapon, &ammo, NULL, NULL ); } + if( BG_FindUsesEnergyForWeapon( pm->ps->weapon ) && + BG_gotItem( UP_BATTPACK, pm->ps->stats ) ) + ammo *= 2; + BG_packAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips, maxclips ); } diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 6a0018ed..72a1ae11 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -933,6 +933,7 @@ typedef struct int clips; int maxClips; qboolean infiniteAmmo; + qboolean usesEnergy; int repeatRate; int reloadTime; @@ -1024,6 +1025,7 @@ char *BG_FindModelsForWeapon( int weapon, int modelNum ); char *BG_FindIconForWeapon( int weapon ); void BG_FindAmmoForWeapon( int weapon, int *quan, int *clips, int *maxClips ); qboolean BG_FindInfinteAmmoForWeapon( int weapon ); +qboolean BG_FindUsesEnergyForWeapon( int weapon ); int BG_FindRepeatRateForWeapon( int weapon ); int BG_FindReloadTimeForWeapon( int weapon ); qboolean BG_WeaponHasAltMode( int weapon ); diff --git a/src/game/g_active.c b/src/game/g_active.c index 0767afe5..691f1559 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -853,7 +853,11 @@ void ClientThink_real( gentity_t *ent ) { client->lastBoostedTime + 20000 < level.time ) client->ps.stats[ STAT_STATE ] &= ~SS_BOOSTED; - client->ps.gravity = g_gravity.value; + if( BG_gotItem( UP_JETPACK, client->ps.stats ) && + BG_activated( UP_JETPACK, client->ps.stats ) ) + client->ps.gravity = 200.0f; + else + client->ps.gravity = g_gravity.value; // set speed client->ps.speed = g_speed.value * BG_FindSpeedForClass( client->ps.stats[ STAT_PCLASS ] ); diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index a2419069..9944f55f 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -959,7 +959,51 @@ void HRpt_Think( gentity_t *self ) self->nextthink = level.time + REFRESH_TIME; } +#define REFIL_TIME 500 //1/2 second between every clip refil +/* +================ +HRpt_Use + +Use for human power repeater +================ +*/ +void HRpt_Use( gentity_t *self, gentity_t *other, gentity_t *activator ) +{ + int maxAmmo, maxClips; + int ammo, clips; + + playerState_t *ps = &activator->client->ps; + + if( activator->client->lastRefilTime + REFIL_TIME > level.time ) + return; + + if( !BG_FindUsesEnergyForWeapon( ps->weapon ) ) + return; + + BG_FindAmmoForWeapon( ps->weapon, &maxAmmo, NULL, &maxClips ); + + if( BG_gotItem( UP_BATTPACK, ps->stats ) ) + maxAmmo *= 2; + + BG_unpackAmmoArray( ps->weapon, ps->ammo, ps->powerups, &ammo, &clips, NULL ); + + if( ammo == maxAmmo && clips < maxClips ) + { + clips++; + ammo = 0; + } + + //add half max ammo + ammo += maxAmmo >> 1; + + if( ammo > maxAmmo ) + ammo = maxAmmo; + + BG_packAmmoArray( ps->weapon, ps->ammo, ps->powerups, ammo, clips, maxClips ); + + activator->client->lastRefilTime = level.time; +} //================================================================================== @@ -1991,12 +2035,14 @@ gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin case BA_H_REACTOR: built->die = HSpawn_Die; + built->use = HRpt_Use; built->powered = built->active = qtrue; break; case BA_H_REPEATER: built->think = HRpt_Think; built->die = HSpawn_Die; + built->use = HRpt_Use; break; case BA_H_FLOATMINE: diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index d0c53d91..8388b01a 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1901,6 +1901,11 @@ void Cmd_Buy_f( gentity_t *ent ) //add to inventory BG_packWeapon( weapon, ent->client->ps.stats ); BG_FindAmmoForWeapon( weapon, &quan, &clips, &maxClips ); + + if( BG_FindUsesEnergyForWeapon( weapon ) && + BG_gotItem( UP_BATTPACK, ent->client->ps.stats ) ) + quan *= 2; + BG_packAmmoArray( weapon, ent->client->ps.ammo, ent->client->ps.powerups, quan, clips, maxClips ); ent->client->ps.weapon = weapon; @@ -2271,6 +2276,14 @@ void Cmd_Spawnbody_f( gentity_t *ent ) G_FreeEntity( dummy ); } +/*void Cmd_Test_f( gentity_t *ent ) +{ + if( level.alienKills < 50 ) + level.alienKills = 50; + else if( level.alienKills < 100 ) + level.alienKills = 100; +}*/ + /* ================= ClientCommand @@ -2402,6 +2415,8 @@ void ClientCommand( int clientNum ) { Cmd_Stats_f( ent ); else if (Q_stricmp (cmd, "spawnbody") == 0) Cmd_Spawnbody_f( ent ); +/* else if (Q_stricmp (cmd, "test") == 0) + Cmd_Test_f( ent );*/ else trap_SendServerCommand( clientNum, va("print \"unknown cmd %s\n\"", cmd ) ); } diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 391a4800..fd6548fd 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -121,36 +121,6 @@ void TossClientItems( gentity_t *self ) { weapon = WP_NONE; } } - - if( weapon > WP_MACHINEGUN && ( ammo > 0 || clips > 0 ) ) { - // find the item type for this weapon - /*item = BG_FindItemForWeapon( weapon );*/ - - //TA: never drop weapons... - // spawn the item - //Drop_Item( self, item, 0 ); - } - - // drop all the powerups if not in teamplay - if ( g_gametype.integer != GT_TEAM ) { - angle = 45; - /*for ( i = 1 ; i < PW_NUM_POWERUPS ; i++ ) { - if ( self->client->ps.powerups[ i ] > level.time ) { - item = BG_FindItemForPowerup( i ); - if ( !item ) { - continue; - } - //TA: ...or powerups - /*drop = Drop_Item( self, item, angle ); - // decide how many seconds it has left - drop->count = ( self->client->ps.powerups[ i ] - level.time ) / 1000; - if ( drop->count < 1 ) { - drop->count = 1; - } - angle += 45; - } - }*/ - } } @@ -409,36 +379,12 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int AddScore( attacker, 1 ); AddPoints( attacker, CalculatePoints( self, attacker ) ); - //TA: disable rewards - /*if( meansOfDeath == MOD_GAUNTLET ) { - attacker->client->ps.persistant[PERS_GAUNTLET_FRAG_COUNT]++; - attacker->client->ps.persistant[PERS_REWARD] = REWARD_GAUNTLET; - attacker->client->ps.persistant[PERS_REWARD_COUNT]++; - - // add the sprite over the player's head - attacker->client->ps.eFlags &= ~(EF_AWARD_IMPRESSIVE | EF_AWARD_EXCELLENT | EF_AWARD_GAUNTLET ); - attacker->client->ps.eFlags |= EF_AWARD_GAUNTLET; - attacker->client->rewardTime = level.time + REWARD_SPRITE_TIME; - - // also play humiliation on target - self->client->ps.persistant[PERS_REWARD] = REWARD_GAUNTLET; - self->client->ps.persistant[PERS_REWARD_COUNT]++; - } - - // check for two kills in a short amount of time - // if this is close enough to the last kill, give a reward sound - if ( level.time - attacker->client->lastKillTime < CARNAGE_REWARD_TIME ) { - attacker->client->ps.persistant[PERS_REWARD_COUNT]++; - attacker->client->ps.persistant[PERS_REWARD] = REWARD_EXCELLENT; - attacker->client->ps.persistant[PERS_EXCELLENT_COUNT]++; - - // add the sprite over the player's head - attacker->client->ps.eFlags &= ~(EF_AWARD_IMPRESSIVE | EF_AWARD_EXCELLENT | EF_AWARD_GAUNTLET ); - attacker->client->ps.eFlags |= EF_AWARD_EXCELLENT; - attacker->client->rewardTime = level.time + REWARD_SPRITE_TIME; - }*/ attacker->client->lastKillTime = level.time; - + + if( attacker->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) + level.alienKills++; + else if( attacker->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) + level.humanKills++; } } else { AddScore( self, -1 ); diff --git a/src/game/g_local.h b/src/game/g_local.h index ff58b36f..a643fefe 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -350,6 +350,8 @@ struct gclient_s { vec3_t hovelOrigin; //TA: player origin before entering hovel int lastFlameBall; //TA: s.number of the last flame ball fired + + int lastRefilTime; //TA: last time human got a refil from rpt/rctr }; #define MAX_LOCDAMAGE_TEXT 8192 @@ -478,6 +480,9 @@ typedef struct { int humanBuildPointsPowered; int bankCredits[ MAX_CLIENTS ]; //global credits storage + + int alienKills; + int humanKills; } level_locals_t; // @@ -858,7 +863,13 @@ extern vmCvar_t g_singlePlayer; extern vmCvar_t g_humanBuildPoints; extern vmCvar_t g_alienBuildPoints; extern vmCvar_t g_humanStage; +extern vmCvar_t g_humanMaxStage; +extern vmCvar_t g_humanStage2Threshold; +extern vmCvar_t g_humanStage3Threshold; extern vmCvar_t g_alienStage; +extern vmCvar_t g_alienMaxStage; +extern vmCvar_t g_alienStage2Threshold; +extern vmCvar_t g_alienStage3Threshold; void trap_Printf( const char *fmt ); void trap_Error( const char *fmt ); diff --git a/src/game/g_main.c b/src/game/g_main.c index 8d9a46b0..0561b484 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -79,7 +79,13 @@ vmCvar_t g_listEntity; vmCvar_t g_humanBuildPoints; vmCvar_t g_alienBuildPoints; vmCvar_t g_humanStage; +vmCvar_t g_humanMaxStage; +vmCvar_t g_humanStage2Threshold; +vmCvar_t g_humanStage3Threshold; vmCvar_t g_alienStage; +vmCvar_t g_alienMaxStage; +vmCvar_t g_alienStage2Threshold; +vmCvar_t g_alienStage3Threshold; static cvarTable_t gameCvarTable[] = { // don't override the cheat state set by the system @@ -152,7 +158,13 @@ static cvarTable_t gameCvarTable[] = { { &g_humanBuildPoints, "g_humanBuildPoints", "1000", 0, 0, qfalse }, { &g_alienBuildPoints, "g_alienBuildPoints", "1000", 0, 0, qfalse }, { &g_humanStage, "g_humanStage", "0", 0, 0, qfalse }, + { &g_humanMaxStage, "g_humanMaxStage", "2", 0, 0, qfalse }, + { &g_humanStage2Threshold, "g_humanStage2Threshold", "50", 0, 0, qfalse }, + { &g_humanStage3Threshold, "g_humanStage3Threshold", "100", 0, 0, qfalse }, { &g_alienStage, "g_alienStage", "0", 0, 0, qfalse }, + { &g_alienMaxStage, "g_alienMaxStage", "2", 0, 0, qfalse }, + { &g_alienStage2Threshold, "g_alienStage2Threshold", "50", 0, 0, qfalse }, + { &g_alienStage3Threshold, "g_alienStage3Threshold", "100", 0, 0, qfalse }, { &g_rankings, "g_rankings", "0", 0, 0, qfalse} }; @@ -845,6 +857,29 @@ void calculateBuildPoints( void ) g_alienStage.integer, g_humanStage.integer ) ); } +/* +============ +CalculateStages +============ +*/ +void CalculateStages( void ) +{ + //FIXME: broadcast stage transitions + + if( level.alienKills >= g_alienStage2Threshold.integer && + g_alienStage.integer == S1 && g_alienMaxStage.integer > S1 ) + trap_Cvar_Set( "g_alienStage", va( "%d", S2 ) ); + if( level.alienKills >= g_alienStage3Threshold.integer && + g_alienStage.integer == S2 && g_alienMaxStage.integer > S2 ) + trap_Cvar_Set( "g_alienStage", va( "%d", S3 ) ); + + if( level.humanKills >= g_humanStage2Threshold.integer && + g_humanStage.integer == S1 && g_humanMaxStage.integer > S1 ) + trap_Cvar_Set( "g_humanStage", va( "%d", S2 ) ); + if( level.humanKills >= g_humanStage3Threshold.integer && + g_humanStage.integer == S2 && g_humanMaxStage.integer > S2 ) + trap_Cvar_Set( "g_humanStage", va( "%d", S3 ) ); +} /* ============ @@ -1958,8 +1993,9 @@ end = trap_Milliseconds(); CheckTournament(); //TA: - countSpawns(); - calculateBuildPoints(); + countSpawns( ); + calculateBuildPoints( ); + CalculateStages( ); // see if it is time to end the level CheckExitRules(); diff --git a/src/game/g_spawn.c b/src/game/g_spawn.c index f2ffbcd3..6962a44e 100644 --- a/src/game/g_spawn.c +++ b/src/game/g_spawn.c @@ -616,9 +616,27 @@ void SP_worldspawn( void ) { G_SpawnString( "humanBuildPoints", "1000", &s ); trap_Cvar_Set( "g_humanBuildPoints", s ); + G_SpawnString( "humanMaxStage", "2", &s ); + trap_Cvar_Set( "g_humanMaxStage", s ); + + G_SpawnString( "humanStage2ThreshHold", "50", &s ); + trap_Cvar_Set( "g_humanStage2Threshold", s ); + + G_SpawnString( "humanStage3ThreshHold", "100", &s ); + trap_Cvar_Set( "g_humanStage3Threshold", s ); + G_SpawnString( "alienBuildPoints", "1000", &s ); trap_Cvar_Set( "g_alienBuildPoints", s ); + G_SpawnString( "alienMaxStage", "2", &s ); + trap_Cvar_Set( "g_alienMaxStage", s ); + + G_SpawnString( "alienStage2ThreshHold", "50", &s ); + trap_Cvar_Set( "g_alienStage2Threshold", s ); + + G_SpawnString( "alienStage3ThreshHold", "100", &s ); + trap_Cvar_Set( "g_alienStage3Threshold", s ); + G_SpawnString( "enableDust", "0", &s ); trap_Cvar_Set( "g_enableDust", s ); |