summaryrefslogtreecommitdiff
path: root/src/cgame/cg_draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgame/cg_draw.c')
-rw-r--r--src/cgame/cg_draw.c98
1 files changed, 79 insertions, 19 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 266d03e9..d321d34e 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -537,9 +537,16 @@ static void CG_DrawPlayerCreditsValue( rectDef_t *rect, vec4_t color, qboolean p
{
int value;
playerState_t *ps;
+ centity_t *cent;
+ cent = &cg_entities[ cg.snap->ps.clientNum ];
ps = &cg.snap->ps;
+ //if the build timer pie is showing don't show this
+ if( ( cent->currentState.weapon == WP_ABUILD ||
+ cent->currentState.weapon == WP_ABUILD2 ) && ps->stats[ STAT_MISC ] )
+ return;
+
value = ps->persistant[ PERS_CREDIT ];
if( value > -1 )
{
@@ -1011,9 +1018,10 @@ static void CG_DrawUsableBuildable( rectDef_t *rect, qhandle_t shader, vec4_t co
#define BUILD_DELAY_TIME 2000
-static void CG_DrawPlayerClipsValue( rectDef_t *rect, vec4_t color )
+static void CG_DrawPlayerBuildTimer( rectDef_t *rect, vec4_t color )
{
- int value;
+ float progress;
+ int index;
centity_t *cent;
playerState_t *ps;
@@ -1025,33 +1033,82 @@ static void CG_DrawPlayerClipsValue( rectDef_t *rect, vec4_t color )
switch( cent->currentState.weapon )
{
case WP_ABUILD:
+ progress = (float)ps->stats[ STAT_MISC ] / (float)ABUILDER_BASE_DELAY;
+ break;
+
case WP_ABUILD2:
+ progress = (float)ps->stats[ STAT_MISC ] / (float)ABUILDER_ADV_DELAY;
+ break;
+
case WP_HBUILD:
+ progress = (float)ps->stats[ STAT_MISC ] / (float)HBUILD_DELAY;
+ break;
+
case WP_HBUILD2:
- //remaining build delay
- value = (int)( ceil( (float)ps->stats[ STAT_MISC ] / 1000.0f ) );
-
- if( cg.time - cg.lastBuildAttempt <= BUILD_DELAY_TIME )
- {
- if( ( cg.time / 300 ) % 2 )
- {
- color[ 0 ] = 1.0f;
- color[ 1 ] = color[ 2 ] = 0.0f;
- color[ 3 ] = 1.0f;
- }
- }
+ progress = (float)ps->stats[ STAT_MISC ] / (float)HBUILD2_DELAY;
break;
default:
- BG_unpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, NULL, &value, NULL );
+ return;
break;
}
+
+ if( !ps->stats[ STAT_MISC ] )
+ return;
- if( value > -1 )
+ index = (int)( progress * 8.0f );
+
+ if( index > 7 )
+ index = 7;
+ else if( index < 0 )
+ index = 0;
+
+ if( cg.time - cg.lastBuildAttempt <= BUILD_DELAY_TIME )
{
- trap_R_SetColor( color );
- CG_DrawField( rect->x, rect->y, 4, rect->w / 4, rect->h, value );
- trap_R_SetColor( NULL );
+ if( ( cg.time / 300 ) % 2 )
+ {
+ color[ 0 ] = 1.0f;
+ color[ 1 ] = color[ 2 ] = 0.0f;
+ color[ 3 ] = 1.0f;
+ }
+ }
+
+ trap_R_SetColor( color );
+ CG_DrawPic( rect->x, rect->y, rect->w, rect->h,
+ cgs.media.buildWeaponTimerPie[ index ] );
+ trap_R_SetColor( NULL );
+ }
+}
+
+static void CG_DrawPlayerClipsValue( rectDef_t *rect, vec4_t color )
+{
+ int value;
+ centity_t *cent;
+ playerState_t *ps;
+
+ cent = &cg_entities[ cg.snap->ps.clientNum ];
+ ps = &cg.snap->ps;
+
+ if( cent->currentState.weapon )
+ {
+ switch( cent->currentState.weapon )
+ {
+ case WP_ABUILD:
+ case WP_ABUILD2:
+ case WP_HBUILD:
+ case WP_HBUILD2:
+ break;
+
+ default:
+ BG_unpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, NULL, &value, NULL );
+
+ if( value > -1 )
+ {
+ trap_R_SetColor( color );
+ CG_DrawField( rect->x, rect->y, 4, rect->w / 4, rect->h, value );
+ trap_R_SetColor( NULL );
+ }
+ break;
}
}
}
@@ -2335,6 +2392,9 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x,
case CG_PLAYER_CLIPS_VALUE:
CG_DrawPlayerClipsValue( &rect, color );
break;
+ case CG_PLAYER_BUILD_TIMER:
+ CG_DrawPlayerBuildTimer( &rect, color );
+ break;
case CG_PLAYER_HEALTH:
CG_DrawPlayerHealthValue( &rect, color );
break;