From a25bf7b695c8ffec6ee874f2769f3665c8236e6c Mon Sep 17 00:00:00 2001 From: Arthur <spaddlewit@gmail.com> Date: Tue, 20 Feb 2024 16:42:29 -0500 Subject: [PATCH] Replace R_IsPointInSector functionality until it is fixed someday. --- src/p_mobj.c | 14 ++++++++++---- src/r_main.c | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 3000c66740..8e757f3f96 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1120,7 +1120,10 @@ fixed_t P_MobjFloorZ(sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, testy += y; // If the highest point is in the sector, then we have it easy! Just get the Z at that point - if (R_IsPointInSector(boundsec ? boundsec : sector, testx, testy)) +// if (R_IsPointInSector(boundsec ? boundsec : sector, testx, testy)) +// return P_GetSlopeZAt(slope, testx, testy); + + if (R_PointInSubsector(testx, testy)->sector == boundsec ? boundsec : sector) return P_GetSlopeZAt(slope, testx, testy); // If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point @@ -1196,7 +1199,10 @@ fixed_t P_MobjCeilingZ(sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t testy += y; // If the highest point is in the sector, then we have it easy! Just get the Z at that point - if (R_IsPointInSector(boundsec ? boundsec : sector, testx, testy)) +// if (R_IsPointInSector(boundsec ? boundsec : sector, testx, testy)) +// return P_GetSlopeZAt(slope, testx, testy); + + if (R_PointInSubsector(testx, testy)->sector == boundsec ? boundsec : sector) return P_GetSlopeZAt(slope, testx, testy); // If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point @@ -2173,8 +2179,8 @@ boolean P_CheckDeathPitCollide(mobj_t *mo) if (mo->player && mo->player->pflags & PF_GODMODE) return false; - fixed_t sectorFloor = P_MobjFloorZ(mo->subsector->sector, NULL, mo->x, mo->y, mo->radius, NULL, false, false); - fixed_t sectorCeiling = P_MobjCeilingZ(mo->subsector->sector, NULL, mo->x, mo->y, mo->radius, NULL, true, false); + fixed_t sectorFloor = P_MobjFloorZ(mo->subsector->sector, mo->subsector->sector, mo->x, mo->y, mo->radius, NULL, false, true); + fixed_t sectorCeiling = P_MobjCeilingZ(mo->subsector->sector, mo->subsector->sector, mo->x, mo->y, mo->radius, NULL, true, true); if (((mo->z <= sectorFloor && ((mo->subsector->sector->flags & MSF_TRIGGERSPECIAL_HEADBUMP) || !(mo->eflags & MFE_VERTICALFLIP)) && (mo->subsector->sector->flags & MSF_FLIPSPECIAL_FLOOR)) diff --git a/src/r_main.c b/src/r_main.c index aaab234ad1..5a09034675 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1020,6 +1020,8 @@ void R_Init(void) // // R_IsPointInSector // +// TODO: THIS FUNCTION IS BROKEN, WILL RETURN FALSE FOR POINTS OBVIOUSLY INSIDE A SECTOR +// boolean R_IsPointInSector(sector_t *sector, fixed_t x, fixed_t y) { size_t i; -- GitLab