Slope fix

This commit is contained in:
Reonu committed 2021-04-27 21:18:07 +01:00
1 parent 52c8acdf5e
commit 58146790aa
1 file changed
+5 -1
+5 -1
View File
@@ -397,6 +397,7 @@ f32 find_floor_height_and_data(f32 xPos, f32 yPos, f32 zPos, struct FloorGeometr
* Iterate through the list of floors and find the first floor under a given point.
*/
static struct Surface *find_floor_from_list(struct SurfaceNode *surfaceNode, s32 x, s32 y, s32 z, f32 *pheight) {
f32 slopeFix = -9999999999999999.0f;
register struct Surface *surf;
register s32 x1, z1, x2, z2, x3, z3;
f32 nx, ny, nz;
@@ -454,13 +455,16 @@ static struct Surface *find_floor_from_list(struct SurfaceNode *surfaceNode, s32
// Find the height of the floor at a given location.
height = -(x * nx + nz * z + oo) / ny;
// Checks for floor interaction with a 78 unit buffer.
if (height < slopeFix) {
continue;
}
if (y - (height + -78.0f) < 0.0f) {
continue;
}
*pheight = height;
floor = surf;
break;
slopeFix = height;
}
//! (Surface Cucking) Since only the first floor is returned and not the highest,