summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_draw.c111
-rw-r--r--src/cgame/cg_local.h12
-rw-r--r--src/cgame/cg_main.c5
3 files changed, 124 insertions, 4 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 11bc242..8e0b88f 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -1735,13 +1735,10 @@ 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;
{
- Com_sprintf( s, MAX_TOKEN_CHARS, " %d [ye2]ALIENS |STAGE| HUMANS[Ye] %d ", cgs.alienStage + 1 , cgs.humanStage + 1);
+ Com_sprintf( s, MAX_TOKEN_CHARS, " %d << ALIENS |STAGE| HUMANS >> %d ", cgs.alienStage + 1 , cgs.humanStage + 1);
}
@@ -1784,6 +1781,88 @@ static void CG_DrawStageReport( rectDef_t *rect, float text_x, float text_y,
/*
==================
+CG_DrawBuildPoolReport
+==================
+*/
+static void CG_DrawBuildPoolReport( rectDef_t *rect, float text_x, float text_y,
+ vec4_t color, float scale, int textalign, int textvalign, int textStyle, qboolean humans )
+{
+ char out[ 20 ];
+ float tx, ty;
+
+ Com_sprintf( out, sizeof( out ), "%d", ( humans ? cgs.humanBuildPool : cgs.alienBuildPool ) );
+
+ CG_AlignText( rect, out, scale, 0.0f, 0.0f, textalign, textvalign, &tx, &ty );
+ UI_Text_Paint( text_x + tx, text_y + ty, scale, color, out, 0, 0, textStyle );
+}
+
+/*
+==================
+CG_DrawBuildPoolBars
+==================
+*/
+static void CG_DrawBuildPoolBars( rectDef_t *rect, vec4_t color )
+{
+ float abp, hbp, f;
+ float x, y, w, h;
+
+ abp = (float)cgs.alienBuildPool / (float)cgs.alienBuildPoolMax;
+ hbp = (float)cgs.humanBuildPool / (float)cgs.humanBuildPoolMax;
+
+ f = ( 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_DrawNoBPFlash
+==================
+*/
+#define NOBP_FLASH_TIME 3000
+static void CG_DrawNoBPFlash( rectDef_t *rect, vec4_t color, qboolean humans )
+{
+ vec4_t mcolor;
+ int flashTime;
+
+ Vector4Copy( color, mcolor );
+ flashTime = ( humans ? cgs.humanNoBPFlashTime : cgs.alienNoBPFlashTime );
+
+ if( flashTime == -1 )
+ return;
+
+ mcolor[ 3 ] *= 1.0f - ( (float)( cg.time - flashTime ) / NOBP_FLASH_TIME );
+
+ if( mcolor[ 3 ] <= 0 )
+ return;
+
+ trap_R_SetColor( mcolor );
+ CG_DrawPic( rect->x, rect->y, rect->w, rect->h,
+ ( humans ? cgs.media.humanNoBPFlash :
+ cgs.media.alienNoBPFlash ) );
+ trap_R_SetColor( NULL );
+}
+
+/*
+==================
CG_DrawFPS
==================
*/
@@ -3143,6 +3222,21 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x,
case CG_STAGE_REPORT_TEXT:
CG_DrawStageReport( &rect, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle );
break;
+ case CG_ALIEN_BUILD_POOL:
+ CG_DrawBuildPoolReport( &rect, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle, qfalse );
+ break;
+ 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_ALIEN_NOBP_FLASH:
+ CG_DrawNoBPFlash( &rect, foreColor, qfalse );
+ break;
+ case CG_HUMAN_NOBP_FLASH:
+ CG_DrawNoBPFlash( &rect, foreColor, qtrue );
+ break;
case CG_ALIENS_SCORE_LABEL:
CG_DrawTeamLabel( &rect, TEAM_ALIENS, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle );
break;
@@ -3765,6 +3859,15 @@ static void CG_Draw2D( void )
if( cg_draw2D.integer == 0 )
return;
+ // this has to be here, CG_ConfigStringModified isn't reliable
+ sscanf( CG_ConfigString( CS_BUILD_POOLS ), "%d %d %d %d %d %d",
+ &cgs.alienBuildPool,
+ &cgs.alienBuildPoolMax,
+ &cgs.alienNoBPFlashTime,
+ &cgs.humanBuildPool,
+ &cgs.humanBuildPoolMax,
+ &cgs.humanNoBPFlashTime );
+
if( cg.snap->ps.pm_type == PM_INTERMISSION )
{
CG_DrawIntermission( );
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 7d4bd3d..ab3e9e6 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -1341,6 +1341,11 @@ typedef struct
qhandle_t humanWoundsBleedPS;
qhandle_t alienWoundsBleedPS;
+ qhandle_t alienBuildPoolBar;
+ qhandle_t humanBuildPoolBar;
+ qhandle_t alienNoBPFlash;
+ qhandle_t humanNoBPFlash;
+
qhandle_t lightningBeam;
qhandle_t lightningImpactPS;
} cgMedia_t;
@@ -1447,6 +1452,13 @@ typedef struct
voice_t *voices;
clientList_t ignoreList;
+
+ int alienBuildPool;
+ int alienBuildPoolMax;
+ int alienNoBPFlashTime;
+ int humanBuildPool;
+ int humanBuildPoolMax;
+ int humanNoBPFlashTime;
} cgs_t;
typedef struct
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index 366a6a3..7ed3bfc 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -830,6 +830,11 @@ static void CG_RegisterGraphics( void )
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.alienNoBPFlash = trap_R_RegisterShader( "ui/assets/alien/nobp_flash.tga" );
+ cgs.media.humanNoBPFlash = trap_R_RegisterShader( "ui/assets/human/nobp_flash.tga" );
+
cgs.media.lightningBeam = trap_R_RegisterShader( "gfx/lightning/beam" );
cgs.media.disconnectPS = CG_RegisterParticleSystem( "disconnectPS" );