diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 2a7b9f761..0b4c51c4b 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -6401,19 +6401,21 @@ boolean TryRunTics(tic_t realtics) } #endif - if (neededtic > gametic) + ticking = neededtic > gametic; + + if (ticking) { - hu_stopped = false; + if (realtics) + hu_stopped = false; } if (player_joining) { - hu_stopped = true; + if (realtics) + hu_stopped = true; return false; } - ticking = neededtic > gametic; - if (ticking) { // run the count * tics @@ -6444,7 +6446,8 @@ boolean TryRunTics(tic_t realtics) } else { - hu_stopped = true; + if (realtics) + hu_stopped = true; } return ticking; diff --git a/src/d_main.c b/src/d_main.c index ef3a09b8d..207e1ca56 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -813,7 +813,7 @@ void D_SRB2Loop(void) { renderdeltatics = FLOAT_TO_FIXED(deltatics); - if (!(paused || P_AutoPause()) && deltatics < 1.0 && !hu_stopped) + if (!(paused || P_AutoPause()) && !hu_stopped) { rendertimefrac = g_time.timefrac; } diff --git a/src/g_game.c b/src/g_game.c index 8fbb418ca..f807b724c 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2016,9 +2016,6 @@ static void G_FixCamera(UINT8 view) // Make sure the viewport doesn't interpolate at all into // its new position -- just snap instantly into place. - - // Why does it need to be done twice? - R_ResetViewInterpolation(view); R_ResetViewInterpolation(view); } diff --git a/src/p_setup.c b/src/p_setup.c index ce1dd6efb..e06df00cd 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3018,7 +3018,6 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate) if (rendermode != render_none && !reloadinggamestate) { - R_ResetViewInterpolation(0); R_ResetViewInterpolation(0); R_UpdateMobjInterpolators(); } diff --git a/src/p_spec.c b/src/p_spec.c index 997cc437c..5f9ef78a6 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2084,6 +2084,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) mo->y += y; mo->z += z; P_SetThingPosition(mo); + mo->old_x = mo->x; + mo->old_y = mo->y; + mo->old_z = mo->z; if (mo->player) { @@ -2102,7 +2105,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) camera[i].reset = true; camera[i].subsector = R_PointInSubsector(camera[i].x, camera[i].y); R_RelativeTeleportViewInterpolation(i, x, y, z, 0); - R_ResetViewInterpolation(i + 1); // reset view interp as well break; } } @@ -2520,7 +2522,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) if (displayplayers[i] == (mo->player - players)) { R_ResetViewInterpolation(i + 1); - R_ResetViewInterpolation(i + 1); } } } diff --git a/src/p_tick.c b/src/p_tick.c index 989d27108..d6243fde9 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -434,10 +434,21 @@ void P_Ticker(boolean run) { INT32 i; - //Increment jointime even if paused. + // Increment jointime and quittime even if paused for (i = 0; i < MAXPLAYERS; i++) + { if (playeringame[i]) - ++players[i].jointime; + { + 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) { @@ -669,7 +680,6 @@ void P_Ticker(boolean run) if (run) { R_UpdateLevelInterpolators(); - R_UpdateViewInterpolation(); // Hack: ensure newview is assigned every tic. // Ensures view interpolation is T-1 to T in poor network conditions diff --git a/src/p_user.c b/src/p_user.c index 31287e904..4041c17d6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3995,7 +3995,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall { P_MoveChaseCamera(player, thiscam, false); R_ResetViewInterpolation(num + 1); - R_ResetViewInterpolation(num + 1); } return (x == thiscam->x && y == thiscam->y && z == thiscam->z && angle == thiscam->aiming); diff --git a/src/r_fps.c b/src/r_fps.c index c981fa726..0f86160a6 100644 --- a/src/r_fps.c +++ b/src/r_fps.c @@ -23,6 +23,7 @@ #include "r_state.h" #include "z_zone.h" #include "console.h" // con_startup_loadprogress +#include "i_time.h" #ifdef HWRENDER #include "hardware/hw_main.h" // for cv_grshearing @@ -79,6 +80,7 @@ static viewvars_t skyview_old[MAXSPLITSCREENPLAYERS]; static viewvars_t skyview_new[MAXSPLITSCREENPLAYERS]; static viewvars_t *oldview = &pview_old[0]; +static tic_t last_view_update; static int oldview_invalid[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0}; viewvars_t *newview = &pview_new[0]; @@ -207,21 +209,27 @@ void R_UpdateViewInterpolation(void) if (oldview_invalid[i]) oldview_invalid[i]--; } + + last_view_update = I_GetTime(); } void R_ResetViewInterpolation(UINT8 p) { + // Wait an extra tic if the interpolation state hasn't + // updated yet. + int t = ((last_view_update == I_GetTime()) ? 1 : 2); + if (p == 0) { UINT8 i; for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { - oldview_invalid[i]++; + oldview_invalid[i] = t; } } else { - oldview_invalid[p - 1]++; + oldview_invalid[p - 1] = t; } } diff --git a/src/y_inter.c b/src/y_inter.c index 75a705e60..12fc705ad 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -463,14 +463,12 @@ void Y_IntermissionDrawer(void) for (i = 0; i < data.match.numplayers; i++) { - boolean dojitter = data.match.jitter[data.match.num[i]]; - data.match.jitter[data.match.num[i]] = 0; - if (data.match.num[i] != MAXPLAYERS && playeringame[data.match.num[i]] && !players[data.match.num[i]].spectator) { char strtime[MAXPLAYERNAME+1]; - if (dojitter) + // Apply the jitter offset (later reversed) + if (data.match.jitter[data.match.num[i]] > 0) y--; V_DrawCenteredString(x+6, y, 0, va("%d", data.match.pos[i])); @@ -559,7 +557,7 @@ void Y_IntermissionDrawer(void) } } - if (dojitter) + if (data.match.jitter[data.match.num[i]] > 0) y++; } else @@ -666,8 +664,16 @@ void Y_Ticker(void) return; } - if (intertic < TICRATE || intertic & 1 || endtic != -1) + if (intertic < TICRATE || endtic != -1) + { return; + } + + if (data.match.rankingsmode && intertic & 1) + { + memset(data.match.jitter, 0, sizeof (data.match.jitter)); + return; + } if (intertype == int_race || intertype == int_match) {