mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Fix bots + friction
This commit is contained in:
parent
bc75f935e3
commit
aefff1c943
1 changed files with 21 additions and 12 deletions
33
src/k_bot.c
33
src/k_bot.c
|
|
@ -474,8 +474,7 @@ fixed_t K_BotTopSpeedRubberband(player_t *player)
|
||||||
fixed_t K_BotFrictionRubberband(player_t *player, fixed_t frict)
|
fixed_t K_BotFrictionRubberband(player_t *player, fixed_t frict)
|
||||||
{
|
{
|
||||||
fixed_t rubberband = K_BotRubberband(player) - FRACUNIT;
|
fixed_t rubberband = K_BotRubberband(player) - FRACUNIT;
|
||||||
fixed_t newfrict;
|
fixed_t origFrict, newFrict;
|
||||||
fixed_t frictionRatio;
|
|
||||||
|
|
||||||
if (rubberband <= 0)
|
if (rubberband <= 0)
|
||||||
{
|
{
|
||||||
|
|
@ -483,21 +482,31 @@ fixed_t K_BotFrictionRubberband(player_t *player, fixed_t frict)
|
||||||
return frict;
|
return frict;
|
||||||
}
|
}
|
||||||
|
|
||||||
newfrict = FixedDiv(ORIG_FRICTION, FRACUNIT + (rubberband / 2));
|
origFrict = FixedDiv(ORIG_FRICTION, FRACUNIT + (rubberband / 2));
|
||||||
|
|
||||||
if (frict != ORIG_FRICTION)
|
if (frict == ORIG_FRICTION)
|
||||||
{
|
{
|
||||||
// Adjust for non-ORIG_FRICTION values
|
newFrict = origFrict;
|
||||||
frictionRatio = FixedDiv(frict, ORIG_FRICTION);
|
}
|
||||||
newfrict = FixedMul(newfrict, frictionRatio);
|
else
|
||||||
|
{
|
||||||
|
// Do some mumbo jumbo to make our friction value
|
||||||
|
// relative to what it WOULD be for ORIG_FRICTION.
|
||||||
|
// (I hate multiplicative friction :/)
|
||||||
|
|
||||||
|
fixed_t offset = ORIG_FRICTION - frict;
|
||||||
|
fixed_t ratio = FixedDiv(frict, ORIG_FRICTION);
|
||||||
|
|
||||||
|
offset = FixedDiv(offset, ratio);
|
||||||
|
newFrict = frict + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newfrict < 0)
|
if (newFrict < 0)
|
||||||
newfrict = 0;
|
newFrict = 0;
|
||||||
if (newfrict > FRACUNIT)
|
if (newFrict > FRACUNIT)
|
||||||
newfrict = FRACUNIT;
|
newFrict = FRACUNIT;
|
||||||
|
|
||||||
return newfrict;
|
return newFrict;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------
|
/*--------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue