Commit MetaInfo

Revision37672cb788f4378536a18b2fa9d1f9654fe781a4 (tree)
Time2020-09-03 23:28:04
AuthorgeNia
CommitergeNia

Log Message

Fixed jitter caused by prediction when changing actor speed

Change Summary

Incremental Difference

diff -r fc8e0ebe9194 -r 37672cb788f4 src/cl_pred.cpp
--- a/src/cl_pred.cpp Mon Jul 20 23:31:14 2020 +0300
+++ b/src/cl_pred.cpp Thu Sep 03 10:28:04 2020 -0400
@@ -87,6 +87,7 @@
8787 static ticcmd_t g_SavedTiccmd[CLIENT_PREDICTION_TICS];
8888 static angle_t g_SavedAngle[CLIENT_PREDICTION_TICS];
8989 static fixed_t g_SavedPitch[CLIENT_PREDICTION_TICS];
90+static fixed_t g_SavedSpeed[CLIENT_PREDICTION_TICS];
9091 static fixed_t g_SavedCrouchfactor[CLIENT_PREDICTION_TICS];
9192 static BYTE g_SavedTurnTicks[CLIENT_PREDICTION_TICS];
9293 static LONG g_lSavedReactionTime[CLIENT_PREDICTION_TICS];
@@ -374,6 +375,7 @@
374375 {
375376 g_SavedAngle[g_ulGameTick % CLIENT_PREDICTION_TICS] = pPlayer->mo->angle;
376377 g_SavedPitch[g_ulGameTick % CLIENT_PREDICTION_TICS] = pPlayer->mo->pitch;
378+ g_SavedSpeed[g_ulGameTick % CLIENT_PREDICTION_TICS] = pPlayer->mo->Speed;
377379 g_SavedCrouchfactor[g_ulGameTick % CLIENT_PREDICTION_TICS] = pPlayer->crouchfactor;
378380 g_SavedTurnTicks[g_ulGameTick % CLIENT_PREDICTION_TICS] = pPlayer->turnticks;
379381 g_lSavedReactionTime[g_ulGameTick % CLIENT_PREDICTION_TICS] = pPlayer->mo->reactiontime;
@@ -420,6 +422,7 @@
420422 // Use backed up values for prediction.
421423 pPlayer->mo->angle = g_SavedAngle[lTick % CLIENT_PREDICTION_TICS];
422424 pPlayer->mo->pitch = g_SavedPitch[lTick % CLIENT_PREDICTION_TICS];
425+ pPlayer->mo->Speed = g_SavedSpeed[lTick % CLIENT_PREDICTION_TICS];
423426 // [BB] Crouch prediction seems to be very tricky. While predicting, we don't recalculate
424427 // crouchfactor, but just use the value we already calculated before.
425428 pPlayer->crouchfactor = g_SavedCrouchfactor[( lTick + 1 )% CLIENT_PREDICTION_TICS];
@@ -456,6 +459,7 @@
456459 {
457460 pPlayer->mo->angle = g_SavedAngle[g_ulGameTick % CLIENT_PREDICTION_TICS];
458461 pPlayer->mo->pitch = g_SavedPitch[g_ulGameTick % CLIENT_PREDICTION_TICS];
462+ pPlayer->mo->Speed = g_SavedSpeed[g_ulGameTick % CLIENT_PREDICTION_TICS];
459463 pPlayer->crouchfactor = g_SavedCrouchfactor[g_ulGameTick % CLIENT_PREDICTION_TICS];
460464 pPlayer->turnticks = g_SavedTurnTicks[g_ulGameTick % CLIENT_PREDICTION_TICS];
461465 pPlayer->mo->reactiontime = g_lSavedReactionTime[g_ulGameTick % CLIENT_PREDICTION_TICS];
Show on old repository browser