Merge branch 'fix-removed-viewmobj-segfault' into 'next'

Fix segfault when setting up view frame for a removed mobj

See merge request STJr/SRB2!2270
This commit is contained in:
sphere 2024-01-29 13:53:59 +00:00
commit f6cd5ab13e
2 changed files with 2 additions and 2 deletions

View file

@ -1201,7 +1201,7 @@ void R_SetupFrame(player_t *player)
newview->x += quake.x;
newview->y += quake.y;
if (r_viewmobj->subsector)
if (!P_MobjWasRemoved(r_viewmobj) && r_viewmobj->subsector)
newview->sector = r_viewmobj->subsector->sector;
else
newview->sector = R_PointInSubsector(newview->x, newview->y)->sector;

View file

@ -3496,7 +3496,7 @@ boolean R_ThingVisible (mobj_t *thing)
(thing->sprite == SPR_NULL) || // Don't draw null-sprites
(thing->flags2 & MF2_DONTDRAW) || // Don't draw MF2_LINKDRAW objects
(thing->drawonlyforplayer && thing->drawonlyforplayer != viewplayer) || // Don't draw other players' personal objects
(r_viewmobj && (
(!P_MobjWasRemoved(r_viewmobj) && (
(r_viewmobj == thing) || // Don't draw first-person players or awayviewmobj objects
(r_viewmobj->player && r_viewmobj->player->followmobj == thing) || // Don't draw first-person players' followmobj
(r_viewmobj == thing->dontdrawforviewmobj) // Don't draw objects that are hidden for the current view