From 3bab41e7e37824d7adba9e42a55527e938071c71 Mon Sep 17 00:00:00 2001 From: Ashnal Date: Mon, 28 Oct 2024 18:43:47 -0400 Subject: [PATCH] Fix slope stepup adjustment to not adjust on flat "slopes" --- src/p_map.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 3a2494b75..503295071 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2764,6 +2764,21 @@ fixed_t P_GetThingStepUp(mobj_t *thing, fixed_t destX, fixed_t destY) maxstep += maxstepmove; } + if (thing->standingslope && thing->standingslope->zdelta != 0) + { + vector3_t slopemom = {0,0,0}; + slopemom.x = thing->momx; + slopemom.y = thing->momy; + P_QuantizeMomentumToSlope(&slopemom, thing->standingslope); + fixed_t momentumzdelta = FixedDiv(slopemom.z, FixedHypot(slopemom.x, slopemom.y)); // so this lets us know what the zdelta is for the vector the player is travelling along, in addition to the slope's zdelta in its xydirection + // if (thing->player) + // CONS_Printf("%s P_GetThingStepUp %d +", player_names[thing->player-players], maxstep); + maxstep += abs(momentumzdelta); + // if (thing->player) + // CONS_Printf(" %d = %d\n", momentumzdelta, maxstep); + + } + if (P_MobjTouchingSectorSpecialFlag(thing, SSF_DOUBLESTEPUP) || (R_PointInSubsector(destX, destY)->sector->specialflags & SSF_DOUBLESTEPUP)) { @@ -2777,22 +2792,6 @@ fixed_t P_GetThingStepUp(mobj_t *thing, fixed_t destX, fixed_t destY) maxstep = 0; } - if (thing->standingslope) - { - vector3_t slopemom = {0,0,0}; - slopemom.x = thing->momx; - slopemom.y = thing->momy; - slopemom.z = 0; - P_QuantizeMomentumToSlope(&slopemom, thing->standingslope); - fixed_t momentumzdelta = FixedDiv(slopemom.z, FixedHypot(slopemom.x, slopemom.y)); // so this lets us know what the zdelta is for the vector the player is travelling along, in addition to the slope's zdelta in its xydirection - // if (thing->player) - // CONS_Printf("%s P_GetThingStepUp %d +", player_names[thing->player-players], maxstep); - maxstep += abs(momentumzdelta); - // if (thing->player) - // CONS_Printf(" %d = %d\n", momentumzdelta, maxstep); - - } - return maxstep; }