summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorenneract <trem.redman@gmail.com>2014-12-06 23:34:48 +0100
committerenneract <trem.redman@gmail.com>2014-12-06 23:34:48 +0100
commit58903527dbf5fc7d8035ac2349174fe5f58ba2ac (patch)
tree34548ca5936b4157b9e608f71f6e83459de9d66a
parentfd19ccb037e349286e3b72a1277c58079056fcc2 (diff)
Add total BP counters to HUD.
-rw-r--r--assets/ui/assets/bp-bg.tgabin0 -> 10989 bytes
-rw-r--r--assets/ui/menudef.h2
-rw-r--r--assets/ui/tremulous_common_hud.h92
-rw-r--r--src/cgame/cg_draw.c26
-rw-r--r--src/game/bg_public.h1
-rw-r--r--src/game/g_main.c5
6 files changed, 102 insertions, 24 deletions
diff --git a/assets/ui/assets/bp-bg.tga b/assets/ui/assets/bp-bg.tga
new file mode 100644
index 0000000..04b71bf
--- /dev/null
+++ b/assets/ui/assets/bp-bg.tga
Binary files differ
diff --git a/assets/ui/menudef.h b/assets/ui/menudef.h
index 3e7796f..30ce6a2 100644
--- a/assets/ui/menudef.h
+++ b/assets/ui/menudef.h
@@ -196,6 +196,8 @@ enum
CG_SPEEDOMETER,
CG_PLAYER_CROSSHAIRNAMES,
CG_STAGE_REPORT_TEXT,
+ CG_ALIEN_BUILD_POOL,
+ CG_HUMAN_BUILD_POOL,
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 57427b1..f3e8218 100644
--- a/assets/ui/tremulous_common_hud.h
+++ b/assets/ui/tremulous_common_hud.h
@@ -205,28 +205,72 @@ itemDef
ownerdraw CG_FOLLOW
}
- itemDef
- {
- name "stage_add"
- style WINDOW_STYLE_SHADER
- rect 253 -1 140 35
- visible 1
- background "scripts/stage_add"
- decoration
- }
-
- itemDef
- {
- name "stagereport"
- rect 200 2 240 25
- foreColor 1 1 1 1
- aspectBias ALIGN_CENTER
- textalign ALIGN_CENTER
- textvalign VALIGN_TOP
- visible 1
- decoration
- textScale .22
- textStyle ITEM_TEXTSTYLE_NORMAL
- ownerdraw CG_STAGE_REPORT_TEXT
- }
+itemDef
+{
+ name "stage_add"
+ style WINDOW_STYLE_SHADER
+ rect 343 -1 160 35
+ aspectBias ALIGN_CENTER
+ visible 1
+ background "scripts/stage_add"
+ decoration
+}
+
+itemDef
+{
+ name "stagereport"
+ rect 300 2 240 25
+ foreColor 1 1 1 1
+ aspectBias ALIGN_CENTER
+ textalign ALIGN_CENTER
+ textvalign VALIGN_TOP
+ visible 1
+ decoration
+ textScale .22
+ textStyle ITEM_TEXTSTYLE_NORMAL
+ ownerdraw CG_STAGE_REPORT_TEXT
+}
+
+itemDef
+{
+ name "bpbackground"
+ style WINDOW_STYLE_SHADER
+ rect 140 -5 160 40
+ aspectBias ALIGN_CENTER
+ visible 1
+ foreColor 1 1 1 0.5
+ background "ui/assets/bp-bg.tga"
+ decoration
+}
+
+itemDef
+{
+ name "bpalien"
+ rect 184 8.5 20 25
+ foreColor 1 0 0 1
+ aspectBias ALIGN_CENTER
+ textalign ALIGN_RIGHT
+ textvalign VALIGN_TOP
+ visible 1
+ decoration
+ textScale .4
+ textStyle ITEM_TEXTSTYLE_NORMAL
+ ownerdraw CG_ALIEN_BUILD_POOL
+}
+
+
+itemDef
+{
+ name "bphuman"
+ rect 238 8.5 20 25
+ foreColor 0 0.8 1 1
+ aspectBias ALIGN_CENTER
+ textalign ALIGN_LEFT
+ textvalign VALIGN_TOP
+ visible 1
+ decoration
+ textScale .4
+ textStyle ITEM_TEXTSTYLE_NORMAL
+ ownerdraw CG_HUMAN_BUILD_POOL
+}
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 6af1375..46f81d2 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -1789,6 +1789,26 @@ 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;
+
+ 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 );
+ UI_Text_Paint( text_x + tx, text_y + ty, scale, color, out, 0, 0, textStyle );
+}
+
+/*
+==================
CG_DrawFPS
==================
*/
@@ -3148,6 +3168,12 @@ 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_ALIENS_SCORE_LABEL:
CG_DrawTeamLabel( &rect, TEAM_ALIENS, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle );
break;
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index b7df340..ad1c917 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -77,6 +77,7 @@ enum
CS_CLIENTS_READY,
CS_ALIEN_STAGES,
CS_HUMAN_STAGES,
+ CS_BUILD_POOLS,
CS_MODELS,
CS_SOUNDS = CS_MODELS + MAX_MODELS,
CS_SHADERS = CS_SOUNDS + MAX_SOUNDS,
diff --git a/src/game/g_main.c b/src/game/g_main.c
index 7011827..f4ab0b0 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -1395,6 +1395,11 @@ void G_CalculateBuildPoints( void )
level.humanBuildPoints += level.humanExtraBuildPoints;
level.alienBuildPoints += level.alienExtraBuildPoints;
}
+
+ trap_SetConfigstring( CS_BUILD_POOLS, va( "a\\%d\\h\\%d",
+ g_alienBuildPoints.integer + level.alienExtraBuildPoints,
+ g_humanBuildPoints.integer + level.humanExtraBuildPoints ) );
+
//zero bp not allowed
// if( level.humanBuildPoints < 0 )
// level.humanBuildPoints = 0;