Use correct subsector for interpolation, ensure view mobj is set

This commit is contained in:
Lactozilla 2023-06-26 17:42:06 -03:00
parent 8ad191b080
commit 233bddc68e
2 changed files with 5 additions and 3 deletions

View file

@ -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);
}

View file

@ -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);