From a558c4f5c0f3bfa52994cdc7cc92d0d536c146bc Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 18 Nov 2022 19:39:56 +0000 Subject: [PATCH] Waterskiing stepdown improvement Only prohibits when there's a valid stepdown if the object is on a sloping surface. Fixes Mega Aqua Lake without breaking Water Palace or a modified Nova Shore (after addition of an extra downward slope) --- src/p_mobj.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index c010e98e2..a7bb2fb32 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3119,9 +3119,6 @@ boolean P_CanRunOnWater(mobj_t *mobj, ffloor_t *rover) fixed_t surfaceheight = INT32_MAX; fixed_t surfDiff = INT32_MAX; - fixed_t floorheight = INT32_MAX; - fixed_t floorDiff = INT32_MAX; - fixed_t mobjbottom = INT32_MAX; fixed_t maxStep = INT32_MAX; boolean doifit = false; @@ -3210,16 +3207,20 @@ boolean P_CanRunOnWater(mobj_t *mobj, ffloor_t *rover) maxStep = P_GetThingStepUp(mobj, mobj->x, mobj->y); surfDiff = flip ? (surfaceheight - mobjbottom) : (mobjbottom - surfaceheight); + + // We start water run IF we can step onto it! if (surfDiff <= maxStep && surfDiff >= 0) { - // We start water run IF we can step-down! - floorheight = flip ? P_GetSectorCeilingZAt(mobj->subsector->sector, mobj->x, mobj->y) : P_GetSectorFloorZAt(mobj->subsector->sector, mobj->x, mobj->y); - floorDiff = flip ? (floorheight - mobjbottom) : (mobjbottom - floorheight); - if (floorDiff <= maxStep && floorDiff >= 0) + if (ourZAng < 0) { - // ... but NOT if real floor is in range. - // FIXME: Count solid FOFs in this check - return false; + 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); + if (floorDiff <= maxStep && floorDiff >= -maxStep) + { + // ... but NOT if going down and real floor is in range. + // FIXME: Count solid FOFs in this check + return false; + } } return true;