Merge branch 'recovery' into 'master'

Metabolism for light weights

See merge request KartKrew/Kart!302
This commit is contained in:
Sal 2020-07-23 02:46:55 -04:00
commit c30e6a994c

View file

@ -2028,9 +2028,17 @@ static fixed_t K_FlameShieldDashVar(INT32 val)
return (3*FRACUNIT/4) + (((val * FRACUNIT) / TICRATE) / 2);
}
// Light weights have stronger boost stacking -- aka, better metabolism than heavies XD
#define METABOLISM
// sets k_boostpower, k_speedboost, and k_accelboost to whatever we need it to be
static void K_GetKartBoostPower(player_t *player)
{
#ifdef METABOLISM
const fixed_t maxmetabolismincrease = FRACUNIT/2;
const fixed_t metabolism = FRACUNIT - ((9-player->kartweight) * maxmetabolismincrease / 8);
#endif // METABOLISM
fixed_t boostpower = FRACUNIT;
fixed_t speedboost = 0, accelboost = 0;
UINT8 numboosts = 0;
@ -2048,12 +2056,24 @@ static void K_GetKartBoostPower(player_t *player)
if (player->kartstuff[k_bananadrag] > TICRATE)
boostpower = (4*boostpower)/5;
#ifdef METABOLISM
#define ADDBOOST(s,a) { \
numboosts++; \
speedboost += (s) / numboosts; \
accelboost += (a) / numboosts; \
speedboost += FixedDiv(s, FRACUNIT + (metabolism * numboosts-1)); \
accelboost += FixedDiv(a, FRACUNIT + (metabolism * numboosts-1)); \
}
#else
#define ADDBOOST(s,a) { \
numboosts++; \
speedboost += s / numboosts; \
accelboost += a / numboosts; \
}
#endif // METABOLISM
if (player->kartstuff[k_sneakertimer]) // Sneaker
{
UINT8 i;
@ -2198,11 +2218,11 @@ UINT16 K_GetKartFlashing(player_t *player)
if (!player)
return tics;
tics += (tics/8) * (player->kartspeed);
if (G_BattleGametype())
tics *= 2;
tics += (flashingtics/8) * (player->kartspeed);
return tics;
}