diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_misc.c | 12 | ||||
-rw-r--r-- | src/game/bg_public.h | 1 | ||||
-rw-r--r-- | src/game/g_active.c | 21 | ||||
-rw-r--r-- | src/game/g_buildable.c | 26 | ||||
-rw-r--r-- | src/game/g_cmds.c | 23 | ||||
-rw-r--r-- | src/game/g_main.c | 26 | ||||
-rw-r--r-- | src/game/g_missile.c | 2 | ||||
-rw-r--r-- | src/game/g_session.c | 1 |
8 files changed, 88 insertions, 24 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index b22a94e8..f227046f 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -3152,7 +3152,7 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasThirdMode; qfalse, //qboolean canZoom; 90.0f, //float zoomFov; - qtrue, //qboolean purchasable; + qfalse, //qboolean purchasable; 0, //int buildDelay; WUT_HUMANS //WUTeam_t team; }, @@ -4009,6 +4009,16 @@ upgradeAttributes_t bg_upgrades[ ] = WUT_HUMANS //WUTeam_t team; }, { + UP_GRENADE, //int upgradeNum; + GRENADE_PRICE, //int price; + ( 1 << S2 )|( 1 << S3 ),//int stages + SLOT_NONE, //int slots; + "gren", //char *upgradeName; + "Grenade", //char *upgradeHumanName; + 0, + WUT_HUMANS //WUTeam_t team; + }, + { UP_AMMO, //int upgradeNum; 0, //int price; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 07a27850..97ca9d86 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -374,6 +374,7 @@ typedef enum UP_BATTPACK, UP_JETPACK, UP_BATTLESUIT, + UP_GRENADE, UP_AMMO, diff --git a/src/game/g_active.c b/src/game/g_active.c index dcad7c90..492ab015 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -685,7 +685,10 @@ void ClientTimerActions( gentity_t *ent, int msec ) { armoury = &g_entities[ entityList[ i ] ]; - if( armoury->s.eType == ET_BUILDABLE && armoury->s.modelindex == BA_H_ARMOURY ) + if( armoury->s.eType == ET_BUILDABLE && + ( armoury->s.modelindex == BA_H_ARMOURY || + armoury->s.modelindex == BA_H_REACTOR || + armoury->s.modelindex == BA_H_REPEATER ) ) break; } @@ -1059,12 +1062,28 @@ void ClientThink_real( gentity_t *ent ) if( client->ps.stats[ STAT_STATE ] & SS_POISONED ) { //remove anti toxin + BG_DeactivateUpgrade( UP_ANTITOXIN, client->ps.stats ); BG_RemoveUpgradeFromInventory( UP_ANTITOXIN, client->ps.stats ); client->ps.stats[ STAT_STATE ] &= ~SS_POISONED; } } + if( BG_InventoryContainsUpgrade( UP_GRENADE, client->ps.stats ) && + BG_UpgradeIsActive( UP_GRENADE, client->ps.stats ) ) + { + int lastWeapon = ent->s.weapon; + + //remove anti toxin + BG_DeactivateUpgrade( UP_GRENADE, client->ps.stats ); + BG_RemoveUpgradeFromInventory( UP_GRENADE, client->ps.stats ); + + //M-M-M-M-MONSTER HACK + ent->s.weapon = WP_GRENADE; + FireWeapon( ent ); + ent->s.weapon = lastWeapon; + } + // 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 5d09c9b4..c2109aea 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -1485,15 +1485,27 @@ void HRpt_Use( gentity_t *self, gentity_t *other, gentity_t *activator ) if( !BG_FindUsesEnergyForWeapon( weapon ) ) return; - BG_FindAmmoForWeapon( weapon, &maxAmmo, NULL, &maxClips ); - - if( BG_InventoryContainsUpgrade( UP_BATTPACK, ps->stats ) ) - maxAmmo = (int)( (float)maxAmmo * BATTPACK_MODIFIER ); + if( !other->client->campingAtTheArmoury ) + { + BG_FindAmmoForWeapon( weapon, &maxAmmo, NULL, &maxClips ); + + if( BG_InventoryContainsUpgrade( UP_BATTPACK, ps->stats ) ) + maxAmmo = (int)( (float)maxAmmo * BATTPACK_MODIFIER ); - BG_PackAmmoArray( weapon, ps->ammo, ps->powerups, maxAmmo, maxClips, maxClips ); + BG_PackAmmoArray( weapon, ps->ammo, ps->powerups, maxAmmo, maxClips, maxClips ); - G_AddEvent( activator, EV_RPTUSE_SOUND, 0 ); - activator->client->lastRefilTime = level.time; + G_AddEvent( activator, EV_RPTUSE_SOUND, 0 ); + activator->client->lastRefilTime = level.time; + + other->client->lastBoughtAmmoTime = level.time; + other->client->campingAtTheArmoury = qtrue; + } + else + { + trap_SendServerCommand( other-g_entities, + va( "print \"Move away or wait 45 seconds for ammo/energy\n\"" ) ); + return; + } } diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 619989c7..6d0ba6da 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1561,6 +1561,10 @@ void Cmd_Buy_f( gentity_t *ent ) //set build delay/pounce etc to 0 ent->client->ps.stats[ STAT_MISC ] = 0; + //prevent filling up ammo again soon + ent->client->lastBoughtAmmoTime = level.time; + ent->client->campingAtTheArmoury = qtrue; + //subtract from funds G_AddCreditToClient( ent->client, -(short)BG_FindPriceForWeapon( weapon ), qfalse ); } @@ -1645,7 +1649,8 @@ void Cmd_Buy_f( gentity_t *ent ) } else { - trap_SendServerCommand( ent-g_entities, va( "print \"Move away from the armoury\n\"" ) ); + trap_SendServerCommand( ent-g_entities, + va( "print \"Move away or wait 45 seconds for ammo/energy\n\"" ) ); return; } } @@ -1777,6 +1782,14 @@ void Cmd_Sell_f( gentity_t *ent ) { for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ ) { + //guard against selling the HBUILD weapons exploit + if( ( i == WP_HBUILD || i == WP_HBUILD2 ) && + ent->client->ps.stats[ STAT_MISC ] > 0 ) + { + trap_SendServerCommand( ent-g_entities, va( "print \"Cannot sell until build timer expires.\n\"" ) ); + continue; + } + if( BG_InventoryContainsWeapon( i, ent->client->ps.stats ) && i != WP_BLASTER ) { BG_RemoveWeaponFromInventory( i, ent->client->ps.stats ); @@ -1993,6 +2006,7 @@ void G_StopFollowing( gentity_t *ent ) ent->client->sess.spectatorState = SPECTATOR_FREE; ent->client->sess.spectatorClient = -1; ent->client->ps.pm_flags &= ~PMF_FOLLOW; + ent->client->ps.stats[ STAT_PTEAM ] = PTE_NONE; ent->client->ps.stats[ STAT_STATE ] &= ~SS_WALLCLIMBING; ent->client->ps.stats[ STAT_STATE ] &= ~SS_WALLCLIMBINGCEILING; @@ -2001,6 +2015,8 @@ void G_StopFollowing( gentity_t *ent ) ent->r.svFlags &= ~SVF_BOT; ent->client->ps.clientNum = ent - g_entities; + + CalculateRanks( ); } /* @@ -2023,6 +2039,9 @@ qboolean G_FollowNewClient( gentity_t *ent, int dir ) else if( dir == 0 ) return qtrue; + if( ent->client->sess.sessionTeam != TEAM_SPECTATOR ) + return qfalse; + // select any if no target exists if( clientnum < 0 || clientnum >= level.maxclients ) { @@ -2101,7 +2120,7 @@ void Cmd_Follow_f( gentity_t *ent, qboolean toggle ) // first set them to spectator if( ent->client->sess.sessionTeam != TEAM_SPECTATOR ) - G_ChangeTeam( ent, PTE_NONE ); + return; ent->client->sess.spectatorState = SPECTATOR_FOLLOW; ent->client->sess.spectatorClient = i; diff --git a/src/game/g_main.c b/src/game/g_main.c index 77de3f01..5d10285f 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -1115,21 +1115,23 @@ void CalculateRanks( void ) level.sortedClients[ level.numConnectedClients ] = i; level.numConnectedClients++; - //TA: so we know when the game ends and for team leveling - if( level.clients[ i ].ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) + if( !( level.clients[ i ].ps.pm_flags & PMF_FOLLOW ) ) { - level.numAlienClients++; - if( level.clients[ i ].sess.sessionTeam != TEAM_SPECTATOR ) - level.numLiveAlienClients++; - } + //so we know when the game ends and for team leveling + if( level.clients[ i ].ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) + { + level.numAlienClients++; + if( level.clients[ i ].sess.sessionTeam != TEAM_SPECTATOR ) + level.numLiveAlienClients++; + } - if( level.clients[ i ].ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) - { - level.numHumanClients++; - if( level.clients[ i ].sess.sessionTeam != TEAM_SPECTATOR ) - level.numLiveHumanClients++; + if( level.clients[ i ].ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) + { + level.numHumanClients++; + if( level.clients[ i ].sess.sessionTeam != TEAM_SPECTATOR ) + level.numLiveHumanClients++; + } } - //////////////// if( level.clients[ i ].sess.sessionTeam != TEAM_SPECTATOR ) { diff --git a/src/game/g_missile.c b/src/game/g_missile.c index a1070cad..b1a71ac3 100644 --- a/src/game/g_missile.c +++ b/src/game/g_missile.c @@ -486,7 +486,7 @@ gentity_t *launch_grenade( gentity_t *self, vec3_t start, vec3_t dir ) bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN; bolt->s.weapon = WP_GRENADE; bolt->s.eFlags = EF_BOUNCE_HALF; - bolt->s.generic1 = self->s.generic1; //weaponMode + bolt->s.generic1 = WPM_PRIMARY; //weaponMode bolt->r.ownerNum = self->s.number; bolt->parent = self; bolt->damage = GRENADE_DAMAGE; diff --git a/src/game/g_session.c b/src/game/g_session.c index 7f44d5b0..d05e81e1 100644 --- a/src/game/g_session.c +++ b/src/game/g_session.c @@ -123,6 +123,7 @@ void G_InitSessionData( gclient_t *client, char *userinfo ) sess->spectatorState = SPECTATOR_FREE; sess->spectatorTime = level.time; + sess->spectatorClient = -1; G_WriteClientSessionData( client ); } |