summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/g_active.c3
-rw-r--r--src/game/g_cmds.c3
-rw-r--r--src/game/g_local.h1
-rw-r--r--src/game/g_main.c24
4 files changed, 21 insertions, 10 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c
index 76efa5f1..fe8368a1 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -1379,8 +1379,7 @@ void ClientThink_real( gentity_t *ent )
// Give clients some credit periodically
if( ent->client->lastKillTime + FREEKILL_PERIOD < level.time )
{
- if( g_suddenDeathTime.integer &&
- ( level.time - level.startTime >= g_suddenDeathTime.integer * 60000 ) )
+ if( G_TimeTilSuddenDeath( ) <= 0 )
{
//gotta love logic like this eh?
}
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index e99153d6..8b2e3f86 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -1738,8 +1738,7 @@ void Cmd_Destroy_f( gentity_t *ent, qboolean deconstruct )
return;
// Don't allow destruction of buildables that cannot be rebuilt
- if( g_suddenDeathTime.integer && ( level.time - level.startTime >=
- g_suddenDeathTime.integer * 60000 ) &&
+ if( G_TimeTilSuddenDeath( ) <= 0 &&
BG_FindBuildPointsForBuildable( traceEnt->s.modelindex ) )
{
return;
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 578baf91..a4fe225b 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -900,6 +900,7 @@ void QDECL G_Error( const char *fmt, ... );
void CheckVote( void );
void CheckTeamVote( int teamnum );
void LogExit( const char *string );
+int G_TimeTilSuddenDeath( void );
//
// g_client.c
diff --git a/src/game/g_main.c b/src/game/g_main.c
index a9923318..c2a4d66a 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -969,6 +969,20 @@ void G_CountSpawns( void )
level.numAlienSpawns, level.numHumanSpawns ) );
}
+/*
+============
+G_TimeTilSuddenDeath
+============
+*/
+int G_TimeTilSuddenDeath( void )
+{
+ if( !g_suddenDeathTime.integer )
+ return 1; // Always some time away
+
+ return ( g_suddenDeathTime.integer * 60000 ) -
+ ( level.time - level.startTime );
+}
+
#define PLAYER_COUNT_MOD 5.0f
@@ -987,17 +1001,15 @@ void G_CalculateBuildPoints( void )
int localHTP = g_humanBuildPoints.integer,
localATP = g_alienBuildPoints.integer;
- if( g_suddenDeathTime.integer )
+ if( g_suddenDeathTime.integer && !level.warmupTime )
{
- if( !level.warmupTime &&
- ( level.time - level.startTime >= g_suddenDeathTime.integer * 60000 ) )
+ if( G_TimeTilSuddenDeath( ) <= 0 )
{
localHTP = 0;
localATP = 0;
//warn about sudden death
- if( level.time - level.startTime >= g_suddenDeathTime.integer * 60000 &&
- level.suddenDeathWarning < TW_PASSED )
+ if( level.suddenDeathWarning < TW_PASSED )
{
trap_SendServerCommand( -1, "cp \"Sudden Death!\"" );
level.suddenDeathWarning = TW_PASSED;
@@ -1006,7 +1018,7 @@ void G_CalculateBuildPoints( void )
else
{
//warn about sudden death
- if( level.time - level.startTime >= ( g_suddenDeathTime.integer - 1 ) * 60000 &&
+ if( G_TimeTilSuddenDeath( ) <= 60000 &&
level.suddenDeathWarning < TW_IMMINENT )
{
trap_SendServerCommand( -1, "cp \"Sudden Death in 1 minute!\"" );