From 328b2c78f975474a2b0be02a5da32316d611f706 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 10 Mar 2024 07:01:02 -0700 Subject: [PATCH] UFO Catcher: use a specialized speed cut function for boost damage while waterskiing - Do not send the player backward, simply reduce their forward momentum - Below 67%, divide speed by 4 - Above 67%, remove a flat 50% top speed - The goal here is to basically stop the player at low speeds, like it did before, but cut a smaller amount at high speeds so players can remain water skiing after a highly boosted collision --- src/objects/ufo.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/objects/ufo.c b/src/objects/ufo.c index 0543b3099..25e4f6d5d 100644 --- a/src/objects/ufo.c +++ b/src/objects/ufo.c @@ -1004,6 +1004,30 @@ void Obj_PlayerUFOCollide(mobj_t *ufo, mobj_t *other) Obj_SpecialUFODamage(ufo, other, other, DMG_STEAL); other->player->sneakertimer = 0; other->player->numsneakers = 0; + + // Copied from Obj_OrbinautThrown + const ffloor_t *rover = P_IsObjectFlipped(other) ? other->ceilingrover : other->floorrover; + if (rover && (rover->fofflags & FOF_SWIMMABLE)) + { + // Player is waterskiing so use different math to + // reduce their speed some but keep them skiing + // at high speeds. + fixed_t linear = K_GetKartSpeed(other->player, false, false) / 2; + if ((other->player->speed - linear) < other->player->speed / 4) + { + other->momx /= 4; + other->momy /= 4; + } + else + { + angle_t mom = R_PointToAngle2(0, 0, other->momx, other->momy); + P_Thrust(other, mom, -linear); + } + } + else + { + K_KartBouncing(other, ufo); + } } else { @@ -1015,9 +1039,9 @@ void Obj_PlayerUFOCollide(mobj_t *ufo, mobj_t *other) // in front K_StumblePlayer(other->player); } - } - K_KartBouncing(other, ufo); + K_KartBouncing(other, ufo); + } } boolean Obj_UFOEmeraldCollect(mobj_t *ufo, mobj_t *toucher)