summaryrefslogtreecommitdiff
path: root/src/cgame/cg_draw.c
diff options
context:
space:
mode:
authorChristopher Schwarz <lakitu7@gmail.com>2009-10-24 07:46:20 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:17:03 +0000
commit6717b6d4f7882081012550719dd4373650fdd033 (patch)
tree25c36abd50a03055e084850db384a976c7384f1b /src/cgame/cg_draw.c
parent3c596928698f25af8e0fe45403a5770eac3866d1 (diff)
* Stamina changes/fixes (kevlarman)
- Restore blacking out when you run out of stamina - Add cg_sprintToggle, allowing the sprint button to act as a toggle between always-sprinting or not - Walk overrides sprint, by popular demand - Modify the stamina "bolt" to better differentiate between states - Allow one to begin a sprint when stamina is negative (even though it is generally a bad idea for them, at least their button presses do something!) * When avilable, use predictedplayerstate for cg_drawSpeed to reduce latency (kevlarman)
Diffstat (limited to 'src/cgame/cg_draw.c')
-rw-r--r--src/cgame/cg_draw.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index da5d9101..6cc78738 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -423,13 +423,22 @@ static void CG_DrawPlayerStaminaBolt( rectDef_t *rect, vec4_t backColor,
float stamina = cg.snap->ps.stats[ STAT_STAMINA ];
vec4_t color;
- if( stamina < 0 )
- Vector4Copy( backColor, color );
- else if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_SPEEDBOOST )
- Vector4Lerp( ( sin( cg.time / 150.0f ) + 1 ) / 2,
- backColor, foreColor, color );
+ if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_SPEEDBOOST )
+ {
+ if( stamina >= 0 )
+ Vector4Lerp( ( sin( cg.time / 150.0f ) + 1 ) / 2,
+ backColor, foreColor, color );
+ else
+ Vector4Lerp( ( sin( cg.time / 2000.0f ) + 1 ) / 2,
+ backColor, foreColor, color );
+ }
else
- Vector4Copy( foreColor, color );
+ {
+ if( stamina < 0 )
+ Vector4Copy( backColor, color );
+ else
+ Vector4Copy( foreColor, color );
+ }
trap_R_SetColor( color );
CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader );
@@ -2220,8 +2229,15 @@ static void CG_DrawSpeedText( rectDef_t *rect, float text_x, float text_y,
VectorCopy( foreColor, color );
color[ 3 ] = 1;
-
- if( oldestSpeedSample == 0 )
+ if( cg.predictedPlayerState.clientNum == cg.clientNum )
+ {
+ vec3_t vel;
+ VectorCopy( cg.predictedPlayerState.velocity, vel );
+ if( cg_drawSpeed.integer & SPEEDOMETER_IGNORE_Z )
+ vel[ 2 ] = 0;
+ val = VectorLength( vel );
+ }
+ else if( oldestSpeedSample == 0 )
val = speedSamples[ SPEEDOMETER_NUM_SAMPLES - 1 ];
else
val = speedSamples[ oldestSpeedSample - 1 ];