summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorBen Millwood <thebenmachine@gmail.com>2009-10-03 12:15:17 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:15:47 +0000
commitbbf9693d114d11df15b8e9157a134733e4aa49bd (patch)
treeea3b93a16c0aca311400a8bc566d38b439a667fa /src/game
parent0dff9796f8a2921844e84eaa00a550a0b6dcac09 (diff)
* Remove SS_INFESTING and PM_SPINTERMISSION since they were not used
* Merge SS_WALLCLIMBINGCEILING and EF_WALLCLIMBCEILING * Remove ui_emoticons, using the value of cg_emoticons for both contexts. * Add PM_Paralyzed() to get rid of all the silly >= PM_DEAD comparisons * Don't allow players to taunt while dead * Fix full ammo check in reload (oops) * Fiddle with bg_lib.h _MAX/_MIN defines, fix min(), add [u]intX_t typedefs * Remove non-functional cgame command (thanks Amanieu for spotting)
Diffstat (limited to 'src/game')
-rw-r--r--src/game/bg_lib.c2
-rw-r--r--src/game/bg_lib.h27
-rw-r--r--src/game/bg_misc.c6
-rw-r--r--src/game/bg_pmove.c46
-rw-r--r--src/game/bg_public.h23
-rw-r--r--src/game/g_active.c7
-rw-r--r--src/game/g_cmds.c143
7 files changed, 132 insertions, 122 deletions
diff --git a/src/game/bg_lib.c b/src/game/bg_lib.c
index 7524a53e..328af322 100644
--- a/src/game/bg_lib.c
+++ b/src/game/bg_lib.c
@@ -76,7 +76,7 @@ static char* med3(char *, char *, char *, cmp_t *);
static void swapfunc(char *, char *, int, int);
#ifndef min
-#define min(a, b) (a) < (b) ? a : b
+#define min(a, b) ((a) < (b) ? a : b)
#endif
/*
diff --git a/src/game/bg_lib.h b/src/game/bg_lib.h
index 6225ce99..b872709a 100644
--- a/src/game/bg_lib.h
+++ b/src/game/bg_lib.h
@@ -40,21 +40,28 @@ typedef char * va_list;
#define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
#define va_end(ap) ( ap = (va_list)0 )
-#define CHAR_BIT 8 /* number of bits in a char */
-#define SCHAR_MIN (-128) /* minimum signed char value */
-#define SCHAR_MAX 127 /* maximum signed char value */
-#define UCHAR_MAX 0xff /* maximum unsigned char value */
+#define CHAR_BIT 8 /* number of bits in a char */
+#define SCHAR_MAX 0x7f /* maximum signed char value */
+#define SCHAR_MIN (-SCHAR_MAX - 1)/* minimum signed char value */
+#define UCHAR_MAX 0xff /* maximum unsigned char value */
-#define SHRT_MIN (-32768) /* minimum (signed) short value */
-#define SHRT_MAX 32767 /* maximum (signed) short value */
+#define SHRT_MAX 0x7fff /* maximum (signed) short value */
+#define SHRT_MIN (-SHRT_MAX - 1) /* minimum (signed) short value */
#define USHRT_MAX 0xffff /* maximum unsigned short value */
-#define INT_MIN (-2147483647 - 1) /* minimum (signed) int value */
-#define INT_MAX 2147483647 /* maximum (signed) int value */
+#define INT_MAX 0x7fffffff /* maximum (signed) int value */
+#define INT_MIN (-INT_MAX - 1) /* minimum (signed) int value */
#define UINT_MAX 0xffffffff /* maximum unsigned int value */
-#define LONG_MIN (-2147483647L - 1) /* minimum (signed) long value */
-#define LONG_MAX 2147483647L /* maximum (signed) long value */
+#define LONG_MAX 0x7fffffffL /* maximum (signed) long value */
+#define LONG_MIN (-LONG_MAX - 1) /* minimum (signed) long value */
#define ULONG_MAX 0xffffffffUL /* maximum unsigned long value */
+typedef signed char int8_t;
+typedef unsigned char uint8_t;
+typedef signed short int16_t;
+typedef unsigned short uint16_t;
+typedef signed long int32_t;
+typedef unsigned long uint32_t;
+
#define isalnum(c) (isalpha(c) || isdigit(c))
#define isalpha(c) (isupper(c) || islower(c))
#define isascii(c) ((c) > 0 && (c) <= 0x7f)
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 470e8784..27cecf77 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -2960,8 +2960,6 @@ void BG_PlayerStateToEntityState( playerState_t *ps, entityState_t *s, qboolean
// have to get the surfNormal through somehow...
VectorCopy( ps->grapplePoint, s->angles2 );
- if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING )
- s->eFlags |= EF_WALLCLIMBCEILING;
s->loopSound = ps->loopSound;
s->generic1 = ps->generic1;
@@ -3072,8 +3070,6 @@ void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s
// have to get the surfNormal through somehow...
VectorCopy( ps->grapplePoint, s->angles2 );
- if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING )
- s->eFlags |= EF_WALLCLIMBCEILING;
s->loopSound = ps->loopSound;
s->generic1 = ps->generic1;
@@ -3288,7 +3284,7 @@ void BG_GetClientNormal( const playerState_t *ps, vec3_t normal )
{
if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING )
{
- if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING )
+ if( ps->eFlags & EF_WALLCLIMBCEILING )
VectorSet( normal, 0.0f, 0.0f, -1.0f );
else
VectorCopy( ps->grapplePoint, normal );
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c
index 745bca4e..dfcac8df 100644
--- a/src/game/bg_pmove.c
+++ b/src/game/bg_pmove.c
@@ -88,13 +88,25 @@ void PM_AddTouchEnt( int entityNum )
}
/*
+===============
+PM_Paralyzed
+===============
+*/
+qboolean PM_Paralyzed( playerState_t *ps )
+{
+ return ( ps->pm_type == PM_DEAD ||
+ ps->pm_type == PM_FREEZE ||
+ ps->pm_type == PM_INTERMISSION );
+}
+
+/*
===================
PM_StartTorsoAnim
===================
*/
void PM_StartTorsoAnim( int anim )
{
- if( pm->ps->pm_type >= PM_DEAD )
+ if( PM_Paralyzed( pm->ps ) )
return;
pm->ps->torsoAnim = ( ( pm->ps->torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT )
@@ -108,7 +120,7 @@ PM_StartWeaponAnim
*/
static void PM_StartWeaponAnim( int anim )
{
- if( pm->ps->pm_type >= PM_DEAD )
+ if( PM_Paralyzed( pm->ps ) )
return;
pm->ps->weaponAnim = ( ( pm->ps->weaponAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT )
@@ -122,7 +134,7 @@ PM_StartLegsAnim
*/
static void PM_StartLegsAnim( int anim )
{
- if( pm->ps->pm_type >= PM_DEAD )
+ if( PM_Paralyzed( pm->ps ) )
return;
//legsTimer is clamped too tightly for nonsegmented models
@@ -2093,7 +2105,7 @@ static void PM_GroundClimbTrace( void )
{
CrossProduct( surfNormal, trace.plane.normal, pm->ps->grapplePoint );
VectorNormalize( pm->ps->grapplePoint );
- pm->ps->stats[ STAT_STATE ] |= SS_WALLCLIMBINGCEILING;
+ pm->ps->eFlags |= EF_WALLCLIMBCEILING;
}
//transition from ceiling to wall
@@ -2117,7 +2129,7 @@ static void PM_GroundClimbTrace( void )
{
//so we know what surface we're stuck to
VectorCopy( trace.plane.normal, pm->ps->grapplePoint );
- pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBINGCEILING;
+ pm->ps->eFlags &= ~EF_WALLCLIMBCEILING;
}
//IMPORTANT: break out of the for loop if we've hit something
@@ -2140,7 +2152,7 @@ static void PM_GroundClimbTrace( void )
pm->ps->eFlags &= ~EF_WALLCLIMB;
//just transided from ceiling to floor... apply delta correction
- if( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING )
+ if( pm->ps->eFlags & EF_WALLCLIMBCEILING )
{
vec3_t forward, rotated, angles;
@@ -2152,7 +2164,7 @@ static void PM_GroundClimbTrace( void )
pm->ps->delta_angles[ YAW ] -= ANGLE2SHORT( angles[ YAW ] - pm->ps->viewangles[ YAW ] );
}
- pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBINGCEILING;
+ pm->ps->eFlags &= ~EF_WALLCLIMBCEILING;
//we get very bizarre effects if we don't do this :0
VectorCopy( refNormal, pm->ps->grapplePoint );
@@ -2224,7 +2236,7 @@ static void PM_GroundTrace( void )
}
//just transided from ceiling to floor... apply delta correction
- if( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING )
+ if( pm->ps->eFlags & EF_WALLCLIMBCEILING )
{
vec3_t forward, rotated, angles;
@@ -2238,8 +2250,7 @@ static void PM_GroundTrace( void )
}
pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBING;
- pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBINGCEILING;
- pm->ps->eFlags &= ~EF_WALLCLIMB;
+ pm->ps->eFlags &= ~( EF_WALLCLIMB | EF_WALLCLIMBCEILING );
point[ 0 ] = pm->ps->origin[ 0 ];
point[ 1 ] = pm->ps->origin[ 1 ];
@@ -2842,8 +2853,8 @@ static void PM_Weapon( void )
qboolean attack3 = qfalse;
// Ignore weapons in some cases
- if( pm->ps->persistant[ PERS_SPECSTATE ] != SPECTATOR_NOT ||
- ( pm->ps->stats[ STAT_STATE ] & ( SS_INFESTING | SS_HOVELING ) ) )
+ if( pm->ps->persistant[ PERS_SPECSTATE ] != SPECTATOR_NOT ||
+ ( pm->ps->stats[ STAT_STATE ] & SS_HOVELING ) )
return;
// Check for dead player
@@ -3407,6 +3418,9 @@ PM_Animate
*/
static void PM_Animate( void )
{
+ if( PM_Paralyzed( pm->ps ) )
+ return;
+
if( pm->cmd.buttons & BUTTON_GESTURE )
{
if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
@@ -3492,7 +3506,7 @@ void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd )
vec3_t axis[ 3 ], rotaxis[ 3 ];
vec3_t tempang;
- if( ps->pm_type == PM_INTERMISSION || ps->pm_type == PM_SPINTERMISSION )
+ if( ps->pm_type == PM_INTERMISSION )
return; // no view changes at all
if( ps->pm_type != PM_SPECTATOR && ps->stats[ STAT_HEALTH ] <= 0 )
@@ -3525,7 +3539,7 @@ void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd )
if( !( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) ||
!BG_RotateAxis( ps->grapplePoint, axis, rotaxis, qfalse,
- ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) )
+ ps->eFlags & EF_WALLCLIMBCEILING ) )
AxisCopy( axis, rotaxis );
//convert the new axis back to angles
@@ -3683,7 +3697,7 @@ void PmoveSingle( pmove_t *pmove )
else if( pm->cmd.forwardmove > 0 || ( pm->cmd.forwardmove == 0 && pm->cmd.rightmove ) )
pm->ps->pm_flags &= ~PMF_BACKWARDS_RUN;
- if( pm->ps->pm_type >= PM_DEAD )
+ if( PM_Paralyzed( pm->ps ) )
{
pm->cmd.forwardmove = 0;
pm->cmd.rightmove = 0;
@@ -3711,7 +3725,7 @@ void PmoveSingle( pmove_t *pmove )
if( pm->ps->pm_type == PM_FREEZE)
return; // no movement at all
- if( pm->ps->pm_type == PM_INTERMISSION || pm->ps->pm_type == PM_SPINTERMISSION )
+ if( pm->ps->pm_type == PM_INTERMISSION )
return; // no movement at all
// set watertype, and waterlevel
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index f1400522..ca61f135 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -114,7 +114,6 @@ typedef enum
PM_DEAD, // no acceleration or turning, but free falling
PM_FREEZE, // stuck in place with no control
PM_INTERMISSION, // no movement or status bar
- PM_SPINTERMISSION // no movement or status bar
} pmtype_t;
typedef enum
@@ -229,18 +228,16 @@ typedef enum
#define SCA_WALLJUMPER 0x00000040
#define SS_WALLCLIMBING 0x00000001
-#define SS_WALLCLIMBINGCEILING 0x00000002
-#define SS_CREEPSLOWED 0x00000004
-#define SS_SPEEDBOOST 0x00000008
-#define SS_INFESTING 0x00000010
-#define SS_GRABBED 0x00000020
-#define SS_BLOBLOCKED 0x00000040
-#define SS_POISONED 0x00000080
-#define SS_HOVELING 0x00000100
-#define SS_BOOSTED 0x00000200
-#define SS_SLOWLOCKED 0x00000400
-#define SS_BOOSTEDWARNING 0x00000800 // booster poison is running out
-#define SS_CHARGING 0x00001000
+#define SS_CREEPSLOWED 0x00000002
+#define SS_SPEEDBOOST 0x00000004
+#define SS_GRABBED 0x00000008
+#define SS_BLOBLOCKED 0x00000010
+#define SS_POISONED 0x00000020
+#define SS_HOVELING 0x00000040
+#define SS_BOOSTED 0x00000080
+#define SS_SLOWLOCKED 0x00000100
+#define SS_BOOSTEDWARNING 0x00000200 // booster poison is running out
+#define SS_CHARGING 0x00000400
#define SS_HEALING_ACTIVE 0x00002000 // medistat for Humans, creep for Aliens
#define SS_HEALING_2X 0x00004000 // medkit or double healing rate (for HUD)
#define SS_HEALING_3X 0x00008000 // triple healing rate (for HUD)
diff --git a/src/game/g_active.c b/src/game/g_active.c
index c5f1bd8e..8b3b79fc 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -360,7 +360,6 @@ void G_TouchTriggers( gentity_t *ent )
// ignore most entities if a spectator
if( ( ent->client->sess.spectatorState != SPECTATOR_NOT ) ||
- ( ent->client->ps.stats[ STAT_STATE ] & SS_INFESTING ) ||
( ent->client->ps.stats[ STAT_STATE ] & SS_HOVELING ) )
{
if( hit->s.eType != ET_TELEPORT_TRIGGER &&
@@ -1406,8 +1405,7 @@ void ClientThink_real( gentity_t *ent )
client->ps.pm_type = PM_NOCLIP;
else if( client->ps.stats[ STAT_HEALTH ] <= 0 )
client->ps.pm_type = PM_DEAD;
- else if( client->ps.stats[ STAT_STATE ] & SS_INFESTING ||
- client->ps.stats[ STAT_STATE ] & SS_HOVELING )
+ else if( client->ps.stats[ STAT_STATE ] & SS_HOVELING )
client->ps.pm_type = PM_FREEZE;
else if( client->ps.stats[ STAT_STATE ] & SS_BLOBLOCKED ||
client->ps.stats[ STAT_STATE ] & SS_GRABBED )
@@ -1538,8 +1536,7 @@ void ClientThink_real( gentity_t *ent )
if( pm.ps->pm_type == PM_DEAD )
pm.tracemask = MASK_DEADSOLID;
- if( pm.ps->stats[ STAT_STATE ] & SS_INFESTING ||
- pm.ps->stats[ STAT_STATE ] & SS_HOVELING )
+ if( pm.ps->stats[ STAT_STATE ] & SS_HOVELING )
pm.tracemask = MASK_DEADSOLID;
else
pm.tracemask = MASK_PLAYERSOLID;
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 3214ce3d..87fa5777 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -500,9 +500,6 @@ Cmd_Kill_f
*/
void Cmd_Kill_f( gentity_t *ent )
{
- if( ent->client->ps.stats[ STAT_STATE ] & SS_INFESTING )
- return;
-
if( ent->client->ps.stats[ STAT_STATE ] & SS_HOVELING )
{
trap_SendServerCommand( ent-g_entities, "print \"Leave the hovel first (use your destroy key)\n\"" );
@@ -1626,7 +1623,6 @@ void Cmd_Class_f( gentity_t *ent )
return;
if( ent->client->pers.teamSelection == TEAM_ALIENS &&
- !( ent->client->ps.stats[ STAT_STATE ] & SS_INFESTING ) &&
!( ent->client->ps.stats[ STAT_STATE ] & SS_HOVELING ) )
{
if( newClass == PCL_NONE )
@@ -1640,8 +1636,7 @@ void Cmd_Class_f( gentity_t *ent )
{
int cost;
- if( ( ent->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBING ) ||
- ( ent->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) )
+ if( ent->client->ps.eFlags & EF_WALLCLIMB )
{
G_TriggerMenu( clientNum, MN_A_EVOLVEWALLWALK );
return;
@@ -1753,20 +1748,18 @@ void Cmd_Destroy_f( gentity_t *ent )
if( ent->client->ps.stats[ STAT_STATE ] & SS_HOVELING )
G_Damage( ent->client->hovel, ent, ent, forward, ent->s.origin, 10000, 0, MOD_SUICIDE );
- if( !( ent->client->ps.stats[ STAT_STATE ] & SS_INFESTING ) )
- {
- AngleVectors( ent->client->ps.viewangles, forward, NULL, NULL );
- VectorMA( ent->client->ps.origin, 100, forward, end );
+ AngleVectors( ent->client->ps.viewangles, forward, NULL, NULL );
+ VectorMA( ent->client->ps.origin, 100, forward, end );
- trap_Trace( &tr, ent->client->ps.origin, NULL, NULL, end, ent->s.number, MASK_PLAYERSOLID );
- traceEnt = &g_entities[ tr.entityNum ];
+ trap_Trace( &tr, ent->client->ps.origin, NULL, NULL, end, ent->s.number, MASK_PLAYERSOLID );
+ traceEnt = &g_entities[ tr.entityNum ];
- if( tr.fraction < 1.0f &&
- ( traceEnt->s.eType == ET_BUILDABLE ) &&
- ( traceEnt->buildableTeam == ent->client->pers.teamSelection ) &&
- ( ( ent->client->ps.weapon >= WP_ABUILD ) &&
- ( ent->client->ps.weapon <= WP_HBUILD ) ) )
- {
+ if( tr.fraction < 1.0f &&
+ ( traceEnt->s.eType == ET_BUILDABLE ) &&
+ ( traceEnt->buildableTeam == ent->client->pers.teamSelection ) &&
+ ( ( ent->client->ps.weapon >= WP_ABUILD ) &&
+ ( ent->client->ps.weapon <= WP_HBUILD ) ) )
+ {
// Always let the builder prevent the explosion
if( traceEnt->health <= 0 )
{
@@ -1774,70 +1767,69 @@ void Cmd_Destroy_f( gentity_t *ent )
return;
}
- // Cancel deconstruction
- if( g_markDeconstruct.integer && traceEnt->deconstruct )
- {
- traceEnt->deconstruct = qfalse;
- return;
- }
+ // Cancel deconstruction
+ if( g_markDeconstruct.integer && traceEnt->deconstruct )
+ {
+ traceEnt->deconstruct = qfalse;
+ return;
+ }
- // Prevent destruction of the last spawn
- if( !g_markDeconstruct.integer && !g_cheats.integer )
+ // Prevent destruction of the last spawn
+ if( !g_markDeconstruct.integer && !g_cheats.integer )
+ {
+ if( ent->client->pers.teamSelection == TEAM_ALIENS &&
+ traceEnt->s.modelindex == BA_A_SPAWN )
{
- if( ent->client->pers.teamSelection == TEAM_ALIENS &&
- traceEnt->s.modelindex == BA_A_SPAWN )
- {
- if( level.numAlienSpawns <= 1 )
+ if( level.numAlienSpawns <= 1 )
{
G_TriggerMenu( ent->client->ps.clientNum, MN_B_LASTSPAWN );
- return;
+ return;
}
- }
- else if( ent->client->pers.teamSelection == TEAM_HUMANS &&
- traceEnt->s.modelindex == BA_H_SPAWN )
- {
- if( level.numHumanSpawns <= 1 )
+ }
+ else if( ent->client->pers.teamSelection == TEAM_HUMANS &&
+ traceEnt->s.modelindex == BA_H_SPAWN )
+ {
+ if( level.numHumanSpawns <= 1 )
{
G_TriggerMenu( ent->client->ps.clientNum, MN_B_LASTSPAWN );
- return;
+ return;
}
- }
}
+ }
- // Don't allow destruction of hovel with granger inside
- if( traceEnt->s.modelindex == BA_A_HOVEL && traceEnt->active )
- return;
+ // Don't allow destruction of hovel with granger inside
+ if( traceEnt->s.modelindex == BA_A_HOVEL && traceEnt->active )
+ return;
- // Don't allow destruction of buildables that cannot be rebuilt
- if( G_TimeTilSuddenDeath( ) <= 0 )
- return;
+ // Don't allow destruction of buildables that cannot be rebuilt
+ if( G_TimeTilSuddenDeath( ) <= 0 )
+ return;
+
+ if( !g_markDeconstruct.integer && ent->client->ps.stats[ STAT_MISC ] > 0 )
+ {
+ G_AddEvent( ent, EV_BUILD_DELAY, ent->client->ps.clientNum );
+ return;
+ }
- if( !g_markDeconstruct.integer && ent->client->ps.stats[ STAT_MISC ] > 0 )
+ if( g_markDeconstruct.integer )
+ {
+ if( !deconstruct )
+ G_Damage( traceEnt, ent, ent, forward, tr.endpos, ent->health, 0, MOD_SUICIDE );
+ else if( g_markDeconstruct.integer )
{
- G_AddEvent( ent, EV_BUILD_DELAY, ent->client->ps.clientNum );
- return;
+ traceEnt->deconstruct = qtrue; // Mark buildable for deconstruction
+ traceEnt->deconstructTime = level.time;
}
-
- if( g_markDeconstruct.integer )
+ else
{
- if( !deconstruct )
- G_Damage( traceEnt, ent, ent, forward, tr.endpos, ent->health, 0, MOD_SUICIDE );
- else if( g_markDeconstruct.integer )
- {
- traceEnt->deconstruct = qtrue; // Mark buildable for deconstruction
- traceEnt->deconstructTime = level.time;
- }
- else
- {
- G_LogDestruction( traceEnt, ent, MOD_DECONSTRUCT );
- G_FreeEntity( traceEnt );
- }
+ G_LogDestruction( traceEnt, ent, MOD_DECONSTRUCT );
+ G_FreeEntity( traceEnt );
+ }
- if( !g_cheats.integer )
- {
- ent->client->ps.stats[ STAT_MISC ] +=
- BG_Buildable( traceEnt->s.modelindex )->buildTime;
- }
+ if( !g_cheats.integer )
+ {
+ ent->client->ps.stats[ STAT_MISC ] +=
+ BG_Buildable( traceEnt->s.modelindex )->buildTime;
}
}
}
@@ -2339,7 +2331,6 @@ void Cmd_Build_f( gentity_t *ent )
if( buildable != BA_NONE &&
( ( 1 << ent->client->ps.weapon ) & BG_Buildable( buildable )->buildWeapon ) &&
- !( ent->client->ps.stats[ STAT_STATE ] & SS_INFESTING ) &&
!( ent->client->ps.stats[ STAT_STATE ] & SS_HOVELING ) &&
BG_BuildableIsAllowed( buildable ) &&
( ( team == TEAM_ALIENS && BG_BuildableAllowedInStage( buildable, g_alienStage.integer ) ) ||
@@ -2410,13 +2401,23 @@ Cmd_Reload_f
void Cmd_Reload_f( gentity_t *ent )
{
playerState_t *ps = &ent->client->ps;
+ int ammo;
// weapon doesn't ever need reloading
if( BG_Weapon( ps->weapon )->infiniteAmmo )
return;
+ if( ps->clips <= 0 )
+ return;
+
+ if( BG_Weapon( ps->weapon )->usesEnergy &&
+ BG_InventoryContainsUpgrade( UP_BATTPACK, ps->stats ) )
+ ammo = BG_Weapon( ps->weapon )->maxAmmo * BATTPACK_MODIFIER;
+ else
+ ammo = BG_Weapon( ps->weapon )->maxAmmo;
+
// don't reload when full
- if( ps->ammo == BG_Weapon( ps->weapon )->maxAmmo )
+ if( ps->ammo >= ammo )
return;
// the animation, ammo refilling etc. is handled by PM_Weapon
@@ -2485,9 +2486,8 @@ void G_StopFollowing( gentity_t *ent )
ent->client->sess.spectatorClient = -1;
ent->client->ps.pm_flags &= ~PMF_FOLLOW;
ent->client->ps.stats[ STAT_STATE ] &= ~SS_WALLCLIMBING;
- ent->client->ps.stats[ STAT_STATE ] &= ~SS_WALLCLIMBINGCEILING;
ent->client->ps.stats[ STAT_VIEWLOCK ] = 0;
- ent->client->ps.eFlags &= ~EF_WALLCLIMB;
+ ent->client->ps.eFlags &= ~( EF_WALLCLIMB | EF_WALLCLIMBCEILING );
ent->client->ps.viewangles[ PITCH ] = 0.0f;
ent->client->ps.clientNum = ent - g_entities;
@@ -2514,9 +2514,8 @@ void G_FollowLockView( gentity_t *ent )
ent->client->ps.pm_flags &= ~PMF_FOLLOW;
ent->client->ps.stats[ STAT_TEAM ] = ent->client->pers.teamSelection;
ent->client->ps.stats[ STAT_STATE ] &= ~SS_WALLCLIMBING;
- ent->client->ps.stats[ STAT_STATE ] &= ~SS_WALLCLIMBINGCEILING;
ent->client->ps.stats[ STAT_VIEWLOCK ] = 0;
- ent->client->ps.eFlags &= ~EF_WALLCLIMB;
+ ent->client->ps.eFlags &= ~( EF_WALLCLIMB | EF_WALLCLIMBCEILING );
ent->client->ps.eFlags ^= EF_TELEPORT_BIT;
ent->client->ps.viewangles[ PITCH ] = 0.0f;