Add back rubberband friction and speed friction

This commit is contained in:
Antonio Martinez 2025-06-03 13:00:47 -04:00
parent 926a95f117
commit 0cb1f7bc41

View file

@ -13017,13 +13017,14 @@ 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);
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 -= extraFriction;
frict -= extraFriction;
// If bots are moving in the wrong direction relative to where they want to look, add some extra grip.
angle_t MAXERROR = 45*ANG1;
fixed_t errorfrict = Easing_Linear(min(FRACUNIT, FixedDiv(player->botvars.predictionError, MAXERROR)), 0, FRACUNIT>>2);
@ -13036,15 +13037,14 @@ fixed_t K_PlayerBaseFriction(const player_t *player, fixed_t original)
}
errorfrict = min(errorfrict, frict/4);
frict -= errorfrict;
// Bots gain more traction as they rubberband.
const fixed_t traction_value = FixedMul(player->botvars.rubberband, max(FRACUNIT, K_BotMapModifier()));
if (traction_value > FRACUNIT)
{
//const fixed_t traction_mul = traction_value - FRACUNIT;
// frict -= FixedMul(extraFriction, traction_mul);
const fixed_t traction_mul = traction_value - FRACUNIT;
frict -= FixedMul(extraFriction, traction_mul);
}
}
}