From 5639113ed848ae234276079f5a3db893f0aa2cdd Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 11 Mar 2023 04:59:47 -0500 Subject: [PATCH] Slope thrust changes - Slope thrust is scaled with game speed. Makes Easy more reasonable, and Hard goofier. - Slope upward/downward thrust multiplier is applied to all objects equally, instead of only players. --- src/p_slopes.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index 5175d850a..fb2631aef 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -1112,13 +1112,18 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope) // Handles sliding down slopes, like if they were made of butter :) void P_ButteredSlope(mobj_t *mo) { - fixed_t thrust; + const fixed_t gameSpeed = K_GetKartGameSpeedScalar(gamespeed); + fixed_t thrust = 0; if (mo->flags & (MF_NOCLIPHEIGHT|MF_NOGRAVITY)) + { return; // don't slide down slopes if you can't touch them or you're not affected by gravity + } if (P_CanApplySlopePhysics(mo, mo->standingslope) == false) + { return; // No physics, no butter. + } if (mo->player != NULL) { @@ -1141,17 +1146,21 @@ void P_ButteredSlope(mobj_t *mo) thrust = FINESINE(mo->standingslope->zangle>>ANGLETOFINESHIFT) * 5 / 4 * (mo->eflags & MFE_VERTICALFLIP ? 1 : -1); - if (mo->player) { + // Make uphill easier to climb, and downhill even faster. + if (mo->momx || mo->momy) + { fixed_t mult = FRACUNIT; - if (mo->momx || mo->momy) { - angle_t angle = R_PointToAngle2(0, 0, mo->momx, mo->momy) - mo->standingslope->xydirection; + angle_t angle = R_PointToAngle2(0, 0, mo->momx, mo->momy) - mo->standingslope->xydirection; - if (P_MobjFlip(mo) * mo->standingslope->zdelta < 0) - angle ^= ANGLE_180; - - mult = FRACUNIT + (FRACUNIT + FINECOSINE(angle>>ANGLETOFINESHIFT))*4/3; + if (P_MobjFlip(mo) * mo->standingslope->zdelta < 0) + { + angle ^= ANGLE_180; } + // Make downhills goofier for Hard, and climbing slopes easier for Easy. + mult = FixedMul(mult, gameSpeed); + + mult = FRACUNIT + (FRACUNIT + mult)*4/3; thrust = FixedMul(thrust, mult); }