Optimize Z position functions on sloped sectors
inside the floor and ceiling Z functions, a call to R_PointInSubsector
was made to check if an object is at the very top of a slope in order to avoid ascending beyond the sector height. problem is that R_PointInSubsector
is overkill for just simply checking if a point is in a sector, especially when we already have the sector that we want to check if we're inside.
to optimize this, i made a function R_IsPointInSector
that simply checks if a point is within a specified sector. it does this by iterating all lines in the sector and finding the closest line to that point, then checking which side of the line that the point is. if it's on the side that the sector we are looking for is on, we know we're inside the sector. this is much more performant than using R_PointInSubsector
since we don't have to traverse the entire BSP tree just to find that one sector that we already have.