summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/ui/menudef.h1
-rw-r--r--assets/ui/tremulous_alien_common_hud.h13
-rw-r--r--src/cgame/cg_draw.c23
3 files changed, 37 insertions, 0 deletions
diff --git a/assets/ui/menudef.h b/assets/ui/menudef.h
index fd1f1e5f..116bc590 100644
--- a/assets/ui/menudef.h
+++ b/assets/ui/menudef.h
@@ -178,5 +178,6 @@
#define CG_PLAYER_CHARGE_BAR 77
#define CG_PLAYER_CROSSHAIR 78
#define CG_PLAYER_LOCATION 79
+#define CG_PLAYER_CREDITS_FRACTION 80
#endif
diff --git a/assets/ui/tremulous_alien_common_hud.h b/assets/ui/tremulous_alien_common_hud.h
index 5b731faa..9860e73b 100644
--- a/assets/ui/tremulous_alien_common_hud.h
+++ b/assets/ui/tremulous_alien_common_hud.h
@@ -189,6 +189,19 @@ itemDef
ownerdraw CG_PLAYER_CREDITS_VALUE_NOPAD
}
+//CREDITS FRACTION
+itemDef
+{
+ name "credits-background"
+ rect 567 410 25 25
+ aspectBias ALIGN_RIGHT
+ visible MENU_TRUE
+ decoration
+ forecolor 0.375 0 0 0.375
+ background "ui/assets/neutral/circle.tga"
+ ownerdraw CG_PLAYER_CREDITS_FRACTION
+}
+
//ALIENSENSE
itemDef
{
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 57e6f25f..e30eed48 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -340,6 +340,26 @@ static void CG_DrawPlayerCreditsValue( rectDef_t *rect, vec4_t color, qboolean p
}
}
+static void CG_DrawPlayerCreditsFraction( rectDef_t *rect, vec4_t color, qhandle_t shader )
+{
+ float fraction;
+ float height;
+
+ if( cg.predictedPlayerState.stats[ STAT_TEAM ] != TEAM_ALIENS )
+ return;
+
+ fraction = ((float)(cg.predictedPlayerState.persistant[ PERS_CREDIT ] %
+ ALIEN_CREDITS_PER_KILL)) / ALIEN_CREDITS_PER_KILL;
+
+ CG_AdjustFrom640( &rect->x, &rect->y, &rect->w, &rect->h );
+ height = rect->h * fraction;
+
+ trap_R_SetColor( color );
+ trap_R_DrawStretchPic( rect->x, rect->y - height + rect->h, rect->w,
+ height, 0.0f, 1.0f - fraction, 1.0f, 1.0f, shader );
+ trap_R_SetColor( NULL );
+}
+
/*
==============
@@ -2282,6 +2302,9 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x,
case CG_PLAYER_CREDITS_VALUE:
CG_DrawPlayerCreditsValue( &rect, foreColor, qtrue );
break;
+ case CG_PLAYER_CREDITS_FRACTION:
+ CG_DrawPlayerCreditsFraction( &rect, foreColor, shader );
+ break;
case CG_PLAYER_CREDITS_VALUE_NOPAD:
CG_DrawPlayerCreditsValue( &rect, foreColor, qfalse );
break;