# HG changeset patch # User geNia # Date 1599143284 14400 # Thu Sep 03 10:28:04 2020 -0400 # Node ID fcb5f59ae8910fbde2ef473cf33b7ea104b43395 # Parent 65d87770dedb323a3be9158f6f401fb575afb972 Fixed jitter caused by prediction when changing actor speed diff -r 65d87770dedb -r fcb5f59ae891 src/cl_pred.cpp --- a/src/cl_pred.cpp Sun May 24 18:00:37 2020 +0200 +++ b/src/cl_pred.cpp Thu Sep 03 10:28:04 2020 -0400 @@ -87,6 +87,7 @@ static ticcmd_t g_SavedTiccmd[CLIENT_PREDICTION_TICS]; static angle_t g_SavedAngle[CLIENT_PREDICTION_TICS]; static fixed_t g_SavedPitch[CLIENT_PREDICTION_TICS]; +static fixed_t g_SavedSpeed[CLIENT_PREDICTION_TICS]; static fixed_t g_SavedCrouchfactor[CLIENT_PREDICTION_TICS]; static BYTE g_SavedTurnTicks[CLIENT_PREDICTION_TICS]; static LONG g_lSavedReactionTime[CLIENT_PREDICTION_TICS]; @@ -374,6 +375,7 @@ { g_SavedAngle[g_ulGameTick % CLIENT_PREDICTION_TICS] = pPlayer->mo->angle; g_SavedPitch[g_ulGameTick % CLIENT_PREDICTION_TICS] = pPlayer->mo->pitch; + g_SavedSpeed[g_ulGameTick % CLIENT_PREDICTION_TICS] = pPlayer->mo->Speed; g_SavedCrouchfactor[g_ulGameTick % CLIENT_PREDICTION_TICS] = pPlayer->crouchfactor; g_SavedTurnTicks[g_ulGameTick % CLIENT_PREDICTION_TICS] = pPlayer->turnticks; g_lSavedReactionTime[g_ulGameTick % CLIENT_PREDICTION_TICS] = pPlayer->mo->reactiontime; @@ -420,6 +422,7 @@ // Use backed up values for prediction. pPlayer->mo->angle = g_SavedAngle[lTick % CLIENT_PREDICTION_TICS]; pPlayer->mo->pitch = g_SavedPitch[lTick % CLIENT_PREDICTION_TICS]; + pPlayer->mo->Speed = g_SavedSpeed[lTick % CLIENT_PREDICTION_TICS]; // [BB] Crouch prediction seems to be very tricky. While predicting, we don't recalculate // crouchfactor, but just use the value we already calculated before. pPlayer->crouchfactor = g_SavedCrouchfactor[( lTick + 1 )% CLIENT_PREDICTION_TICS]; @@ -456,6 +459,7 @@ { pPlayer->mo->angle = g_SavedAngle[g_ulGameTick % CLIENT_PREDICTION_TICS]; pPlayer->mo->pitch = g_SavedPitch[g_ulGameTick % CLIENT_PREDICTION_TICS]; + pPlayer->mo->Speed = g_SavedSpeed[g_ulGameTick % CLIENT_PREDICTION_TICS]; pPlayer->crouchfactor = g_SavedCrouchfactor[g_ulGameTick % CLIENT_PREDICTION_TICS]; pPlayer->turnticks = g_SavedTurnTicks[g_ulGameTick % CLIENT_PREDICTION_TICS]; pPlayer->mo->reactiontime = g_lSavedReactionTime[g_ulGameTick % CLIENT_PREDICTION_TICS];