Add another invalid target sprite index check for Spider (and made the lion check more consistent to other code)

This commit is contained in:
sirlemonhead 2019-11-30 16:04:01 +00:00 committed by Christoph Oelckers
parent 66e3a53991
commit a7e09febe4
2 changed files with 5 additions and 5 deletions

View file

@ -186,12 +186,12 @@ void FuncLion(int a, int nDamage, int nRun)
} }
} }
else else
{
if ((a & 0xFFFF) >= 0)
{ {
short nTarget = a & 0xFFFF; short nTarget = a & 0xFFFF;
if (sprite[nTarget].statnum < 199) { if (nTarget > -1)
{
if (nTarget > -1 && sprite[nTarget].statnum < 199) {
LionList[nLion].nTarget = nTarget; LionList[nLion].nTarget = nTarget;
} }

View file

@ -400,7 +400,7 @@ case_3:
SpiderList[nSpider].nHealth -= nDamage; SpiderList[nSpider].nHealth -= nDamage;
if (SpiderList[nSpider].nHealth > 0) if (SpiderList[nSpider].nHealth > 0)
{ {
if (sprite[nTarget].statnum == 100) if (nTarget > -1 && sprite[nTarget].statnum == 100)
{ {
SpiderList[nSpider].nTarget = nTarget; SpiderList[nSpider].nTarget = nTarget;
} }