mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Don't scale tumble height with tumble gravity
It was taking into account the tumble gravity, which meant that tumble has been actually lasting for much longer than originally designed.
This commit is contained in:
parent
f8b82bd28f
commit
7a3a74a08b
3 changed files with 21 additions and 23 deletions
|
|
@ -258,6 +258,7 @@ typedef enum
|
|||
#define TRICKDELAY (TICRATE/4)
|
||||
|
||||
#define TUMBLEBOUNCES 3
|
||||
#define TUMBLEGRAVITY (5*FRACUNIT/2)
|
||||
|
||||
//}
|
||||
|
||||
|
|
|
|||
41
src/k_kart.c
41
src/k_kart.c
|
|
@ -3612,9 +3612,25 @@ static void K_RemoveGrowShrink(player_t *player)
|
|||
P_RestoreMusic(player);
|
||||
}
|
||||
|
||||
static fixed_t K_TumbleZ(mobj_t *mo, fixed_t input)
|
||||
{
|
||||
// Scales base tumble gravity to FRACUNIT
|
||||
const fixed_t baseGravity = FixedMul(DEFAULT_GRAVITY, TUMBLEGRAVITY);
|
||||
|
||||
// Adapt momz w/ gravity
|
||||
fixed_t gravityAdjust = FixedDiv(P_GetMobjGravity(mo), baseGravity);
|
||||
|
||||
if (mo->eflags & MFE_UNDERWATER)
|
||||
{
|
||||
// Reverse doubled falling speed.
|
||||
gravityAdjust /= 2;
|
||||
}
|
||||
|
||||
return FixedMul(input, -gravityAdjust);
|
||||
}
|
||||
|
||||
void K_TumblePlayer(player_t *player, mobj_t *inflictor, mobj_t *source)
|
||||
{
|
||||
fixed_t gravityadjust;
|
||||
(void)source;
|
||||
|
||||
K_DirectorFollowAttack(player, inflictor, source);
|
||||
|
|
@ -3643,16 +3659,7 @@ void K_TumblePlayer(player_t *player, mobj_t *inflictor, mobj_t *source)
|
|||
|
||||
S_StartSound(player->mo, sfx_s3k9b);
|
||||
|
||||
// adapt momz w/ gravity?
|
||||
// as far as kart goes normal gravity is 2 (FRACUNIT*2)
|
||||
|
||||
gravityadjust = P_GetMobjGravity(player->mo)/2; // so we'll halve it for our calculations.
|
||||
|
||||
if (player->mo->eflags & MFE_UNDERWATER)
|
||||
gravityadjust /= 2; // halve "gravity" underwater
|
||||
|
||||
// and then modulate momz like that...
|
||||
player->mo->momz = -gravityadjust * player->tumbleHeight;
|
||||
player->mo->momz = K_TumbleZ(player->mo, player->tumbleHeight * FRACUNIT);
|
||||
|
||||
P_SetPlayerMobjState(player->mo, S_KART_SPINOUT);
|
||||
|
||||
|
|
@ -3667,8 +3674,6 @@ static boolean K_LastTumbleBounceCondition(player_t *player)
|
|||
|
||||
static void K_HandleTumbleBounce(player_t *player)
|
||||
{
|
||||
fixed_t gravityadjust;
|
||||
|
||||
player->tumbleBounces++;
|
||||
player->tumbleHeight = (player->tumbleHeight * ((player->tumbleHeight > 100) ? 3 : 4)) / 5;
|
||||
player->pflags &= ~PF_TUMBLESOUND;
|
||||
|
|
@ -3711,16 +3716,8 @@ static void K_HandleTumbleBounce(player_t *player)
|
|||
player->mo->momx = player->mo->momx / 2;
|
||||
player->mo->momy = player->mo->momy / 2;
|
||||
|
||||
// adapt momz w/ gravity?
|
||||
// as far as kart goes normal gravity is 2 (FRACUNIT*2)
|
||||
|
||||
gravityadjust = P_GetMobjGravity(player->mo)/2; // so we'll halve it for our calculations.
|
||||
|
||||
if (player->mo->eflags & MFE_UNDERWATER)
|
||||
gravityadjust /= 2; // halve "gravity" underwater
|
||||
|
||||
// and then modulate momz like that...
|
||||
player->mo->momz = -gravityadjust * player->tumbleHeight;
|
||||
player->mo->momz = K_TumbleZ(player->mo, player->tumbleHeight * FRACUNIT);
|
||||
}
|
||||
|
||||
// Play a falling sound when you start falling while tumbling and you're nowhere near done bouncing
|
||||
|
|
|
|||
|
|
@ -1130,7 +1130,7 @@ fixed_t P_GetMobjGravity(mobj_t *mo)
|
|||
|
||||
if (mo->player->tumbleBounces > 0)
|
||||
{
|
||||
gravityadd = (5*gravityadd)/2;
|
||||
gravityadd = FixedMul(TUMBLEGRAVITY, gravityadd);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue