From 55607e9767280b238fad1e7cdd9b560be9529b6e Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Sat, 15 Apr 2006 23:53:51 +0000 Subject: * Lucifer cannon exploit fix (R1CH) * Sudden death/time limit warnings (R1CH) --- src/game/bg_pmove.c | 2 +- src/game/g_local.h | 11 +++++++++++ src/game/g_main.c | 41 +++++++++++++++++++++++++++++++++++++---- 3 files changed, 49 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index a2a9f543..c1c97142 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -3021,7 +3021,7 @@ static void PM_Weapon( void ) if( !BG_FindInfinteAmmoForWeapon( pm->ps->weapon ) ) { //special case for lCanon - if( pm->ps->weapon == WP_LUCIFER_CANNON && attack1 ) + if( pm->ps->weapon == WP_LUCIFER_CANNON && attack1 && !attack2 ) { ammo -= (int)( ceil( ( (float)pm->ps->stats[ STAT_MISC ] / (float)LCANNON_TOTAL_CHARGE ) * 10.0f ) ); diff --git a/src/game/g_local.h b/src/game/g_local.h index 874afeee..1d6bc99e 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -478,6 +478,14 @@ typedef struct armourRegion_s qboolean crouch; } armourRegion_t; +//status of the warning of certain events +typedef enum +{ + TW_NOT = 0, + TW_IMMINENT, + TW_PASSED +} timeWarning_t; + // // this structure is cleared as each map is entered // @@ -593,6 +601,9 @@ typedef struct pTeam_t lastWin; + timeWarning_t suddenDeathWarning; + timeWarning_t timelimitWarning; + spawnQueue_t alienSpawnQueue; spawnQueue_t humanSpawnQueue; diff --git a/src/game/g_main.c b/src/game/g_main.c index b07afc75..a5a06728 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -910,11 +910,32 @@ void G_CalculateBuildPoints( void ) int localHTP = g_humanBuildPoints.integer, localATP = g_alienBuildPoints.integer; - if( g_suddenDeathTime.integer && !level.warmupTime && - ( level.time - level.startTime >= g_suddenDeathTime.integer * 60000 ) ) + if( g_suddenDeathTime.integer ) { - localHTP = 0; - localATP = 0; + if( !level.warmupTime && + ( level.time - level.startTime >= g_suddenDeathTime.integer * 60000 ) ) + { + localHTP = 0; + localATP = 0; + + //warn about sudden death + if( level.time - level.startTime >= g_suddenDeathTime.integer * 60000 && + level.suddenDeathWarning < TW_PASSED ) + { + trap_SendServerCommand( -1, "cp \"Sudden Death!\"" ); + level.suddenDeathWarning = TW_PASSED; + } + } + else + { + //warn about sudden death + if( level.time - level.startTime >= ( g_suddenDeathTime.integer - 1 ) * 60000 && + level.suddenDeathWarning < TW_IMMINENT ) + { + trap_SendServerCommand( -1, "cp \"Sudden Death in 1 minute!\"" ); + level.suddenDeathWarning = TW_IMMINENT; + } + } } else { @@ -1721,6 +1742,18 @@ void CheckExitRules( void ) LogExit( "Timelimit hit." ); return; } + else if( level.time - level.startTime >= ( g_timelimit.integer - 5 ) * 60000 && + level.timelimitWarning < TW_IMMINENT ) + { + trap_SendServerCommand( -1, "cp \"5 minutes remaining!\"" ); + level.timelimitWarning = TW_IMMINENT; + } + else if( level.time - level.startTime >= ( g_timelimit.integer - 1 ) * 60000 && + level.timelimitWarning < TW_PASSED ) + { + trap_SendServerCommand( -1, "cp \"1 minute remaining!\"" ); + level.timelimitWarning = TW_PASSED; + } } if( level.uncondHumanWin || -- cgit