summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2005-07-14 21:12:27 +0000
committerTim Angus <tim@ngus.net>2005-07-14 21:12:27 +0000
commit24c9dbde80155d1099ea9012f1dbf970a836e822 (patch)
tree78600ace229e4588d1c4279017b31ef5bbaa042e /src
parent47c89fa76f7c993e1bf3bf1dfe3945613f5b5041 (diff)
* "sell weapons" now respects the build timer
* Changed the human anticamp message * Anticamp mechanism now applies to using the reactor/repeater as it does the armoury * Anticamp mechanism is now triggered immediately after buying a weapon * Fixed bug where lcannon warning sound was missing with cg_drawGun 0 * Grenade is now an upgrade which is used like the antitox instead of a weapon * Fixed a bug where engaging spectator follow mode failed * Fixed a bug where spectator follow clients were counted as being on the team of the client followed
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_weapons.c14
-rw-r--r--src/game/bg_misc.c12
-rw-r--r--src/game/bg_public.h1
-rw-r--r--src/game/g_active.c21
-rw-r--r--src/game/g_buildable.c26
-rw-r--r--src/game/g_cmds.c23
-rw-r--r--src/game/g_main.c26
-rw-r--r--src/game/g_missile.c2
-rw-r--r--src/game/g_session.c1
9 files changed, 98 insertions, 28 deletions
diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c
index e9622edb..afd9bb45 100644
--- a/src/cgame/cg_weapons.c
+++ b/src/cgame/cg_weapons.c
@@ -245,7 +245,10 @@ void CG_RegisterUpgrade( int upgradeNum )
upgradeInfo->humanName = BG_FindHumanNameForUpgrade( upgradeNum );
- if( ( icon = BG_FindIconForUpgrade( upgradeNum ) ) )
+ //la la la la la, i'm not listening!
+ if( upgradeNum == UP_GRENADE )
+ upgradeInfo->upgradeIcon = cg_weapons[ WP_GRENADE ].weaponIcon;
+ else if( ( icon = BG_FindIconForUpgrade( upgradeNum ) ) )
upgradeInfo->upgradeIcon = trap_R_RegisterShader( icon );
}
@@ -1243,6 +1246,12 @@ void CG_AddViewWeapon( playerState_t *ps )
if( ( ps->stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) > BA_NONE )
CG_GhostBuildable( ps->stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT );
+ if( weapon == WP_LUCIFER_CANNON && ps->stats[ STAT_MISC ] > 0 )
+ {
+ if( ps->stats[ STAT_MISC ] > ( LCANNON_TOTAL_CHARGE - ( LCANNON_TOTAL_CHARGE / 3 ) ) )
+ trap_S_AddLoopingSound( ps->clientNum, ps->origin, vec3_origin, cgs.media.lCannonWarningSound );
+ }
+
// no gun if in third person view
if( cg.renderingThirdPerson )
return;
@@ -1298,9 +1307,6 @@ void CG_AddViewWeapon( playerState_t *ps )
VectorMA( hand.origin, random( ) * fraction, cg.refdef.viewaxis[ 0 ], hand.origin );
VectorMA( hand.origin, random( ) * fraction, cg.refdef.viewaxis[ 1 ], hand.origin );
-
- if( ps->stats[ STAT_MISC ] > ( LCANNON_TOTAL_CHARGE - ( LCANNON_TOTAL_CHARGE / 3 ) ) )
- trap_S_AddLoopingSound( ps->clientNum, ps->origin, vec3_origin, cgs.media.lCannonWarningSound );
}
AnglesToAxis( angles, hand.axis );
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 );
}