summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
authorBen Millwood <thebenmachine@gmail.com>2009-10-03 12:17:37 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:15:49 +0000
commit0244441adde816d896eb05034b48202bc19e19dd (patch)
tree1e328564112a1d172523ca835c3c88268fd777c5 /src/cgame
parent7992017f0570eb540fdc886e5d389f3121b7feae (diff)
* Don't play EV_FALL_FAR sound if dead
* Merging some fixes from mgdev, courtesy of Michael "Risujin" Levin: - Ensure SnapVector always snaps downwards, rather than always towards 0 - Don't send score information that won't be displayed - /give poison as a human poisons rather than boosting * Remove some trailing whitespace * Remove some useless intermediate variables in cg_draw.c * Ammo/clips/build timer display depends on primary weapon rather than equipped - (this also fixes bug 3837)
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_draw.c75
1 files changed, 30 insertions, 45 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 13412eef..f97bf9b6 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -674,42 +674,36 @@ static void CG_DrawPlayerWallclimbing( rectDef_t *rect, vec4_t color, qhandle_t
static void CG_DrawPlayerAmmoValue( rectDef_t *rect, vec4_t color )
{
- int value;
- centity_t *cent;
- playerState_t *ps;
- weapon_t weapon;
-
- cent = &cg_entities[ cg.snap->ps.clientNum ];
- ps = &cg.snap->ps;
- weapon = BG_GetPlayerWeapon( ps );
+ int value;
- if( weapon )
+ switch( BG_PrimaryWeapon( cg.snap->ps.stats ) )
{
- switch( weapon )
- {
- case WP_ABUILD:
- case WP_ABUILD2:
- value = cgs.alienBuildPoints;
- break;
+ case WP_NONE:
+ case WP_BLASTER:
+ return;
- case WP_HBUILD:
- value = cgs.humanBuildPoints;
- break;
+ case WP_ABUILD:
+ case WP_ABUILD2:
+ value = cgs.alienBuildPoints;
+ break;
- default:
- value = ps->ammo;
- break;
- }
+ case WP_HBUILD:
+ value = cgs.humanBuildPoints;
+ break;
+
+ default:
+ value = cg.snap->ps.ammo;
+ break;
+ }
- if( value > 999 )
- value = 999;
+ if( value > 999 )
+ value = 999;
- if( value > -1 )
- {
- trap_R_SetColor( color );
- CG_DrawField( rect->x, rect->y, 4, rect->w / 4, rect->h, value );
- trap_R_SetColor( NULL );
- }
+ if( value > -1 )
+ {
+ trap_R_SetColor( color );
+ CG_DrawField( rect->x, rect->y, 4, rect->w / 4, rect->h, value );
+ trap_R_SetColor( NULL );
}
}
@@ -777,13 +771,11 @@ static void CG_DrawUsableBuildable( rectDef_t *rect, qhandle_t shader, vec4_t co
static void CG_DrawPlayerBuildTimer( rectDef_t *rect, vec4_t color )
{
int index;
- centity_t *cent;
playerState_t *ps;
weapon_t weapon;
- cent = &cg_entities[ cg.snap->ps.clientNum ];
ps = &cg.snap->ps;
- weapon = BG_GetPlayerWeapon( ps );
+ weapon = BG_PrimaryWeapon( ps->stats );
if( ( weapon != WP_ABUILD && weapon != WP_ABUILD2 && weapon != WP_HBUILD ) ||
ps->stats[ STAT_MISC ] <= 0 )
@@ -812,20 +804,19 @@ static void CG_DrawPlayerBuildTimer( rectDef_t *rect, vec4_t color )
static void CG_DrawPlayerClipsValue( rectDef_t *rect, vec4_t color )
{
int value;
- centity_t *cent;
playerState_t *ps;
weapon_t weapon;
- cent = &cg_entities[ cg.snap->ps.clientNum ];
ps = &cg.snap->ps;
- weapon = BG_GetPlayerWeapon( ps );
+ weapon = BG_PrimaryWeapon( ps->stats );
switch( weapon )
{
+ case WP_NONE:
+ case WP_BLASTER:
case WP_ABUILD:
case WP_ABUILD2:
case WP_HBUILD:
- case 0:
break;
default:
@@ -843,15 +834,9 @@ static void CG_DrawPlayerClipsValue( rectDef_t *rect, vec4_t color )
static void CG_DrawPlayerHealthValue( rectDef_t *rect, vec4_t color )
{
- playerState_t *ps;
- int value;
-
- ps = &cg.snap->ps;
-
- value = ps->stats[ STAT_HEALTH ];
-
trap_R_SetColor( color );
- CG_DrawField( rect->x, rect->y, 4, rect->w / 4, rect->h, value );
+ CG_DrawField( rect->x, rect->y, 4, rect->w / 4, rect->h,
+ cg.snap->ps.stats[ STAT_HEALTH ] );
trap_R_SetColor( NULL );
}