diff options
author | Ben Millwood <thebenmachine@gmail.com> | 2009-10-03 11:39:12 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:15:12 +0000 |
commit | a13e8058f45894a05f3f9d086e42ed1b16b12694 (patch) | |
tree | 6b912f5ccdc8349427580163200ddbd2c60f8769 /src/cgame | |
parent | 9be2d1add7fe8a18d1e7dc20bd25c33f0cd03ad2 (diff) |
Credit based stages
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_draw.c | 23 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 4 | ||||
-rw-r--r-- | src/cgame/cg_servercmds.c | 4 |
3 files changed, 17 insertions, 14 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index b75c1ff5..d03933ba 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -1466,7 +1466,6 @@ static void CG_DrawStageReport( rectDef_t *rect, float text_x, float text_y, { char s[ MAX_TOKEN_CHARS ]; float tx, ty; - int kills; if( cg.intermissionStarted ) return; @@ -1476,29 +1475,33 @@ static void CG_DrawStageReport( rectDef_t *rect, float text_x, float text_y, if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) { - kills = cgs.alienNextStageThreshold - cgs.alienKills; + int kills = ceil( (float)(cgs.alienNextStageThreshold - cgs.alienCredits) / ALIEN_CREDITS_PER_FRAG ); + if( kills < 0 ) + kills = 0; 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, %d kill for next stage", - cgs.alienStage + 1, kills ); + Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, 1 kill for next stage", + cgs.alienStage + 1 ); else Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, %d kills for next stage", cgs.alienStage + 1, kills ); } else if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) { - kills = cgs.humanNextStageThreshold - cgs.humanKills; + int credits = cgs.humanNextStageThreshold - cgs.humanCredits; + if( credits < 0 ) + credits = 0; if( cgs.humanNextStageThreshold < 0 ) Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d", cgs.humanStage + 1 ); - else if( kills == 1 ) - Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, %d kill for next stage", - cgs.humanStage + 1, kills ); + else if( credits == 1 ) + Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, 1 credit for next stage", + cgs.humanStage + 1 ); else - Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, %d kills for next stage", - cgs.humanStage + 1, kills ); + Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, %d credits for next stage", + cgs.humanStage + 1, credits ); } CG_AlignText( rect, s, scale, 0.0f, 0.0f, textalign, textvalign, &tx, &ty ); diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 470069c1..71804880 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1369,8 +1369,8 @@ typedef struct int alienStage; int humanStage; - int alienKills; - int humanKills; + int alienCredits; + int humanCredits; int alienNextStageThreshold; int humanNextStageThreshold; diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index 9cdfed8d..8f860072 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -157,7 +157,7 @@ void CG_SetConfigValues( void ) &cgs.humanBuildPointsPowered ); sscanf( CG_ConfigString( CS_STAGES ), "%d %d %d %d %d %d", &cgs.alienStage, &cgs.humanStage, - &cgs.alienKills, &cgs.humanKills, &cgs.alienNextStageThreshold, &cgs.humanNextStageThreshold ); + &cgs.alienCredits, &cgs.humanCredits, &cgs.alienNextStageThreshold, &cgs.humanNextStageThreshold ); cgs.levelStartTime = atoi( CG_ConfigString( CS_LEVEL_START_TIME ) ); cg.warmup = atoi( CG_ConfigString( CS_WARMUP ) ); @@ -282,7 +282,7 @@ static void CG_ConfigStringModified( void ) sscanf( str, "%d %d %d %d %d %d", &cgs.alienStage, &cgs.humanStage, - &cgs.alienKills, &cgs.humanKills, + &cgs.alienCredits, &cgs.humanCredits, &cgs.alienNextStageThreshold, &cgs.humanNextStageThreshold ); if( cgs.alienStage != oldAlienStage ) |