mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Fixed math oopsie
This commit is contained in:
parent
e7f0c1e79e
commit
33ff42af1f
1 changed files with 5 additions and 13 deletions
18
src/k_kart.c
18
src/k_kart.c
|
|
@ -15244,20 +15244,12 @@ UINT16 K_GetDisplayEXP(player_t *player)
|
|||
if (!numgradingpoints)
|
||||
return UINT16_MAX;
|
||||
|
||||
fixed_t result = max(player->exp, FRACUNIT/2);
|
||||
result = FixedMul(result, (500/numgradingpoints)*player->gradingpointnum);
|
||||
// target is where you should be if you're doing good and at a 1.0 mult
|
||||
fixed_t clampedexp = max(FRACUNIT/2, min(FRACUNIT*7/5, player->exp)); // clamp between 0.5 and 1.4
|
||||
fixed_t targetdisplayexp = (500*player->gradingpointnum/numgradingpoints)<<FRACBITS;
|
||||
UINT16 displayexp = FixedMul(clampedexp, targetdisplayexp)>>FRACBITS;
|
||||
|
||||
// bro where is. bro where is std::clamp
|
||||
if (result < 0)
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
else if (result > 999)
|
||||
{
|
||||
result = 999;
|
||||
}
|
||||
|
||||
return result;
|
||||
return displayexp;
|
||||
}
|
||||
|
||||
UINT32 K_GetNumGradingPoints(void)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue