diff options
Diffstat (limited to 'src/cgame/cg_event.c')
-rw-r--r-- | src/cgame/cg_event.c | 79 |
1 files changed, 47 insertions, 32 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index 1da5612c..06cd169e 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -581,41 +581,56 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) } break; - case EV_STEP_4: - case EV_STEP_8: - case EV_STEP_12: - case EV_STEP_16: // smooth out step up transitions - DEBUGNAME("EV_STEP"); - { - float oldStep; - int delta; - int step; + case EV_STEP_4: + case EV_STEP_8: + case EV_STEP_12: + case EV_STEP_16: // smooth out step up transitions + case EV_STEPDN_4: + case EV_STEPDN_8: + case EV_STEPDN_12: + case EV_STEPDN_16: // smooth out step up transitions + DEBUGNAME("EV_STEP"); + { + float oldStep; + int delta; + int step; + + if( clientNum != cg.predictedPlayerState.clientNum ) + break; + + // if we are interpolating, we don't need to smooth steps + if( cg.demoPlayback || ( cg.snap->ps.pm_flags & PMF_FOLLOW ) || + cg_nopredict.integer || cg_synchronousClients.integer ) + break; + + // check for stepping up before a previous step is completed + delta = cg.time - cg.stepTime; + + if( delta < STEP_TIME ) + oldStep = cg.stepChange * ( STEP_TIME - delta ) / STEP_TIME; + else + oldStep = 0; - if ( clientNum != cg.predictedPlayerState.clientNum ) { - break; - } - // if we are interpolating, we don't need to smooth steps - if ( cg.demoPlayback || (cg.snap->ps.pm_flags & PMF_FOLLOW) || - cg_nopredict.integer || cg_synchronousClients.integer ) { - break; - } - // check for stepping up before a previous step is completed - delta = cg.time - cg.stepTime; - if (delta < steptime) { - oldStep = cg.stepChange * (steptime - delta) / steptime; - } else { - oldStep = 0; + // add this amount + if( event >= EV_STEPDN_4 ) + { + step = 4 * ( event - EV_STEPDN_4 + 1 ); + cg.stepChange = oldStep - step; } - - // add this amount - step = 4 * (event - EV_STEP_4 + 1 ); - cg.stepChange = oldStep + step; - if ( cg.stepChange > MAX_STEP_CHANGE ) { - cg.stepChange = MAX_STEP_CHANGE; + else + { + step = 4 * ( event - EV_STEP_4 + 1 ); + cg.stepChange = oldStep + step; } - cg.stepTime = cg.time; - break; - } + + if( cg.stepChange > MAX_STEP_CHANGE ) + cg.stepChange = MAX_STEP_CHANGE; + else if( cg.stepChange < -MAX_STEP_CHANGE ) + cg.stepChange = -MAX_STEP_CHANGE; + + cg.stepTime = cg.time; + break; + } case EV_JUMP_PAD: DEBUGNAME("EV_JUMP_PAD"); |