Revert "Merge branch 'optimize-slope-z-positioning' into 'next'"

This reverts merge request !2214
This commit is contained in:
Logan Aerl Arias 2024-01-03 14:38:21 +00:00
parent 3992e83e8f
commit be3b652afc
3 changed files with 4 additions and 33 deletions

View file

@ -1121,7 +1121,7 @@ fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, 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_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
@ -1198,7 +1198,7 @@ fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed
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_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
@ -1276,7 +1276,7 @@ fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fix
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_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
@ -1353,7 +1353,7 @@ fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, f
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_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

View file

@ -1014,34 +1014,6 @@ void R_Init(void)
framecount = 0;
}
//
// R_IsPointInSector
//
boolean R_IsPointInSector(sector_t *sector, fixed_t x, fixed_t y)
{
size_t i;
line_t *closest = NULL;
fixed_t closestdist = INT32_MAX;
for (i = 0; i < sector->linecount; i++)
{
vertex_t v;
fixed_t dist;
// find the line closest to the point we're looking for.
P_ClosestPointOnLine(x, y, sector->lines[i], &v);
dist = R_PointToDist2(0, 0, v.x - x, v.y - y);
if (dist < closestdist)
{
closest = sector->lines[i];
closestdist = dist;
}
}
// if the side of the closest line is in this sector, we're inside of it.
return P_PointOnLineSide(x, y, closest) == 0 ? closest->frontsector == sector : closest->backsector == sector;
}
//
// R_PointInSubsector
//

View file

@ -79,7 +79,6 @@ fixed_t R_PointToDist(fixed_t x, fixed_t y);
fixed_t R_PointToDist2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1);
fixed_t R_ScaleFromGlobalAngle(angle_t visangle);
boolean R_IsPointInSector(sector_t *sector, fixed_t x, fixed_t y);
subsector_t *R_PointInSubsector(fixed_t x, fixed_t y);
subsector_t *R_PointInSubsectorOrNull(fixed_t x, fixed_t y);