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
This commit is contained in:
James R 2024-03-10 07:01:02 -07:00
parent 80756e7f97
commit 328b2c78f9

View file

@ -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)