From 45170bb65cbb53ea9c65316423d508272699f59d Mon Sep 17 00:00:00 2001 From: NepDisk Date: Fri, 27 Jun 2025 07:55:35 -0400 Subject: [PATCH] Fix weird snapping on net jitters --- src/d_clisrv.c | 14 +------------- src/d_main.cpp | 19 ++++++++++++++----- src/p_tick.c | 7 +++++++ 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 4762d89c6..b0578ea59 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -5634,7 +5634,6 @@ boolean TryRunTics(tic_t realtics) if (ticking) { { - boolean tickInterp = true; // run the count * tics while (neededtic > gametic) @@ -5663,19 +5662,8 @@ boolean TryRunTics(tic_t realtics) P_PostLoadLevel(); } - boolean run = (gametic % NEWTICRATERATIO) == 0; - - if (run && tickInterp) - { - // Update old view state BEFORE ticking so resetting - // the old interpolation state from game logic works. - R_UpdateViewInterpolation(); - tickInterp = false; // do not update again in sped-up tics - } - - G_Ticker(run); + G_Ticker((gametic % NEWTICRATERATIO) == 0); } - if (Playing() && netgame && (gametic % TICRATE == 0)) { Schedule_Run(); diff --git a/src/d_main.cpp b/src/d_main.cpp index a431aed13..2206d2963 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -893,7 +893,9 @@ void D_SRB2Loop(void) { renderdeltatics = FLOAT_TO_FIXED(deltatics); - if (!(paused || P_AutoPause()) && !hu_stopped) + const boolean lagging = ((deltatics >= 1.0) || hu_stopped); + + if (!(paused || P_AutoPause()) && !lagging) { rendertimefrac = g_time.timefrac; } @@ -902,7 +904,14 @@ void D_SRB2Loop(void) rendertimefrac = FRACUNIT; } - rendertimefrac_unpaused = g_time.timefrac; + if (!lagging) + { + rendertimefrac_unpaused = g_time.timefrac; + } + else + { + rendertimefrac_unpaused = FRACUNIT; + } } else { @@ -942,7 +951,7 @@ void D_SRB2Loop(void) // Fully completed frame made. finishprecise = I_GetPreciseTime(); - // Use the time before sleep for frameskip calculations: + // Use the time before sleep for frameskip calculations: // post-sleep time is literally being intentionally wasted deltasecs = (double)((INT64)(finishprecise - enterprecise)) / I_GetPrecisePrecision(); deltatics = deltasecs * NEWTICRATE; @@ -1534,11 +1543,11 @@ void D_SRB2Main(void) I_Error("modifiedgame set during startup!"); CONS_Printf("W_InitMultipleFiles(): Adding external PWADs.\n"); - + // HACK: Refer to https://git.do.srb2.org/KartKrew/RingRacers/-/merge_requests/29#note_61574 partadd_earliestfile = numwadfiles; W_InitMultipleFiles(startuppwads, true); - + // Only search for pwad maps and reload graphics if we actually have a pwad added if (startuppwads[0] != NULL) { diff --git a/src/p_tick.c b/src/p_tick.c index 92eece7ba..48a5ed6d3 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -665,6 +665,13 @@ void P_Ticker(boolean run) players[i].jointime++; } + if (run) + { + // Update old view state BEFORE ticking so resetting + // the old interpolation state from game logic works. + R_UpdateViewInterpolation(); + } + if (objectplacing) { if (OP_FreezeObjectplace())