Only return early for floordiff if under-water surface is SLOPED

This commit is contained in:
toaster 2022-11-19 22:37:16 +00:00
parent ad464817dd
commit f06d4b4369

View file

@ -3218,14 +3218,15 @@ boolean P_CanRunOnWater(mobj_t *mobj, ffloor_t *rover)
// We start water run IF we can step onto it! // We start water run IF we can step onto it!
if (surfDiff <= maxStep && surfDiff >= 0) if (surfDiff <= maxStep && surfDiff >= 0)
{ {
if (ourZAng < 0) pslope_t *groundSlope = (flip ? mobj->subsector->sector->c_slope : mobj->subsector->sector->f_slope);
if (groundSlope != NULL && groundSlope->zangle != 0)
{ {
fixed_t floorheight = flip ? P_GetSectorCeilingZAt(mobj->subsector->sector, mobj->x, mobj->y) : P_GetSectorFloorZAt(mobj->subsector->sector, mobj->x, mobj->y); fixed_t floorheight = flip ? P_GetSectorCeilingZAt(mobj->subsector->sector, mobj->x, mobj->y) : P_GetSectorFloorZAt(mobj->subsector->sector, mobj->x, mobj->y);
fixed_t floorDiff = flip ? (floorheight - mobjbottom) : (mobjbottom - floorheight); fixed_t floorDiff = flip ? (floorheight - mobjbottom) : (mobjbottom - floorheight);
if (floorDiff <= maxStep && floorDiff >= -maxStep) if (floorDiff <= maxStep && floorDiff >= -maxStep)
{ {
// ... but NOT if going down and real floor is in range. // ... but NOT if downward-sloping real floor is in range.
// FIXME: Count solid FOFs in this check // FIXME: Count solid FOFs in these checks
return false; return false;
} }
} }