From e1a4f615b9772d2fcedc2569ea1fa190cfce2ec2 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 16 Sep 2023 21:02:14 +0100 Subject: [PATCH] P_CheckDeathPitCollide: Use P_GetSpecialBottomZ/P_GetSpecialTopZ instead of floorz, ceilingz Fixes a nasty ledge/FOF touch oversight --- src/p_mobj.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 48ac8a266..724f71cdd 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2194,12 +2194,11 @@ boolean P_CheckDeathPitCollide(mobj_t *mo) const boolean flipped = (mo->eflags & MFE_VERTICALFLIP); const sectorflags_t flags = mo->subsector->sector->flags; - return ( - (mo->z <= mo->floorz - && ((flags & MSF_TRIGGERSPECIAL_HEADBUMP) || !flipped) && (flags & MSF_FLIPSPECIAL_FLOOR)) - || (mo->z + mo->height >= mo->ceilingz - && ((flags & MSF_TRIGGERSPECIAL_HEADBUMP) || flipped) && (flags & MSF_FLIPSPECIAL_CEILING)) - ); + if (((flags & MSF_TRIGGERSPECIAL_HEADBUMP) || !flipped) && (flags & MSF_FLIPSPECIAL_FLOOR)) + return (mo->z <= P_GetSpecialBottomZ(mo, mo->subsector->sector, mo->subsector->sector)); + + if (((flags & MSF_TRIGGERSPECIAL_HEADBUMP) || flipped) && (flags & MSF_FLIPSPECIAL_CEILING)) + return (mo->z + mo->height >= P_GetSpecialTopZ(mo, mo->subsector->sector, mo->subsector->sector)); } return false;