From 233bddc68e44cb060a93cd4c7a825ebb0628d7b3 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Mon, 26 Jun 2023 17:42:06 -0300 Subject: [PATCH] Use correct subsector for interpolation, ensure view mobj is set --- src/r_fps.c | 6 +++--- src/r_main.c | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/r_fps.c b/src/r_fps.c index 9b16e9252..35c0f342f 100644 --- a/src/r_fps.c +++ b/src/r_fps.c @@ -191,7 +191,7 @@ void R_InterpolateView(fixed_t frac) // this is gonna create some interesting visual errors for long distance teleports... // might want to recalculate the view sector every frame instead... viewplayer = newview->player; - viewsector = R_PointInSubsector(viewx, viewy)->sector; + viewsector = R_PointInWorldSubsector(viewworld, viewx, viewy)->sector; // well, this ain't pretty if (newview == &sky1view_new || newview == &sky2view_new) @@ -309,7 +309,7 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out) out->spritexoffset = mobj->spritexoffset; out->spriteyoffset = mobj->spriteyoffset; - out->subsector = R_PointInSubsector(out->x, out->y); + out->subsector = R_PointInWorldSubsector(viewworld, out->x, out->y); if (mobj->player) { @@ -347,7 +347,7 @@ void R_InterpolatePrecipMobjState(precipmobj_t *mobj, fixed_t frac, interpmobjst out->spritexoffset = R_LerpFixed(mobj->old_spritexoffset, mobj->spritexoffset, frac); out->spriteyoffset = R_LerpFixed(mobj->old_spriteyoffset, mobj->spriteyoffset, frac); - out->subsector = R_PointInSubsector(out->x, out->y); + out->subsector = R_PointInWorldSubsector(viewworld, out->x, out->y); out->angle = R_LerpAngle(mobj->old_angle, mobj->angle, frac); } diff --git a/src/r_main.c b/src/r_main.c index 205142ea5..0060ef6f3 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1144,6 +1144,8 @@ void R_SetupFrame(player_t *player) if (viewworld == NULL) return; + R_SetViewMobj(player); + camera_t *thiscam = r_viewcam; boolean chasecam = R_ViewpointHasChasecam(player);