diff --git a/src/k_kart.c b/src/k_kart.c index 3231f47cd..44e57bb25 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3453,7 +3453,7 @@ fixed_t K_GetNewSpeed(player_t *player) // Don't calculate the acceleration as ever being above top speed if (oldspeed > p_speed) oldspeed = p_speed; - newspeed = FixedDiv(FixedDiv(FixedMul(oldspeed, accelmax - p_accel) + FixedMul(p_speed, p_accel), accelmax), K_PlayerBaseFriction(ORIG_FRICTION)); + newspeed = FixedDiv(FixedDiv(FixedMul(oldspeed, accelmax - p_accel) + FixedMul(p_speed, p_accel), accelmax), K_PlayerBaseFriction(player, ORIG_FRICTION)); finalspeed = newspeed - oldspeed; @@ -10014,7 +10014,7 @@ static void K_AirFailsafe(player_t *player) // // K_PlayerBaseFriction // -fixed_t K_PlayerBaseFriction(fixed_t original) +fixed_t K_PlayerBaseFriction(player_t *player, fixed_t original) { fixed_t frict = original; @@ -10022,6 +10022,20 @@ fixed_t K_PlayerBaseFriction(fixed_t original) { frict -= FRACUNIT >> 4; } + else if (K_PlayerUsesBotMovement(player) == true) + { + // A bit extra friction to help them without drifting. + // Remove this line once they can drift. + frict -= FRACUNIT >> 5; + + // Bots gain more traction as they rubberband. + if (player->botvars.rubberband > FRACUNIT) + { + static const fixed_t extraFriction = FRACUNIT >> 5; + const fixed_t mul = player->botvars.rubberband - FRACUNIT; + frict -= FixedMul(extraFriction, mul); + } + } if (frict > FRACUNIT) { frict = FRACUNIT; } if (frict < 0) { frict = 0; } @@ -10034,7 +10048,7 @@ fixed_t K_PlayerBaseFriction(fixed_t original) // void K_AdjustPlayerFriction(player_t *player) { - const fixed_t prevfriction = K_PlayerBaseFriction(player->mo->friction); + const fixed_t prevfriction = K_PlayerBaseFriction(player, player->mo->friction); if (P_IsObjectOnGround(player->mo) == false) { diff --git a/src/k_kart.h b/src/k_kart.h index fc364624a..70ab93998 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -177,7 +177,7 @@ 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); -fixed_t K_PlayerBaseFriction(fixed_t original); +fixed_t K_PlayerBaseFriction(player_t *player, fixed_t original); void K_AdjustPlayerFriction(player_t *player); void K_MoveKartPlayer(player_t *player, boolean onground); void K_CheckSpectateStatus(void);