mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Fix fast fall preventing stumble
This commit is contained in:
parent
12475dc434
commit
3f66a8e72f
3 changed files with 50 additions and 27 deletions
63
src/k_kart.c
63
src/k_kart.c
|
|
@ -3865,6 +3865,8 @@ boolean K_CheckStumble(player_t *player, angle_t oldPitch, angle_t oldRoll, bool
|
|||
// Oh jeez, you landed on your side.
|
||||
// You get to tumble.
|
||||
|
||||
P_ResetPlayer(player);
|
||||
|
||||
#if 0
|
||||
// Single, medium bounce
|
||||
player->tumbleBounces = TUMBLEBOUNCES;
|
||||
|
|
@ -9568,31 +9570,7 @@ static void K_KartSpindash(player_t *player)
|
|||
}
|
||||
else if (player->fastfall != 0)
|
||||
{
|
||||
// Handle fastfall bounce.
|
||||
const fixed_t maxBounce = player->mo->scale * 10;
|
||||
const fixed_t minBounce = player->mo->scale;
|
||||
fixed_t bounce = 2 * abs(player->fastfall) / 3;
|
||||
|
||||
if (bounce > maxBounce)
|
||||
{
|
||||
bounce = maxBounce;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Lose speed on bad bounce.
|
||||
player->mo->momx /= 2;
|
||||
player->mo->momy /= 2;
|
||||
|
||||
if (bounce < minBounce)
|
||||
{
|
||||
bounce = minBounce;
|
||||
}
|
||||
}
|
||||
|
||||
S_StartSound(player->mo, sfx_ffbonc);
|
||||
player->mo->momz = bounce * P_MobjFlip(player->mo);
|
||||
|
||||
player->fastfall = 0;
|
||||
// Still handling fast-fall bounce.
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -9659,6 +9637,41 @@ static void K_KartSpindash(player_t *player)
|
|||
|
||||
#undef SPINDASHTHRUSTTIME
|
||||
|
||||
boolean K_FastFallBounce(player_t *player)
|
||||
{
|
||||
// Handle fastfall bounce.
|
||||
if (player->fastfall != 0)
|
||||
{
|
||||
const fixed_t maxBounce = player->mo->scale * 10;
|
||||
const fixed_t minBounce = player->mo->scale;
|
||||
fixed_t bounce = 2 * abs(player->fastfall) / 3;
|
||||
|
||||
if (bounce > maxBounce)
|
||||
{
|
||||
bounce = maxBounce;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Lose speed on bad bounce.
|
||||
player->mo->momx /= 2;
|
||||
player->mo->momy /= 2;
|
||||
|
||||
if (bounce < minBounce)
|
||||
{
|
||||
bounce = minBounce;
|
||||
}
|
||||
}
|
||||
|
||||
S_StartSound(player->mo, sfx_ffbonc);
|
||||
player->mo->momz = bounce * P_MobjFlip(player->mo);
|
||||
|
||||
player->fastfall = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void K_AirFailsafe(player_t *player)
|
||||
{
|
||||
const fixed_t maxSpeed = 6*player->mo->scale;
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@ fixed_t K_GetNewSpeed(player_t *player);
|
|||
fixed_t K_3dKartMovement(player_t *player);
|
||||
boolean K_PlayerEBrake(player_t *player);
|
||||
SINT8 K_Sliptiding(player_t *player);
|
||||
boolean K_FastFallBounce(player_t *player);
|
||||
void K_AdjustPlayerFriction(player_t *player);
|
||||
void K_MoveKartPlayer(player_t *player, boolean onground);
|
||||
void K_CheckSpectateStatus(void);
|
||||
|
|
|
|||
13
src/p_user.c
13
src/p_user.c
|
|
@ -1354,15 +1354,24 @@ boolean P_PlayerHitFloor(player_t *player, boolean fromAir, angle_t oldPitch, an
|
|||
K_SpawnSplashForMobj(player->mo, abs(player->mo->momz));
|
||||
}
|
||||
|
||||
if (player->mo->health)
|
||||
if (player->mo->health > 0)
|
||||
{
|
||||
boolean air = fromAir;
|
||||
|
||||
if (P_IsObjectOnGround(player->mo) && (player->mo->eflags & MFE_JUSTHITFLOOR))
|
||||
{
|
||||
air = true;
|
||||
}
|
||||
|
||||
if (K_CheckStumble(player, oldPitch, oldRoll, air))
|
||||
if (K_CheckStumble(player, oldPitch, oldRoll, air) == true)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (air == false && K_FastFallBounce(player) == true)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue