diff options
author | Tim Angus <tim@ngus.net> | 2005-06-07 00:48:15 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2005-06-07 00:48:15 +0000 |
commit | 17e5b74251148a0c8fb9d8c6dc46977af11e4f66 (patch) | |
tree | ab105663e1c0c0a2578b8b0d3922cec0d38ecb49 /src | |
parent | 16570422bb836e39f145b3676403a9a470a832a0 (diff) |
* Human scanner blips now fade away after updates
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_scanner.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/cgame/cg_scanner.c b/src/cgame/cg_scanner.c index 16e79a51..c0686865 100644 --- a/src/cgame/cg_scanner.c +++ b/src/cgame/cg_scanner.c @@ -15,7 +15,7 @@ static entityPos_t entityPositions; -#define HUMAN_SCANNER_UPDATE_PERIOD 300 +#define HUMAN_SCANNER_UPDATE_PERIOD 700 /* ============= @@ -112,6 +112,12 @@ static void CG_DrawBlips( rectDef_t *rect, vec3_t origin, vec4_t colour ) vec3_t drawOrigin; vec3_t up = { 0, 0, 1 }; float alphaMod = 1.0f; + float timeFractionSinceRefresh = 1.0f - + ( (float)( cg.time - entityPositions.lastUpdateTime ) / + (float)HUMAN_SCANNER_UPDATE_PERIOD ); + vec4_t localColour; + + Vector4Copy( colour, localColour ); RotatePointAroundVector( drawOrigin, up, origin, -entityPositions.vangles[ 1 ] - 90 ); drawOrigin[ 0 ] /= ( 2 * HELMET_RANGE / rect->w ); @@ -121,14 +127,15 @@ static void CG_DrawBlips( rectDef_t *rect, vec3_t origin, vec4_t colour ) alphaMod = FAR_ALPHA + ( ( drawOrigin[ 1 ] + ( rect->h / 2.0f ) ) / rect->h ) * ( NEAR_ALPHA - FAR_ALPHA ); - colour[ 3 ] *= alphaMod; + localColour[ 3 ] *= alphaMod; + localColour[ 3 ] *= ( 0.5f + ( timeFractionSinceRefresh * 0.5f ) ); - if( colour[ 3 ] > 1.0f ) - colour[ 3 ] = 1.0f; - else if( colour[ 3 ] < 0.0f ) - colour[ 3 ] = 0.0f; + if( localColour[ 3 ] > 1.0f ) + localColour[ 3 ] = 1.0f; + else if( localColour[ 3 ] < 0.0f ) + localColour[ 3 ] = 0.0f; - trap_R_SetColor( colour ); + trap_R_SetColor( localColour ); if( drawOrigin[ 2 ] > 0 ) CG_DrawPic( rect->x + ( rect->w / 2 ) - ( STALKWIDTH / 2 ) - drawOrigin[ 0 ], |