summaryrefslogtreecommitdiff
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
parent1ef4e75f4ed8093e1fbbfe5e91289bc0652c99a0 (diff)
Further improve on-HUD BP display.
-rw-r--r--assets/scripts/system_ui.shader13
-rw-r--r--assets/ui/assets/alien/build_pool_bar.tgabin0 -> 9757 bytes
-rw-r--r--assets/ui/assets/human/build_pool_bar.tgabin0 -> 8222 bytes
-rw-r--r--assets/ui/assets/neutral/build_pool_bg.tgabin0 -> 13458 bytes
-rw-r--r--assets/ui/assets/neutral/stagebar.tgabin13458 -> 0 bytes
-rw-r--r--assets/ui/assets/neutral/stagebar_add.jpgbin5787 -> 0 bytes
-rw-r--r--assets/ui/menudef.h1
-rw-r--r--assets/ui/tremulous_common_hud.h15
-rw-r--r--src/cgame/cg_draw.c52
-rw-r--r--src/cgame/cg_local.h3
-rw-r--r--src/cgame/cg_main.c4
-rw-r--r--src/game/g_main.c6
12 files changed, 70 insertions, 24 deletions
diff --git a/assets/scripts/system_ui.shader b/assets/scripts/system_ui.shader
index 2f9ef9b..4650ee0 100644
--- a/assets/scripts/system_ui.shader
+++ b/assets/scripts/system_ui.shader
@@ -189,16 +189,3 @@ ui/assets/neutral/squad_v
}
}
-ui/assets/neutral/stagebar
-{
- nomipmaps
- {
- map ui/assets/neutral/stagebar.tga
- blendFunc blend
- }
- {
- map ui/assets/neutral/stagebar_add.jpg
- blendFunc add
- }
-}
-
diff --git a/assets/ui/assets/alien/build_pool_bar.tga b/assets/ui/assets/alien/build_pool_bar.tga
new file mode 100644
index 0000000..38fad1a
--- /dev/null
+++ b/assets/ui/assets/alien/build_pool_bar.tga
Binary files differ
diff --git a/assets/ui/assets/human/build_pool_bar.tga b/assets/ui/assets/human/build_pool_bar.tga
new file mode 100644
index 0000000..08b2b4d
--- /dev/null
+++ b/assets/ui/assets/human/build_pool_bar.tga
Binary files differ
diff --git a/assets/ui/assets/neutral/build_pool_bg.tga b/assets/ui/assets/neutral/build_pool_bg.tga
new file mode 100644
index 0000000..458511b
--- /dev/null
+++ b/assets/ui/assets/neutral/build_pool_bg.tga
Binary files differ
diff --git a/assets/ui/assets/neutral/stagebar.tga b/assets/ui/assets/neutral/stagebar.tga
deleted file mode 100644
index a21ec7e..0000000
--- a/assets/ui/assets/neutral/stagebar.tga
+++ /dev/null
Binary files differ
diff --git a/assets/ui/assets/neutral/stagebar_add.jpg b/assets/ui/assets/neutral/stagebar_add.jpg
deleted file mode 100644
index a8b0a33..0000000
--- a/assets/ui/assets/neutral/stagebar_add.jpg
+++ /dev/null
Binary files differ
diff --git a/assets/ui/menudef.h b/assets/ui/menudef.h
index 30ce6a2..411f987 100644
--- a/assets/ui/menudef.h
+++ b/assets/ui/menudef.h
@@ -198,6 +198,7 @@ enum
CG_STAGE_REPORT_TEXT,
CG_ALIEN_BUILD_POOL,
CG_HUMAN_BUILD_POOL,
+ CG_BUILD_POOL_BARS,
CG_ALIENS_SCORE_LABEL,
CG_HUMANS_SCORE_LABEL,
CG_DEMO_PLAYBACK,
diff --git a/assets/ui/tremulous_common_hud.h b/assets/ui/tremulous_common_hud.h
index cecd114..5c0029a 100644
--- a/assets/ui/tremulous_common_hud.h
+++ b/assets/ui/tremulous_common_hud.h
@@ -213,12 +213,23 @@ itemDef
aspectBias ALIGN_CENTER
visible 1
foreColor 1 1 1 0.5
- background "ui/assets/neutral/stagebar"
+ background "ui/assets/neutral/build_pool_bg"
decoration
}
itemDef
{
+ name "bpbars"
+ rect 160 -5 320 40
+ aspectBias ALIGN_CENTER
+ visible 1
+ foreColor 1 1 1 0.5
+ decoration
+ ownerDraw CG_BUILD_POOL_BARS
+}
+
+itemDef
+{
name "stagereport"
rect 200 11 240 25
foreColor 1 1 1 1
@@ -228,7 +239,7 @@ itemDef
visible 1
decoration
textScale .22
- textStyle ITEM_TEXTSTYLE_NORMAL
+ textStyle ITEM_TEXTSTYLE_SHADOWED
ownerdraw CG_STAGE_REPORT_TEXT
}
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" );
diff --git a/src/game/g_main.c b/src/game/g_main.c
index f41d8d3..62df632 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -1405,9 +1405,11 @@ void G_CalculateBuildPoints( void )
level.alienBuildPoints += level.alienExtraBuildPoints;
}
- trap_SetConfigstring( CS_BUILD_POOLS, va( "a\\%d\\h\\%d",
+ trap_SetConfigstring( CS_BUILD_POOLS, va( "a\\%d\\ad\\%d\\h\\%d\\hd\\%d",
g_alienBuildPoints.integer + level.alienExtraBuildPoints,
- g_humanBuildPoints.integer + level.humanExtraBuildPoints ) );
+ g_alienBuildPoints.integer,
+ g_humanBuildPoints.integer + level.humanExtraBuildPoints,
+ g_humanBuildPoints.integer ) );
//zero bp not allowed
// if( level.humanBuildPoints < 0 )