Fixes issue with picnum 0 sprites used as map geometry

git-svn-id: https://svn.eduke32.com/eduke32@5933 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2016-11-14 23:47:11 +00:00
parent 55532bb571
commit 0bdbc463c0
1 changed files with 5 additions and 1 deletions

View File

@ -8184,11 +8184,15 @@ void A_PlayAlertSound(int spriteNum)
int A_CheckSwitchTile(int spriteNum)
{
// picnum 0 would oob in the switch below,
if (PN(spriteNum) <= 0)
return 0;
// MULTISWITCH has 4 states so deal with it separately,
// ACCESSSWITCH and ACCESSSWITCH2 are only active in one state so deal with
// them separately.
if ((PN(spriteNum) <= 0) || (PN(spriteNum) >= MULTISWITCH && PN(spriteNum) <= MULTISWITCH + 3) || (PN(spriteNum) == ACCESSSWITCH || PN(spriteNum) == ACCESSSWITCH2))
if ((PN(spriteNum) >= MULTISWITCH && PN(spriteNum) <= MULTISWITCH + 3) || (PN(spriteNum) == ACCESSSWITCH || PN(spriteNum) == ACCESSSWITCH2))
return 1;
// Loop to catch both states of switches.