diff options
author | Tim Angus <tim@ngus.net> | 2002-09-02 15:09:32 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2002-09-02 15:09:32 +0000 |
commit | 0175a8a7fe853047c55bc78111fb2d623648ebec (patch) | |
tree | 7bb45c0f44feacfcf12df362fa76b388cebd250b /src/cgame/cg_view.c | |
parent | 4607fb22ec24a848ce111aff87cca2ee202d3e25 (diff) |
* Bug fixes to TA console
* Implemented most of WP_GROUD_POUND
Diffstat (limited to 'src/cgame/cg_view.c')
-rw-r--r-- | src/cgame/cg_view.c | 89 |
1 files changed, 87 insertions, 2 deletions
diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index ce49d68a..6c5d2ad3 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -356,7 +356,7 @@ static void CG_OffsetFirstPersonView( void ) { vec3_t predictedVelocity; int timeDelta; float bob2; - vec3_t normal; + vec3_t normal, baseOrigin; playerState_t *ps = &cg.predictedPlayerState; if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) @@ -377,6 +377,8 @@ static void CG_OffsetFirstPersonView( void ) { origin = cg.refdef.vieworg; angles = cg.refdefViewAngles; + VectorCopy( origin, baseOrigin ); + // if dead, fix the angle and don't add any kick if ( cg.snap->ps.stats[STAT_HEALTH] <= 0 ) { angles[ROLL] = 40; @@ -553,6 +555,89 @@ static void CG_OffsetFirstPersonView( void ) { } } +#define KNOCK_ROLL 70.0f +#define KNOCK_SHAKE_HEIGHT 10 +#define KNOCK_RUMBLE_TIME 60 + + if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_KNOCKEDOVER ) + { + int deltaTime; + float deltaSecs; + trace_t tr; + vec3_t mins, maxs; + float rollFraction; + + BG_FindBBoxForClass( cg.predictedPlayerState.stats[ STAT_PCLASS ], NULL, NULL, NULL, mins, maxs ); + + //bit closer to the ground + mins[ 2 ] = -1.0f; + + deltaTime = cg.time - ( cg.firstKnockedTime + (int)( (float)KOVER_TIME / 5.0f ) ); + + if( deltaTime < 0 ) + { + if( cg.time > cg.lastRumbleTime ) + { + cg.rumbleVector[ 0 ] = rand( ) % KNOCK_SHAKE_HEIGHT; + cg.rumbleVector[ 1 ] = rand( ) % KNOCK_SHAKE_HEIGHT; + cg.rumbleVector[ 2 ] = rand( ) % KNOCK_SHAKE_HEIGHT; + + cg.lastRumbleTime = cg.time + KNOCK_RUMBLE_TIME; + } + + VectorAdd( origin, cg.rumbleVector, origin ); + } + else + { + deltaSecs = deltaTime * 0.001; // milliseconds to seconds + origin[ 2 ] -= 0.5 * DEFAULT_GRAVITY * deltaSecs * deltaSecs; // FIXME: local gravity... + + CG_Trace( &tr, baseOrigin, mins, maxs, origin, cg.predictedPlayerState.clientNum, MASK_SOLID ); + VectorCopy( tr.endpos, origin ); + + rollFraction = (float)deltaTime / ( (float)KOVER_TIME / 6.0f ); + + if( rollFraction > 1.0f ) + rollFraction = 1.0f; + + angles[ ROLL ] -= rollFraction * KNOCK_ROLL; + VectorSet( cg.rumbleVector, 0.0f, 0.0f, 0.0f ); + } + } + + if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_GETTINGUP ) + { + int deltaTime; + trace_t tr; + vec3_t mins, maxs, ground, pushUp; + float rollFraction; + + BG_FindBBoxForClass( cg.predictedPlayerState.stats[ STAT_PCLASS ], NULL, NULL, NULL, mins, maxs ); + + //bit closer to the ground + mins[ 2 ] = -1.0f; + + VectorCopy( baseOrigin, ground ); + ground[ 2 ] -= 64.0f; + + CG_Trace( &tr, baseOrigin, mins, maxs, ground, cg.predictedPlayerState.clientNum, MASK_SOLID ); + VectorSubtract( baseOrigin, tr.endpos, pushUp ); + + deltaTime = cg.time - cg.firstGetUpTime; + + rollFraction = (float)deltaTime / (float)GETUP_TIME; + + if( rollFraction > 1.0f ) + rollFraction = 1.0f; + + rollFraction = 1.0f - rollFraction; + + VectorScale( pushUp, rollFraction, pushUp ); + VectorSubtract( origin, pushUp, origin ); + + angles[ ROLL ] -= rollFraction * KNOCK_ROLL; + } + //TA: this *feels* more realisitic for humans if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_HUMANS ) { @@ -1237,7 +1322,7 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demo /*CG_PowerupTimerSounds();*/ //remove expired console lines - if( cg.consoleLines[ 0 ].time + cg_consoleLatency.integer < cg.time ) + if( cg.consoleLines[ 0 ].time + cg_consoleLatency.integer < cg.time && cg_consoleLatency.integer > 0 ) CG_RemoveConsoleLine( ); // update audio positions |