summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoman Tetelman <kevlarman@gmail.com>2009-10-03 12:09:42 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:15:43 +0000
commit186b84bec1705d8288beb043dbb9f94e378eff74 (patch)
tree4e3a2f1bf19fad64642e1848f6f35d6bc843f51c /src
parentbc81ff265ad2699736994ece789ddd8b41fd7af6 (diff)
* make the enemy team lose a stage when you reach "stage 4"
* pleasedonthurtmenorfmademedoit
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_draw.c27
-rw-r--r--src/cgame/cg_servercmds.c13
-rw-r--r--src/game/g_local.h5
-rw-r--r--src/game/g_main.c81
4 files changed, 65 insertions, 61 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 7619c647..bdff5eed 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -1465,6 +1465,7 @@ static void CG_DrawStageReport( rectDef_t *rect, float text_x, float text_y,
vec4_t color, float scale, int textalign, int textvalign, int textStyle )
{
char s[ MAX_TOKEN_CHARS ];
+ char *reward;
float tx, ty;
if( cg.intermissionStarted )
@@ -1479,14 +1480,19 @@ static void CG_DrawStageReport( rectDef_t *rect, float text_x, float text_y,
if( kills < 0 )
kills = 0;
+ if( cgs.alienStage < S3 )
+ reward = "next stage";
+ else
+ reward = "enemy stagedown";
+
if( cgs.alienNextStageThreshold < 0 )
Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d", cgs.alienStage + 1 );
else if( kills == 1 )
- Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, 1 kill for next stage",
- cgs.alienStage + 1 );
+ Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, 1 kill for %s",
+ cgs.alienStage + 1, reward );
else
- Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, %d kills for next stage",
- cgs.alienStage + 1, kills );
+ Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, %d kills for %s",
+ cgs.alienStage + 1, kills, reward );
}
else if( cg.snap->ps.stats[ STAT_TEAM ] == TEAM_HUMANS )
{
@@ -1495,14 +1501,19 @@ static void CG_DrawStageReport( rectDef_t *rect, float text_x, float text_y,
if( credits < 0 )
credits = 0;
+ if( cgs.humanStage < S3 )
+ reward = "next stage";
+ else
+ reward = "enemy stagedown";
+
if( cgs.humanNextStageThreshold < 0 )
Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d", cgs.humanStage + 1 );
else if( credits == 1 )
- Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, 1 credit for next stage",
- cgs.humanStage + 1 );
+ Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, 1 credit for %s",
+ cgs.humanStage + 1, reward );
else
- Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, %d credits for next stage",
- cgs.humanStage + 1, credits );
+ Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, %d credits for %s",
+ cgs.humanStage + 1, credits, reward );
}
CG_AlignText( rect, s, scale, 0.0f, 0.0f, textalign, textvalign, &tx, &ty );
diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c
index c358133f..c21d1a52 100644
--- a/src/cgame/cg_servercmds.c
+++ b/src/cgame/cg_servercmds.c
@@ -236,7 +236,11 @@ static void CG_AnnounceAlienStageTransistion( stage_t from, stage_t to )
return;
trap_S_StartLocalSound( cgs.media.alienStageTransition, CHAN_ANNOUNCER );
- CG_CenterPrint( "We have evolved!", 200, GIANTCHAR_WIDTH * 4 );
+ if( to > from )
+ CG_CenterPrint( "We have evolved!", 200, GIANTCHAR_WIDTH * 4 );
+ else
+ CG_CenterPrint( "We have devolved!", 200, GIANTCHAR_WIDTH * 4 );
+
}
/*
@@ -250,7 +254,12 @@ static void CG_AnnounceHumanStageTransistion( stage_t from, stage_t to )
return;
trap_S_StartLocalSound( cgs.media.humanStageTransition, CHAN_ANNOUNCER );
- CG_CenterPrint( "Reinforcements have arrived!", 200, GIANTCHAR_WIDTH * 4 );
+
+ if( to > from )
+ CG_CenterPrint( "Reinforcements have arrived!", 200, GIANTCHAR_WIDTH * 4 );
+ else
+ CG_CenterPrint( "Reinforcements have been withdrawn!", 200, GIANTCHAR_WIDTH * 4 );
+
}
/*
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 032032c7..a70a02e5 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -614,8 +614,8 @@ typedef struct
int humanStage2Time;
int humanStage3Time;
- int savedAlienCredits; // Credits at the time the opposing team
- int savedHumanCredits; // became vulnerable to a stage-down
+ int alienStagedownCredits; // Credits at the time the opposing team
+ int humanStagedownCredits; // became vulnerable to a stage-down
qboolean uncondAlienWin;
@@ -1133,7 +1133,6 @@ extern vmCvar_t g_alienCredits;
extern vmCvar_t g_alienMaxStage;
extern vmCvar_t g_alienMaxReachedStage;
extern vmCvar_t g_alienStageThreshold;
-extern vmCvar_t g_allowStageDowns;
extern vmCvar_t g_unlagged;
diff --git a/src/game/g_main.c b/src/game/g_main.c
index f61ff28e..b4d3974e 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -230,7 +230,6 @@ static cvarTable_t gameCvarTable[ ] =
{ &g_alienMaxStage, "g_alienMaxStage", DEFAULT_ALIEN_MAX_STAGE, 0, 0, qfalse },
{ &g_alienMaxReachedStage, "g_alienMaxReachedStage", "0", 0, 0, qfalse },
{ &g_alienStageThreshold, "g_alienStageThreshold", DEFAULT_ALIEN_STAGE2_THRESH, 0, 0, qfalse },
- { &g_allowStageDowns, "g_allowStageDowns", "0", CVAR_ARCHIVE, 0, qfalse },
{ &g_unlagged, "g_unlagged", "1", CVAR_SERVERINFO | CVAR_ARCHIVE, 0, qfalse },
@@ -542,7 +541,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart )
level.startTime = levelTime;
level.alienStage2Time = level.alienStage3Time =
level.humanStage2Time = level.humanStage3Time = level.startTime;
- level.savedAlienCredits = level.savedHumanCredits = -1;
+ level.alienStagedownCredits = level.humanStagedownCredits = -1;
level.snd_fry = G_SoundIndex( "sound/misc/fry.wav" ); // FIXME standing in lava / slime
@@ -1172,30 +1171,19 @@ void G_CalculateBuildPoints( void )
if( humanPlayerCountMod < 0.1f )
humanPlayerCountMod = 0.1f;
- /*if( g_alienStage.integer == S1 && g_alienMaxStage.integer > S1 )
- alienNextStageThreshold = (int)( ceil( (float)g_alienStage2Threshold.integer * alienPlayerCountMod ) );
- else if( g_alienStage.integer == S2 && g_alienMaxStage.integer > S2 )
- alienNextStageThreshold = (int)( ceil( (float)g_alienStage3Threshold.integer * alienPlayerCountMod ) );
- else
- alienNextStageThreshold = -1;*/
- if( g_alienStage.integer < g_alienMaxStage.integer ||
- (g_allowStageDowns.integer && g_humanStage.integer > S1) )
+ if( g_alienStage.integer < g_alienMaxStage.integer ||
+ g_humanStage.integer > S1 )
alienNextStageThreshold = (int)( ceil( (float)g_alienStageThreshold.integer * (g_alienStage.integer + 1) * alienPlayerCountMod ) );
else
alienNextStageThreshold = -1;
- /*if( g_humanStage.integer == S1 && g_humanMaxStage.integer > S1 )
- humanNextStageThreshold = (int)( ceil( (float)g_humanStage2Threshold.integer * humanPlayerCountMod ) );
- else if( g_humanStage.integer == S2 && g_humanMaxStage.integer > S2 )
- humanNextStageThreshold = (int)( ceil( (float)g_humanStage3Threshold.integer * humanPlayerCountMod ) );
- else
- humanNextStageThreshold = -1;*/
- //FIXME: more code that breaks if maxstage > 2
- if( g_humanStage.integer < g_humanMaxStage.integer ||
- (g_allowStageDowns.integer && g_alienStage.integer > S1 ) )
+
+ if( g_humanStage.integer < g_humanMaxStage.integer ||
+ g_alienStage.integer > S1 )
humanNextStageThreshold = (int)( ceil( (float)g_humanStageThreshold.integer * (g_humanStage.integer + 1) * humanPlayerCountMod ) );
else
humanNextStageThreshold = -1;
+
// save a lot of bandwidth by rounding thresholds up to the nearest 100
if( alienNextStageThreshold > 0 )
alienNextStageThreshold = ceil( (float)alienNextStageThreshold / 100 ) * 100;
@@ -1221,7 +1209,7 @@ void G_CalculateStages( void )
float humanPlayerCountMod = level.averageNumHumanClients / PLAYER_COUNT_MOD;
static int lastAlienStageModCount = 1;
static int lastHumanStageModCount = 1;
- //qboolean stageDown = qfalse;
+
if( alienPlayerCountMod < 0.1f )
alienPlayerCountMod = 0.1f;
@@ -1229,73 +1217,71 @@ void G_CalculateStages( void )
if( humanPlayerCountMod < 0.1f )
humanPlayerCountMod = 0.1f;
- //FIXME: make this code not break horribly when maxstage > 2
if( g_alienCredits.integer >=
- (int)( ceil( (float)g_alienStageThreshold.integer * (g_alienStage.integer + 1) * alienPlayerCountMod ) ) &&
+ (int)( ceil( (float)g_alienStageThreshold.integer * S2 * alienPlayerCountMod ) ) &&
g_alienStage.integer == S1 && g_alienMaxStage.integer > S1 )
{
trap_Cvar_Set( "g_alienStage", va( "%d", S2 ) );
level.alienStage2Time = level.time;
lastAlienStageModCount = g_alienMaxReachedStage.modificationCount;
- if( g_humanStage.integer == g_humanMaxStage.integer )
- level.savedHumanCredits = g_alienCredits.integer;
- //trap_Cvar_Update( g_alienStage );
+ if( g_humanStage.integer == S3 )
+ level.humanStagedownCredits = g_humanCredits.integer;
}
if( g_alienCredits.integer >=
- (int)( ceil( (float)g_alienStageThreshold.integer * (g_alienStage.integer + 1) * alienPlayerCountMod ) ) &&
+ (int)( ceil( (float)g_alienStageThreshold.integer * S3 * alienPlayerCountMod ) ) &&
g_alienStage.integer == S2 && g_alienMaxStage.integer > S2 )
{
trap_Cvar_Set( "g_alienStage", va( "%d", S3 ) );
level.alienStage3Time = level.time;
lastAlienStageModCount = g_alienMaxReachedStage.modificationCount;
if( g_humanStage.integer > S1 )
- level.savedAlienCredits = g_alienCredits.integer;
- //trap_Cvar_Update( g_alienStage );
+ level.alienStagedownCredits = g_alienCredits.integer;
}
if( g_humanCredits.integer >=
- (int)( ceil( (float)g_humanStageThreshold.integer * (g_humanStage.integer + 1) * humanPlayerCountMod ) ) &&
+ (int)( ceil( (float)g_humanStageThreshold.integer * S2 * humanPlayerCountMod ) ) &&
g_humanStage.integer == S1 && g_humanMaxStage.integer > S1 )
{
trap_Cvar_Set( "g_humanStage", va( "%d", S2 ) );
level.humanStage2Time = level.time;
lastHumanStageModCount = g_humanMaxReachedStage.modificationCount;
- if( g_alienStage.integer == g_alienMaxStage.integer )
- level.savedAlienCredits = g_alienCredits.integer;
- //trap_Cvar_Update( g_humanStage );
+ if( g_alienStage.integer == S3 )
+ level.alienStagedownCredits = g_alienCredits.integer;
}
if( g_humanCredits.integer >=
- (int)( ceil( (float)g_humanStageThreshold.integer * (g_humanStage.integer + 1) * humanPlayerCountMod ) ) &&
+ (int)( ceil( (float)g_humanStageThreshold.integer * S3 * humanPlayerCountMod ) ) &&
g_humanStage.integer == S2 && g_humanMaxStage.integer > S2 )
{
trap_Cvar_Set( "g_humanStage", va( "%d", S3 ) );
level.humanStage3Time = level.time;
lastHumanStageModCount = g_humanMaxReachedStage.modificationCount;
if( g_alienStage.integer > S1 )
- level.savedHumanCredits = g_humanCredits.integer;
+ level.humanStagedownCredits = g_humanCredits.integer;
//trap_Cvar_Update( g_humanStage );
}
if( g_alienStage.integer > S1 &&
- g_humanCredits.integer - level.savedHumanCredits >=
+ g_humanStage.integer == S3 &&
+ g_humanCredits.integer - level.humanStagedownCredits >=
(int) ceil( g_humanStageThreshold.integer * humanPlayerCountMod ) )
{
-
- /*if( g_alienStage == S3 )
- level.alienStage3Time = -1;
- if( g_alienStage == S2 )
- level.alienStage2Time = -1;*/
+
+ if( g_alienStage.integer == S3 )
+ level.alienStage3Time = level.startTime;
+ if( g_alienStage.integer == S2 )
+ level.alienStage2Time = level.startTime;
lastAlienStageModCount = g_alienStage.modificationCount;
- trap_Cvar_Set( "g_alienStage", va( "%d", g_alienStage.integer >> 1 ) );
- trap_Cvar_Set( "g_alienCredits", va( "%d", g_alienCredits.integer - g_alienStageThreshold.integer * alienPlayerCountMod ) );
- trap_Cvar_Set( "g_humanCredits", va( "%d", g_humanCredits.integer - g_humanStageThreshold.integer * humanPlayerCountMod ) );
+ trap_Cvar_Set( "g_alienStage", va( "%d", g_alienStage.integer - 1 ) );
+ trap_Cvar_Set( "g_alienCredits", va( "%d", (int)ceil(g_alienCredits.integer - g_alienStageThreshold.integer * alienPlayerCountMod) ) );
+ trap_Cvar_Set( "g_humanCredits", va( "%d", (int)ceil(g_humanCredits.integer - g_humanStageThreshold.integer * humanPlayerCountMod) ) );
//stageDown = qtrue;
}
if( g_humanStage.integer > S1 &&
- g_alienCredits.integer - level.savedAlienCredits >=
+ g_alienStage.integer == S3 &&
+ g_alienCredits.integer - level.alienStagedownCredits >=
(int) ceil( g_alienStageThreshold.integer * alienPlayerCountMod ) )
{
@@ -1304,10 +1290,9 @@ void G_CalculateStages( void )
if( g_humanStage.integer == S2 )
level.humanStage2Time = level.startTime;
lastHumanStageModCount = g_humanStage.modificationCount;
- trap_Cvar_Set( "g_humanStage", va( "%d", g_humanStage.integer >> 1 ) );
- trap_Cvar_Set( "g_humanCredits", va( "%d", g_humanCredits.integer - g_alienStageThreshold.integer * humanPlayerCountMod ) );
- trap_Cvar_Set( "g_alienCredits", va( "%d", g_alienCredits.integer - g_alienStageThreshold.integer * alienPlayerCountMod ) );
- //stageDown = qtrue;
+ trap_Cvar_Set( "g_humanStage", va( "%d", g_humanStage.integer - 1 ) );
+ trap_Cvar_Set( "g_humanCredits", va( "%d", (int)ceil(g_humanCredits.integer - g_humanStageThreshold.integer * humanPlayerCountMod) ) );
+ trap_Cvar_Set( "g_alienCredits", va( "%d", (int)ceil(g_alienCredits.integer - g_alienStageThreshold.integer * alienPlayerCountMod) ) );
}
if( g_alienMaxReachedStage.modificationCount > lastAlienStageModCount )