dont dereference potential null mobjs in software projectsprite

This commit is contained in:
Alug committed 2024-12-22 01:40:52 +01:00
1 parent 9882291828
commit 1341ec80bf
1 file changed
+7 -9
+7 -9
View File
@@ -1135,9 +1135,6 @@ static void R_ProjectSprite(mobj_t *thing)
size_t rot;
UINT8 flip;
boolean mirrored = thing->mirrored;
boolean hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored);
INT32 lindex;
vissprite_t *vis;
@@ -1149,7 +1146,6 @@ static void R_ProjectSprite(mobj_t *thing)
fixed_t iscale;
fixed_t scalestep; // toast '16
fixed_t offset, offset2;
boolean papersprite = (thing->frame & FF_PAPERSPRITE);
fixed_t paperoffset = 0, paperdistance = 0; angle_t centerangle = 0;
//SoM: 3/17/2000
@@ -1174,6 +1170,11 @@ static void R_ProjectSprite(mobj_t *thing)
if (P_MobjWasRemoved(thing) || thing->subsector == NULL)
return;
const boolean mirrored = thing->mirrored;
const boolean vflip = (thing->eflags & MFE_VERTICALFLIP);
const boolean hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored);
const boolean papersprite = (thing->frame & FF_PAPERSPRITE);
if (cv_maxinterpdist.value)
dist = R_QuickCamDist(thing->x, thing->y);
@@ -1543,7 +1544,7 @@ static void R_ProjectSprite(mobj_t *thing)
}
//SoM: 3/17/2000: Disregard sprites that are out of view..
if (thing->eflags & MFE_VERTICALFLIP)
if (vflip)
{
// When vertical flipped, draw sprites from the top down, at least as far as offsets are concerned.
// sprite height - sprite topoffset is the proper inverse of the vertical offset, of course.
@@ -1709,10 +1710,7 @@ static void R_ProjectSprite(mobj_t *thing)
vis->precip = false;
if (thing->eflags & MFE_VERTICALFLIP)
vis->vflip = true;
else
vis->vflip = false;
vis->vflip = vflip;
vis->isScaled = false;