From 55e3be2877a148bceab1af75009686d100d1c90a Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Thu, 29 Mar 2001 03:08:41 +0000 Subject: Fixed a couple of power bugs. Implemented a client side power meter. --- src/cgame/cg_draw.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/cgame/cg_draw.c') diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 534aa705..02e77449 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -532,6 +532,38 @@ static void CG_DrawStatusBar( void ) { } } + // + // power + // + #define PWR_HEIGHT 10 + #define PWR_WIDTH 80 + #define PWR_X 555 + #define PWR_Y 20 + if( ps->stats[ STAT_PTEAM ] == PTE_HUMANS ) + { + int total = cgs.hBuildPointsTotal; + int allocated = total - cgs.hBuildPoints; + int powered = total - cgs.hBuildPointsPowered; + + int awidth = (int)( (float)allocated / ( total / PWR_WIDTH ) ); + int pwidth = (int)( (float)powered / ( total / PWR_WIDTH ) ); + vec4_t bcolor = { 0.5, 0.5, 0.5, 0.5 }; + + //Com_Printf( "%d %d %d\n", allocated, powered, total ); + + trap_R_SetColor( bcolor ); // white + CG_DrawPic( PWR_X, PWR_Y, PWR_WIDTH, PWR_HEIGHT, cgs.media.whiteShader ); + + trap_R_SetColor( colors[0] ); // green + CG_DrawPic( PWR_X, PWR_Y, awidth, PWR_HEIGHT, cgs.media.whiteShader ); + + if( allocated > powered ) + { + trap_R_SetColor( colors[1] ); // red + CG_DrawPic( PWR_X + pwidth, PWR_Y, awidth - pwidth, PWR_HEIGHT, cgs.media.whiteShader ); + } + } + // // health+armor // -- cgit