diff options
author | Tim Angus <tim@ngus.net> | 2002-12-02 01:24:52 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2002-12-02 01:24:52 +0000 |
commit | 99f454e46275215412247564878896806a772ed0 (patch) | |
tree | 864b59c72c1cbead3712640bcc08876fda272002 /src/cgame | |
parent | 571cc865a2b4a07c7667bd8a49ffe62ac72fc193 (diff) |
* Amendments to the hud drawing stuff
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_draw.c | 29 | ||||
-rw-r--r-- | src/cgame/cg_weapons.c | 33 |
2 files changed, 30 insertions, 32 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index e95a60cf..156bfd43 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -544,7 +544,7 @@ static void CG_DrawPlayerCreditsValue( rectDef_t *rect, vec4_t color ) if( value > -1 ) { trap_R_SetColor( color ); - CG_DrawField( rect->x, rect->y, 4, rect->w / 4, rect->h, value ); + CG_DrawFieldPadded( rect->x, rect->y, 4, rect->w / 4, rect->h, value ); trap_R_SetColor( NULL ); } } @@ -560,11 +560,15 @@ static void CG_DrawPlayerBankValue( rectDef_t *rect, vec4_t color ) if( value > -1 ) { trap_R_SetColor( color ); - CG_DrawField( rect->x, rect->y, 4, rect->w / 4, rect->h, value ); + CG_DrawFieldPadded( rect->x, rect->y, 4, rect->w / 4, rect->h, value ); trap_R_SetColor( NULL ); } } +#define HH_MIN_ALPHA 0.2f +#define HH_MAX_ALPHA 0.8f +#define HH_ALPHA_DIFF (HH_MAX_ALPHA-HH_MIN_ALPHA) + /* ============== CG_DrawPlayerStamina1 @@ -585,7 +589,7 @@ static void CG_DrawPlayerStamina1( rectDef_t *rect, vec4_t color, qhandle_t shad else if( progress < 0.0f ) progress = 0.0f; - color[ 3 ] = 0.25f + ( progress * 0.25f ); + color[ 3 ] = HH_MIN_ALPHA + ( progress * HH_ALPHA_DIFF ); trap_R_SetColor( color ); CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader ); @@ -612,7 +616,7 @@ static void CG_DrawPlayerStamina2( rectDef_t *rect, vec4_t color, qhandle_t shad else if( progress < 0.0f ) progress = 0.0f; - color[ 3 ] = 0.25f + ( progress * 0.25f ); + color[ 3 ] = HH_MIN_ALPHA + ( progress * HH_ALPHA_DIFF ); trap_R_SetColor( color ); CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader ); @@ -638,7 +642,7 @@ static void CG_DrawPlayerStamina3( rectDef_t *rect, vec4_t color, qhandle_t shad else if( progress < 0.0f ) progress = 0.0f; - color[ 3 ] = 0.25f + ( progress * 0.25f ); + color[ 3 ] = HH_MIN_ALPHA + ( progress * HH_ALPHA_DIFF ); trap_R_SetColor( color ); CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader ); @@ -664,7 +668,7 @@ static void CG_DrawPlayerStamina4( rectDef_t *rect, vec4_t color, qhandle_t shad else if( progress < 0.0f ) progress = 0.0f; - color[ 3 ] = 0.25f + ( progress * 0.25f ); + color[ 3 ] = HH_MIN_ALPHA + ( progress * HH_ALPHA_DIFF ); trap_R_SetColor( color ); CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader ); @@ -682,9 +686,9 @@ static void CG_DrawPlayerStaminaBolt( rectDef_t *rect, vec4_t color, qhandle_t s float stamina = ps->stats[ STAT_STAMINA ]; if( stamina < 0 ) - color[ 3 ] = 0.25f; + color[ 3 ] = HH_MIN_ALPHA; else - color[ 3 ] = 0.50f; + color[ 3 ] = HH_MAX_ALPHA; trap_R_SetColor( color ); CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader ); @@ -715,10 +719,17 @@ static void CG_DrawPlayerClipsRing( rectDef_t *rect, vec4_t color, qhandle_t sha maxDelay = (float)BG_FindBuildDelayForWeapon( cent->currentState.weapon ); progress = ( maxDelay - buildTime ) / maxDelay; - color[ 3 ] = 0.25f + ( progress * 0.25f ); + color[ 3 ] = HH_MIN_ALPHA + ( progress * HH_ALPHA_DIFF ); break; default: + if( ps->weaponstate == WEAPON_RELOADING ) + { + maxDelay = (float)BG_FindReloadTimeForWeapon( cent->currentState.weapon ); + progress = ( maxDelay - (float)ps->weaponTime ) / maxDelay; + + color[ 3 ] = HH_MIN_ALPHA + ( progress * HH_ALPHA_DIFF ); + } break; } diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index 4c203b4c..2703dc00 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -1149,36 +1149,23 @@ void CG_DrawWeaponSelect( rectDef_t *rect, vec4_t color ) if( ( item >= 0 ) && ( item < numItems ) ) { - switch( cent->currentState.weapon ) + if( clips == 0 && !BG_FindInfinteAmmoForWeapon( cent->currentState.weapon ) ) { - case WP_ABUILD: - case WP_ABUILD2: - case WP_HBUILD: - case WP_HBUILD2: - break; - - default: - if( clips == 0 ) - { - float ammoPercent = (float)ammo / (float)maxAmmo; - - if( ammoPercent < 0.33f ) - { - color[ 0 ] = 1.0f; - color[ 1 ] = color[ 2 ] = 0.0f; - } - } - break; + float ammoPercent = (float)ammo / (float)maxAmmo; + + if( ammoPercent < 0.33f ) + { + color[ 0 ] = 1.0f; + color[ 1 ] = color[ 2 ] = 0.0f; + } } trap_R_SetColor( color ); if( items[ item ] <= 32 ) - CG_DrawPic( x + ICON_BORDER, y + ICON_BORDER, iconsize - 2 * ICON_BORDER, iconsize - 2 * ICON_BORDER, - cg_weapons[ items[ item ] ].weaponIcon ); + CG_DrawPic( x, y, iconsize, iconsize, cg_weapons[ items[ item ] ].weaponIcon ); else if( items[ item ] > 32 ) - CG_DrawPic( x + ICON_BORDER, y + ICON_BORDER, iconsize - 2 * ICON_BORDER, iconsize - 2 * ICON_BORDER, - cg_upgrades[ items[ item ] - 32 ].upgradeIcon ); + CG_DrawPic( x, y, iconsize, iconsize, cg_upgrades[ items[ item ] - 32 ].upgradeIcon ); trap_R_SetColor( NULL ); |