mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'alt-drift-math-fix' into 'master'
drift math fixes See merge request kart-krew-dev/ring-racers-internal!2520
This commit is contained in:
commit
27b6832e7b
1 changed files with 14 additions and 5 deletions
19
src/k_kart.c
19
src/k_kart.c
|
|
@ -3663,27 +3663,28 @@ static void K_GetKartBoostPower(player_t *player)
|
|||
// Trying to emulate the old leniency timer being stat-based.
|
||||
// I dunno if this is overkill because turning is already stat-based.
|
||||
// Should this be a pure constant instead?
|
||||
const INT16 max_steer_threshold = (KART_FULLTURN * 5) / 6;
|
||||
const fixed_t max_steer_threshold = (FRACUNIT * KART_FULLTURN * 5) / 6;
|
||||
|
||||
// Even when not inputting a turn, drift prediction is hard.
|
||||
// Turn solver will sometimes need to slightly turn to stay "aligned".
|
||||
// Award full boost even if turn solver creates a fractional miniturn.
|
||||
const INT16 inner_deadzone = KART_FULLTURN / 100;
|
||||
|
||||
INT32 steer_threshold = FixedMul((FRACUNIT * player->kartweight) / 9, max_steer_threshold);
|
||||
INT16 steer_threshold = FixedMul((FRACUNIT * player->kartweight) / 9, max_steer_threshold)>>FRACBITS;
|
||||
|
||||
INT32 steering = abs(player->steering);
|
||||
INT16 steering = abs(player->steering);
|
||||
steering = max(steering - inner_deadzone, 0);
|
||||
|
||||
fixed_t frac = 0;
|
||||
if (steering < steer_threshold)
|
||||
{
|
||||
frac = FixedDiv(steer_threshold - steering, steer_threshold);
|
||||
frac = FixedDiv(FRACUNIT*(steer_threshold - steering), FRACUNIT*(steer_threshold));
|
||||
}
|
||||
|
||||
// Weaken the effect with drifts that were just started.
|
||||
frac = (frac * abs(player->drift)) / 5;
|
||||
|
||||
fixed_t multiplier = 0;
|
||||
if (frac > 0)
|
||||
{
|
||||
if (frac > FRACUNIT)
|
||||
|
|
@ -3694,7 +3695,7 @@ static void K_GetKartBoostPower(player_t *player)
|
|||
|
||||
// Get multiplier from easing function, to
|
||||
// heavily reward being near exactly 0.
|
||||
fixed_t multiplier = Easing_InExpo(frac, 0, FRACUNIT);
|
||||
multiplier = Easing_InExpo(frac, 0, FRACUNIT);
|
||||
if (multiplier > 0)
|
||||
{
|
||||
ADDBOOST(
|
||||
|
|
@ -3705,6 +3706,14 @@ static void K_GetKartBoostPower(player_t *player)
|
|||
numboosts--; // No afterimage!
|
||||
}
|
||||
}
|
||||
|
||||
// Debug print for neutral drift
|
||||
// CONS_Printf("Drift debug: %d/%d = %f (speed +%.0f%%, accel +%.0f%%)\n",
|
||||
// steering,
|
||||
// steer_threshold,
|
||||
// FIXED_TO_FLOAT(frac),
|
||||
// FIXED_TO_FLOAT(FixedMul(multiplier, 4*FRACUNIT/10)*100),
|
||||
// FIXED_TO_FLOAT(FixedMul(multiplier, FRACUNIT/3)*100));
|
||||
}
|
||||
|
||||
if (player->trickcharge)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue