MT_POGOSPRING: Guarantee spawn of catholocism

This commit is contained in:
toaster 2023-11-07 22:50:51 +00:00
parent 2e760eff43
commit 6f22c5261e
2 changed files with 16 additions and 11 deletions

View file

@ -6336,6 +6336,7 @@ static void K_DoShrink(player_t *user)
void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound) void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound)
{ {
fixed_t thrust = 0; fixed_t thrust = 0;
boolean dontapplymomz = false;
if (mo->player && mo->player->spectator) if (mo->player && mo->player->spectator)
return; return;
@ -6348,11 +6349,16 @@ void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound)
mo->eflags |= MFE_SPRUNG; mo->eflags |= MFE_SPRUNG;
if (vertispeed <= 0) if (vertispeed == 0)
{ {
vertispeed = P_AproxDistance(mo->momx, mo->momy); vertispeed = P_AproxDistance(mo->momx, mo->momy);
vertispeed = FixedMul(vertispeed, FINESINE(ANGLE_22h >> ANGLETOFINESHIFT)); vertispeed = FixedMul(vertispeed, FINESINE(ANGLE_22h >> ANGLETOFINESHIFT));
} }
else if (vertispeed < 0)
{
dontapplymomz = 0;
vertispeed = -vertispeed;
}
thrust = vertispeed * P_MobjFlip(mo); thrust = vertispeed * P_MobjFlip(mo);
@ -6422,11 +6428,14 @@ void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound)
mo->player->fastfall = 0; mo->player->fastfall = 0;
} }
mo->momz = FixedMul(thrust, mapobjectscale); if (dontapplymomz == false)
if (mo->eflags & MFE_UNDERWATER)
{ {
mo->momz = FixedDiv(mo->momz, FixedSqrt(3*FRACUNIT)); mo->momz = FixedMul(thrust, mapobjectscale);
if (mo->eflags & MFE_UNDERWATER)
{
mo->momz = FixedDiv(mo->momz, FixedSqrt(3*FRACUNIT));
}
} }
P_ResetPitchRoll(mo); P_ResetPitchRoll(mo);

View file

@ -427,12 +427,8 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
{ {
if (spring->reactiontime == 0) if (spring->reactiontime == 0)
{ {
object->player->tricktime = 0; // Reset post-hitlag timer object->eflags &= ~MFE_SPRUNG; // needed to permit the following
// Setup the boost for potential upwards trick, at worse, make it your regular max speed. (boost = curr speed*1.25) K_DoPogoSpring(object, -vertispeed, 0); // negative so momz isn't modified
object->player->trickboostpower = max(FixedDiv(object->player->speed, K_GetKartSpeed(object->player, false, false)) - FRACUNIT, 0)*125/100;
//CONS_Printf("Got boost: %d%\n", mo->player->trickboostpower*100 / FRACUNIT);
object->player->trickpanel = 1;
object->player->pflags |= PF_TRICKDELAY;
} }
else else
{ {