- Duke: Test tsprite's sector in animatesprites_d() following crash while noclipping in Duke WT's E5L1. Apply same fix to animatesprites_r() as well.

This commit is contained in:
Mitch Richters 2021-12-07 22:55:08 +11:00
parent 6aba76cfe5
commit 5aa4243327
2 changed files with 4 additions and 21 deletions

View file

@ -134,14 +134,8 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int
continue; continue;
} }
if (t->sector()->ceilingstat & 1) if (t->insector())
l = t->sector()->ceilingshade; t->shade = clamp<int>(t->sector()->ceilingstat & 1 ? t->sector()->ceilingshade : t->sector()->floorshade, -127, 127);
else
l = t->sector()->floorshade;
if (l < -127) l = -127;
if (l > 128) l = 127;
t->shade = l;
} }

View file

@ -119,19 +119,8 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int
} }
} }
if (t->sector()->ceilingstat & 1) if (t->insector())
{ t->shade = clamp<int>(t->sector()->ceilingstat & 1 ? s->shade : t->sector()->floorshade, -127, 127);
if (badguy(s))
l = s->shade;
else
l = s->shade;
}
else
l = t->sector()->floorshade;
if (l < -127) l = -127;
if (l > 128) l = 127;
t->shade = l;
} }