summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
authorenneract <trem.redman@gmail.com>2014-12-07 20:53:38 +0100
committerenneract <trem.redman@gmail.com>2014-12-07 20:53:38 +0100
commit9d1b014b113ae04fe2d15ea12bf2e21b74f7df60 (patch)
tree718d72697a0e3cf3c897663a341ca1f79380194f /src/cgame
parent1ef4e75f4ed8093e1fbbfe5e91289bc0652c99a0 (diff)
Further improve on-HUD BP display.
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_draw.c52
-rw-r--r--src/cgame/cg_local.h3
-rw-r--r--src/cgame/cg_main.c4
3 files changed, 52 insertions, 7 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 1001a30..a8331b1 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -1735,9 +1735,6 @@ static void CG_DrawStageReport( rectDef_t *rect, float text_x, float text_y,
char s[ MAX_TOKEN_CHARS ];
float tx, ty;
- if( cg.intermissionStarted )
- return;
-
if( cg.snap->ps.stats[ STAT_TEAM ] == TEAM_NONE )
// return;
{
@@ -1793,9 +1790,6 @@ static void CG_DrawBuildPoolReport( rectDef_t *rect, float text_x, float text_y,
char out[ 20 ];
float tx, ty;
- if( cg.intermissionStarted )
- return;
-
Com_sprintf( out, sizeof( out ), "%s", Info_ValueForKey( CG_ConfigString( CS_BUILD_POOLS ), ( humans ? "h" : "a" ) ) );
CG_AlignText( rect, out, scale, 0.0f, 0.0f, textalign, textvalign, &tx, &ty );
@@ -1804,6 +1798,49 @@ static void CG_DrawBuildPoolReport( rectDef_t *rect, float text_x, float text_y,
/*
==================
+CG_DrawBuildPoolBars
+==================
+*/
+static void CG_DrawBuildPoolBars( rectDef_t *rect, vec4_t color )
+{
+ const char *cs;
+ float abp, hbp, f;
+ float x, y, w, h;
+
+ cs = CG_ConfigString( CS_BUILD_POOLS );
+
+ abp = atof( Info_ValueForKey( cs, "a" ) ) / atof( Info_ValueForKey( cs, "ad" ) );
+ hbp = atof( Info_ValueForKey( cs, "h" ) ) / atof( Info_ValueForKey( cs, "hd" ) );
+
+ if( fabs( abp + hbp ) < 1e-3 )
+ f = 0.5f;
+ else
+ f = ( ( abp - hbp ) / ( abp + hbp ) + 1.0f ) / 2.0f;
+
+ f = ( f < 0.0f ) ? 0.0f : ( f > 1.0f ) ? 1.0f : f;
+ f = f * 0.55f + 0.225f;
+
+ trap_R_SetColor( color );
+
+ x = rect->x;
+ y = rect->y;
+ w = rect->w * f;
+ h = rect->h;
+ CG_AdjustFrom640( &x, &y, &w, &h );
+ trap_R_DrawStretchPic( x, y, w, h, 0, 0, f, 1, cgs.media.alienBuildPoolBar );
+
+ x = rect->x + rect->w * f;
+ y = rect->y;
+ w = rect->w * ( 1.0f - f );
+ h = rect->h;
+ CG_AdjustFrom640( &x, &y, &w, &h );
+ trap_R_DrawStretchPic( x, y, w, h, f, 0, 1, 1, cgs.media.humanBuildPoolBar );
+
+ trap_R_SetColor( NULL );
+}
+
+/*
+==================
CG_DrawFPS
==================
*/
@@ -3169,6 +3206,9 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x,
case CG_HUMAN_BUILD_POOL:
CG_DrawBuildPoolReport( &rect, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle, qtrue );
break;
+ case CG_BUILD_POOL_BARS:
+ CG_DrawBuildPoolBars( &rect, foreColor );
+ break;
case CG_ALIENS_SCORE_LABEL:
CG_DrawTeamLabel( &rect, TEAM_ALIENS, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle );
break;
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index a477336..097da54 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -1336,6 +1336,9 @@ typedef struct
qhandle_t headShotPS;
qhandle_t humanWoundsBleedPS;
qhandle_t alienWoundsBleedPS;
+
+ qhandle_t alienBuildPoolBar;
+ qhandle_t humanBuildPoolBar;
} cgMedia_t;
typedef struct
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index b7885ec..8f3ceb7 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -821,7 +821,9 @@ static void CG_RegisterGraphics( void )
cgs.media.healthCrossPoisoned = trap_R_RegisterShader( "ui/assets/neutral/cross_poison.tga" );
cgs.media.upgradeClassIconShader = trap_R_RegisterShader( "icons/icona_upgrade.tga" );
-
+
+ cgs.media.alienBuildPoolBar = trap_R_RegisterShader( "ui/assets/alien/build_pool_bar.tga" );
+ cgs.media.humanBuildPoolBar = trap_R_RegisterShader( "ui/assets/human/build_pool_bar.tga" );
cgs.media.disconnectPS = CG_RegisterParticleSystem( "disconnectPS" );