Bot friction amount is based on their speed

Similar to !1814 but it is eased into.
This commit is contained in:
Sally Coolatta 2024-01-17 14:19:37 -05:00 committed by AJ Martinez
parent 68ee84168c
commit b8e3ac465e

View file

@ -11758,17 +11758,19 @@ fixed_t K_PlayerBaseFriction(const player_t *player, fixed_t original)
}
else if (K_PlayerUsesBotMovement(player) == true)
{
const fixed_t speedPercent = min(FRACUNIT, FixedDiv(player->speed, K_GetKartSpeed(player, false, false)));
const fixed_t extraFriction = FixedMul(FixedMul(FRACUNIT >> 5, factor), speedPercent);
// A bit extra friction to help them without drifting.
// Remove this line once they can drift.
frict -= FixedMul(FRACUNIT >> 5, factor);
frict -= extraFriction;
// Bots gain more traction as they rubberband.
fixed_t traction_value = FixedMul(player->botvars.rubberband, max(FRACUNIT, K_BotMapModifier()));
const fixed_t traction_value = FixedMul(player->botvars.rubberband, max(FRACUNIT, K_BotMapModifier()));
if (traction_value > FRACUNIT)
{
const fixed_t extraFriction = FixedMul(FRACUNIT >> 5, factor);
const fixed_t mul = traction_value - FRACUNIT;
frict -= FixedMul(extraFriction, mul);
const fixed_t traction_mul = traction_value - FRACUNIT;
frict -= FixedMul(extraFriction, traction_mul);
}
}
}