- Blood: added checks to the SEQ code to handle situation where their attached object has been removed from the game.

This commit is contained in:
Christoph Oelckers 2021-08-31 19:38:25 +02:00
parent 62502439d7
commit d4439b879c

View file

@ -260,7 +260,8 @@ void UpdateSprite(int nXSprite, SEQFRAME* pFrame)
{
assert(nXSprite > 0 && nXSprite < kMaxXSprites);
int nSprite = xsprite[nXSprite].reference;
assert(nSprite >= 0 && nSprite < kMaxSprites);
if (!(nSprite >= 0 && nSprite < kMaxSprites)) return; // sprite may have been deleted already.
spritetype* pSprite = &sprite[nSprite];
assert(pSprite->extra == nXSprite);
if (pSprite->flags & 2)
@ -657,12 +658,14 @@ void seqProcess(int nTicks)
{
if (pInst->type == SS_SPRITE)
{
short nSprite = (short)xsprite[index].reference;
assert(nSprite >= 0 && nSprite < kMaxSprites);
evKill(nSprite, SS_SPRITE);
if ((sprite[nSprite].hitag & kAttrRespawn) != 0 && (sprite[nSprite].inittype >= kDudeBase && sprite[nSprite].inittype < kDudeMax))
evPost(nSprite, 3, gGameOptions.nMonsterRespawnTime, kCallbackRespawn);
else deletesprite(nSprite); // safe to not use actPostSprite here
int nSprite = xsprite[index].reference;
if (nSprite >= 0 && nSprite < kMaxSprites)
{
evKill(nSprite, SS_SPRITE);
if ((sprite[nSprite].hitag & kAttrRespawn) != 0 && (sprite[nSprite].inittype >= kDudeBase && sprite[nSprite].inittype < kDudeMax))
evPost(nSprite, 3, gGameOptions.nMonsterRespawnTime, kCallbackRespawn);
else deletesprite(nSprite); // safe to not use actPostSprite here
}
}
if (pInst->type == SS_MASKED)