From e8a8064da95d95353177dcf80b7b379874d2f59a Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 22 Apr 2023 20:40:35 -0700 Subject: [PATCH 1/2] P_Ticker: update view interpolation at the start of a tic This lets R_ResetViewInterpolation only need to be called once from game logic. --- src/g_game.c | 2 -- src/g_party.cpp | 1 - src/p_setup.c | 1 - src/p_tick.c | 8 +++++++- src/p_user.c | 1 - 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 5791fc7db..faade2de5 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2090,8 +2090,6 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive) camerap = &camera[viewnum-1]; P_ResetCamera(&players[(*displayplayerp)], camerap); - // Why does it need to be done twice? - R_ResetViewInterpolation(viewnum); R_ResetViewInterpolation(viewnum); } diff --git a/src/g_party.cpp b/src/g_party.cpp index 7d2d57e34..1c82a2d1d 100644 --- a/src/g_party.cpp +++ b/src/g_party.cpp @@ -150,7 +150,6 @@ public: // all into its new position -- just snap // instantly into place. R_ResetViewInterpolation(1 + i); - R_ResetViewInterpolation(1 + i); // (Why does it need to be called twice?) } r_splitscreen = size() - 1; diff --git a/src/p_setup.c b/src/p_setup.c index 32f0766eb..e1fbaf15f 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -8093,7 +8093,6 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) if (rendermode != render_none && reloadinggamestate == false) { - R_ResetViewInterpolation(0); R_ResetViewInterpolation(0); R_UpdateMobjInterpolators(); diff --git a/src/p_tick.c b/src/p_tick.c index b7e907e6b..54ce0a21f 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -646,6 +646,13 @@ void P_Ticker(boolean run) } } + 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()) @@ -982,7 +989,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 80afd5aaf..fe15573c4 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3606,7 +3606,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); From 11242527ed7a2cf79adf2210442a13e35573b832 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 22 Apr 2023 20:49:01 -0700 Subject: [PATCH 2/2] 412 teleport: correctly update interpolation state - Fixes relative teleport not updating floorz/ceilingz, causing camera to potentially get clipped by old position - Fixes absolute teleport not resetting viewpoint interpolation --- src/p_spec.c | 6 +----- src/p_telept.c | 2 ++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 3c462c4d7..5adad0c23 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2853,11 +2853,7 @@ boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, cha y = args[3] << FRACBITS; z = args[4] << FRACBITS; - P_UnsetThingPosition(mo); - mo->x += x; - mo->y += y; - mo->z += z; - P_SetThingPosition(mo); + P_SetOrigin(mo, mo->x + x, mo->y + y, mo->z + z); if (mo->player) { diff --git a/src/p_telept.c b/src/p_telept.c index 9d3f792a3..a3a38a84f 100644 --- a/src/p_telept.c +++ b/src/p_telept.c @@ -169,6 +169,8 @@ boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle P_ResetCamera(thing->player, &camera[i]); } + R_ResetViewInterpolation(1 + i); + break; } }