diff --git a/src/p_mobj.c b/src/p_mobj.c index 83d4751768f68415566fb223da2f27e26093661d..60f6020eba4ec87d2297cee7ad7a633546a29380 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1168,7 +1168,7 @@ fixed_t P_MobjFloorZ(sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, return sector->floorheight; } -fixed_t P_MobjCeilingZ(sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, fixed_t radius, line_t *line, boolean lowest, boolean perfect) +fixed_t P_MobjCeilingZ(sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, fixed_t radius, line_t *line, boolean highest, boolean perfect) { I_Assert(sector != NULL); @@ -1187,7 +1187,7 @@ fixed_t P_MobjCeilingZ(sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t else testy = -radius; - if ((slope->zdelta > 0) ^ !!(lowest)) { + if ((slope->zdelta > 0) ^ !!(highest)) { testx = -testx; testy = -testy; } @@ -1206,7 +1206,7 @@ fixed_t P_MobjCeilingZ(sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t fixed_t bbox[4]; fixed_t finalheight; - if (lowest) + if (highest) finalheight = INT32_MAX; else finalheight = INT32_MIN; @@ -1225,7 +1225,7 @@ fixed_t P_MobjCeilingZ(sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t if (P_BoxOnLineSide(bbox, ld) != -1) continue; - if (lowest) + if (highest) finalheight = min(finalheight, HighestOnLine(radius, x, y, ld, slope, true)); else finalheight = max(finalheight, HighestOnLine(radius, x, y, ld, slope, false)); @@ -1239,7 +1239,7 @@ fixed_t P_MobjCeilingZ(sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t if (line == NULL) return P_GetSlopeZAt(slope, x, y); - return HighestOnLine(radius, x, y, line, slope, lowest); + return HighestOnLine(radius, x, y, line, slope, highest); } else // Well, that makes it easy. Just get the ceiling height return sector->ceilingheight; } @@ -2173,8 +2173,8 @@ boolean P_CheckDeathPitCollide(mobj_t *mo) if (mo->player && mo->player->pflags & PF_GODMODE) return false; - const fixed_t sectorFloor = P_GetSectorFloorZAt(mo->subsector->sector, mo->x, mo->y); - const fixed_t sectorCeiling = P_GetSectorCeilingZAt(mo->subsector->sector, mo->x, mo->y); + fixed_t sectorFloor = P_MobjFloorZ(mo->subsector->sector, NULL, mo->x, mo->y, mo->radius, NULL, true, false); + fixed_t sectorCeiling = P_MobjCeilingZ(mo->subsector->sector, NULL, mo->x, mo->y, mo->radius, NULL, true, false); if (((mo->z <= sectorFloor && ((mo->subsector->sector->flags & MSF_TRIGGERSPECIAL_HEADBUMP) || !(mo->eflags & MFE_VERTICALFLIP)) && (mo->subsector->sector->flags & MSF_FLIPSPECIAL_FLOOR))