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

View file

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