Merge branch 'turn-in-air' into 'master'

Allow players to turn when they're in the air at 0 speed

See merge request KartKrew/Kart!403
This commit is contained in:
Sal 2021-04-07 18:03:42 -04:00
commit 973ed55170

View file

@ -7123,36 +7123,36 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue)
fixed_t weightadjust = INT32_MAX; fixed_t weightadjust = INT32_MAX;
if (player->mo == NULL || P_MobjWasRemoved(player->mo)) if (player->mo == NULL || P_MobjWasRemoved(player->mo) || player->spectator || objectplacing)
{
return 0;
}
if (player->spectator || objectplacing)
{ {
// Invalid object, or incorporeal player. Return the value exactly.
return turnvalue; return turnvalue;
} }
if (leveltime < introtime) if (leveltime < introtime)
{ {
return 0; // No turning during the intro
}
if (player->trickpanel != 0)
{
return 0; return 0;
} }
if (player->respawn.state == RESPAWNST_MOVE) if (player->respawn.state == RESPAWNST_MOVE)
{ {
// No turning during respawn
return 0;
}
if (player->trickpanel != 0)
{
// No turning during trick panel
return 0; return 0;
} }
currentSpeed = FixedHypot(player->mo->momx, player->mo->momy); currentSpeed = FixedHypot(player->mo->momx, player->mo->momy);
if ((currentSpeed <= 0) // Not moving if ((currentSpeed <= 0) // Not moving
&& ((K_GetKartButtons(player) & BT_EBRAKEMASK) != BT_EBRAKEMASK) // not e-braking && ((K_GetKartButtons(player) & BT_EBRAKEMASK) != BT_EBRAKEMASK) // Not e-braking
&& (player->respawn.state == RESPAWNST_NONE)) // Not respawning && (player->respawn.state == RESPAWNST_NONE) // Not respawning
&& (P_IsObjectOnGround(player->mo) == true)) // On the ground
{ {
return 0; return 0;
} }