diff options
author | Tim Angus <tim@ngus.net> | 2001-03-29 03:08:41 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2001-03-29 03:08:41 +0000 |
commit | 55e3be2877a148bceab1af75009686d100d1c90a (patch) | |
tree | 84f9a4c90267e29f09437ab44ca5bf953b78f404 /src/cgame/cg_draw.c | |
parent | cfbc2d72a7878cbbdc7980603878213d64873202 (diff) |
Fixed a couple of power bugs. Implemented a client side power meter.
Diffstat (limited to 'src/cgame/cg_draw.c')
-rw-r--r-- | src/cgame/cg_draw.c | 32 |
1 files changed, 32 insertions, 0 deletions
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 @@ -533,6 +533,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 // if( ps->stats[ STAT_PTEAM ] == PTE_DROIDS ) |