diff options
author | Tim Angus <tim@ngus.net> | 2005-07-21 01:42:41 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2005-07-21 01:42:41 +0000 |
commit | 48d452bba1e9845d7935e03c520623f0b65a136d (patch) | |
tree | a14ca612d27d7f254920771b1f0a0d0ceb55afe9 /src/cgame | |
parent | e98dcba13a94fb5c826d5d2e50d2a7bcc67040d1 (diff) |
* Change death by dragoon obituary from "clawed" to "chomped"
* Fixed the bug where spectators saw team chat
* Added ping display to the lagometer
* Renormalised some balance variables
* Fixed the bug where bodies would sometimes disappear immediately after death
* Fixed the "dancing buildables" bug
* Fixed the bug where buildable animation sounds were inappropriately played upon entering PVS
* Fixed a subtle stage bug
* Added code to indicate which stage a team is on via the scoreboard
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_buildable.c | 8 | ||||
-rw-r--r-- | src/cgame/cg_draw.c | 96 | ||||
-rw-r--r-- | src/cgame/cg_ents.c | 7 | ||||
-rw-r--r-- | src/cgame/cg_event.c | 2 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 4 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 1 | ||||
-rw-r--r-- | src/cgame/cg_servercmds.c | 8 |
7 files changed, 116 insertions, 10 deletions
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c index 9f4e6661..3b462dec 100644 --- a/src/cgame/cg_buildable.c +++ b/src/cgame/cg_buildable.c @@ -559,14 +559,20 @@ static void CG_RunBuildableLerpFrame( centity_t *cent ) { if( cg_debugRandom.integer ) CG_Printf( "newAnimation: %d lf->animationNumber: %d lf->animation: %d\n", - newAnimation, lf->animationNumber, !!lf->animation ); + newAnimation, lf->animationNumber, lf->animation ); CG_SetBuildableLerpFrameAnimation( buildable, lf, newAnimation ); if( !cg_buildables[ buildable ].sounds[ newAnimation ].looped && cg_buildables[ buildable ].sounds[ newAnimation ].enabled ) + { + if( cg_debugRandom.integer ) + CG_Printf( "Sound for animation %d for a %s\n", + newAnimation, BG_FindHumanNameForBuildable( buildable ) ); + trap_S_StartSound( cent->lerpOrigin, cent->currentState.number, CHAN_AUTO, cg_buildables[ buildable ].sounds[ newAnimation ].sound ); + } } if( cg_buildables[ buildable ].sounds[ lf->animationNumber ].looped && diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 7d2fbedd..5df933af 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -1654,6 +1654,70 @@ static void CG_DrawTeamSpectators( rectDef_t *rect, float scale, vec4_t color, q /* ================== +CG_DrawStageReport +================== +*/ +static void CG_DrawStageReport( rectDef_t *rect, float text_x, float text_y, + vec4_t color, float scale, int align, int textStyle ) +{ + char s[ MAX_TOKEN_CHARS ]; + int tx, w, kills; + + if( cg.snap->ps.persistant[ PERS_TEAM ] == TEAM_SPECTATOR ) + return; + + if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) + { + kills = cgs.alienNextStageThreshold - cgs.alienKills; + + 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 ); + 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; + + 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 + Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, %d kills for next stage", + cgs.humanStage + 1, kills ); + } + + w = CG_Text_Width( s, scale, 0 ); + + switch( align ) + { + case ITEM_ALIGN_LEFT: + tx = rect->x; + break; + + case ITEM_ALIGN_RIGHT: + tx = rect->x + rect->w - w; + break; + + case ITEM_ALIGN_CENTER: + tx = rect->x + ( rect->w / 2.0f ) - ( w / 2.0f ); + break; + + default: + tx = 0.0f; + } + + CG_Text_Paint( text_x + tx, rect->y + text_y, scale, color, s, 0, 0, textStyle ); +} + +/* +================== CG_DrawFPS ================== */ @@ -1998,12 +2062,15 @@ static void CG_DrawDisconnect( void ) #define MAX_LAGOMETER_PING 900 #define MAX_LAGOMETER_RANGE 300 +#define PING_FRAMES 40 + /* ============== CG_DrawLagometer ============== */ -static void CG_DrawLagometer( rectDef_t *rect, qhandle_t shader ) +static void CG_DrawLagometer( rectDef_t *rect, float text_x, float text_y, + float scale, vec4_t textColor ) { int a, x, y, i; float v; @@ -2027,7 +2094,6 @@ static void CG_DrawLagometer( rectDef_t *rect, qhandle_t shader ) ah = rect->h; trap_R_SetColor( NULL ); - CG_DrawPic( x, y, rect->w, rect->h, shader ); CG_AdjustFrom640( &ax, &ay, &aw, &ah ); @@ -2125,6 +2191,27 @@ static void CG_DrawLagometer( rectDef_t *rect, qhandle_t shader ) if( cg_nopredict.integer || cg_synchronousClients.integer ) CG_Text_Paint( ax, ay, 0.5, white, "snc", 0, 0, ITEM_TEXTSTYLE_NORMAL ); + else + { + static int previousPings[ PING_FRAMES ]; + static int index; + int i, ping = 0; + char *s; + + previousPings[ index++ ] = cg.snap->ping; + index = index % PING_FRAMES; + + for( i = 0; i < PING_FRAMES; i++ ) + ping += previousPings[ i ]; + + ping /= PING_FRAMES; + + s = va( "%d", ping ); + ax = rect->x + ( rect->w / 2.0f ) - ( CG_Text_Width( s, scale, 0 ) / 2.0f ) + text_x; + ay = rect->y + ( rect->h / 2.0f ) + ( CG_Text_Height( s, scale, 0 ) / 2.0f ) + text_y; + + CG_Text_Paint( ax, ay, scale, textColor, s, 0, 0, ITEM_TEXTSTYLE_NORMAL ); + } CG_DrawDisconnect( ); } @@ -2505,6 +2592,9 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x, case CG_PLAYER_CROSSHAIRNAMES: CG_DrawCrosshairNames( &rect, scale, textStyle ); break; + case CG_STAGE_REPORT_TEXT: + CG_DrawStageReport( &rect, text_x, text_y, color, scale, align, textStyle ); + break; //loading screen case CG_LOAD_LEVELSHOT: @@ -2560,7 +2650,7 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x, CG_DrawSnapshot( &rect, text_x, text_y, scale, color, align, textStyle ); break; case CG_LAGOMETER: - CG_DrawLagometer( &rect, shader ); + CG_DrawLagometer( &rect, text_x, text_y, scale, color ); break; case CG_CONSOLE: diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c index 44779bf6..1ed6cb2e 100644 --- a/src/cgame/cg_ents.c +++ b/src/cgame/cg_ents.c @@ -889,10 +889,12 @@ CG_CEntityPVSEnter */ static void CG_CEntityPVSEnter( centity_t *cent ) { + entityState_t *es = ¢->currentState; + if( cg_debugPVS.integer ) CG_Printf( "Entity %d entered PVS\n", cent->currentState.number ); - switch( cent->currentState.eType ) + switch( es->eType ) { case ET_MISSILE: CG_LaunchMissile( cent ); @@ -910,7 +912,8 @@ static void CG_CEntityPVSEnter( centity_t *cent ) //make sure that the buildable animations are in a consistent state //when a buildable enters the PVS - cent->buildableAnim = BANIM_NONE; + cent->buildableAnim = cent->lerpFrame.animationNumber = BANIM_NONE; + cent->oldBuildableAnim = es->legsAnim; } diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index 891e1371..80a82016 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -250,7 +250,7 @@ static void CG_Obituary( entityState_t *ent ) message2 = className; break; case MOD_LEVEL3_CLAW: - message = "was clawed by"; + message = "was chomped by"; Com_sprintf( className, 64, "'s %s", BG_FindHumanNameForClassNum( PCL_ALIEN_LEVEL3 ) ); message2 = className; diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 69c6946b..8db55818 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1301,6 +1301,10 @@ typedef struct int alienStage; int humanStage; + int alienKills; + int humanKills; + int alienNextStageThreshold; + int humanNextStageThreshold; int numAlienSpawns; int numHumanSpawns; diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 17772d30..0239c95d 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -1045,7 +1045,6 @@ void CG_StartMusic( void ) trap_S_StartBackgroundTrack( parm1, parm2 ); } -//TA: FIXME: preliminary integration of CG TA UI stuff // // ============================== // new hud stuff ( mission pack ) diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index bec94eee..a045a6ec 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -151,7 +151,8 @@ void CG_SetConfigValues( void ) &cgs.humanBuildPointsTotal, &cgs.humanBuildPointsPowered ); - sscanf( CG_ConfigString( CS_STAGES ), "%d %d", &cgs.alienStage, &cgs.humanStage ); + sscanf( CG_ConfigString( CS_STAGES ), "%d %d %d %d %d %d", &cgs.alienStage, &cgs.humanStage, + &cgs.alienKills, &cgs.humanKills, &cgs.alienNextStageThreshold, &cgs.humanNextStageThreshold ); sscanf( CG_ConfigString( CS_SPAWNS ), "%d %d", &cgs.numAlienSpawns, &cgs.numHumanSpawns ); cgs.levelStartTime = atoi( CG_ConfigString( CS_LEVEL_START_TIME ) ); @@ -279,7 +280,10 @@ static void CG_ConfigStringModified( void ) stage_t oldAlienStage = cgs.alienStage; stage_t oldHumanStage = cgs.humanStage; - sscanf( str, "%d %d", &cgs.alienStage, &cgs.humanStage ); + sscanf( str, "%d %d %d %d %d %d", + &cgs.alienStage, &cgs.humanStage, + &cgs.alienKills, &cgs.humanKills, + &cgs.alienNextStageThreshold, &cgs.humanNextStageThreshold ); if( cgs.alienStage != oldAlienStage ) CG_AnnounceAlienStageTransistion( oldAlienStage, cgs.alienStage ); |