Skip to content

Commit

Permalink
- Duke: Test tsprite's sector in animatesprites_d() following crash…
Browse files Browse the repository at this point in the history
… while noclipping in Duke WT's E5L1. Apply same fix to `animatesprites_r()` as well.
  • Loading branch information
mjr4077au committed Dec 7, 2021
1 parent 6aba76c commit 5aa4243
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
10 changes: 2 additions & 8 deletions source/games/duke/src/animatesprites_d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,8 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int
continue;
}

if (t->sector()->ceilingstat & 1)
l = t->sector()->ceilingshade;
else
l = t->sector()->floorshade;

if (l < -127) l = -127;
if (l > 128) l = 127;
t->shade = l;
if (t->insector())
t->shade = clamp<int>(t->sector()->ceilingstat & 1 ? t->sector()->ceilingshade : t->sector()->floorshade, -127, 127);
}


Expand Down
15 changes: 2 additions & 13 deletions source/games/duke/src/animatesprites_r.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,8 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int
}
}

if (t->sector()->ceilingstat & 1)
{
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;
if (t->insector())
t->shade = clamp<int>(t->sector()->ceilingstat & 1 ? s->shade : t->sector()->floorshade, -127, 127);
}


Expand Down

0 comments on commit 5aa4243

Please sign in to comment.