From 2bab452268db1aa538b684a9983e4dedb99ed7b7 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 27 Oct 2022 13:38:13 +0100 Subject: [PATCH] Add R_RelativeTeleportViewInterpolation Adjusts pview_old for relative teleport to attempt a contigious motion --- src/p_spec.c | 1 + src/r_fps.c | 8 ++++++++ src/r_fps.h | 2 ++ 3 files changed, 11 insertions(+) diff --git a/src/p_spec.c b/src/p_spec.c index fd9ef4b71..61ae9c63a 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2395,6 +2395,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) camera[i].y += y; camera[i].z += z; camera[i].subsector = R_PointInSubsector(camera[i].x, camera[i].y); + R_RelativeTeleportViewInterpolation(i, x, y, z, 0); break; } } diff --git a/src/r_fps.c b/src/r_fps.c index 2ed039795..9cbee9c0d 100644 --- a/src/r_fps.c +++ b/src/r_fps.c @@ -210,6 +210,14 @@ void R_ResetViewInterpolation(UINT8 p) } } +void R_RelativeTeleportViewInterpolation(UINT8 p, fixed_t xdiff, fixed_t ydiff, fixed_t zdiff, angle_t angdiff) +{ + pview_old[p].x += xdiff; + pview_old[p].y += ydiff; + pview_old[p].z += zdiff; + pview_old[p].angle += angdiff; +} + void R_SetViewContext(enum viewcontext_e _viewcontext) { UINT8 i = 0; diff --git a/src/r_fps.h b/src/r_fps.h index 7e64683fc..2f3f44304 100644 --- a/src/r_fps.h +++ b/src/r_fps.h @@ -115,6 +115,8 @@ void R_InterpolateView(fixed_t frac); void R_UpdateViewInterpolation(void); // Reset the view states (e.g. after level load) so R_InterpolateView doesn't interpolate invalid data void R_ResetViewInterpolation(UINT8 p); +// Update old view for seamless relative teleport +void R_RelativeTeleportViewInterpolation(UINT8 p, fixed_t xdiff, fixed_t ydiff, fixed_t zdiff, angle_t angdiff); // Set the current view context (the viewvars pointed to by newview) void R_SetViewContext(enum viewcontext_e _viewcontext);