Scale wavedash boost power to initial charge, not to remaining boost

This commit is contained in:
AJ Martinez 2024-03-01 16:41:35 -07:00
parent dcf9d37c8e
commit 19c62d37b9
4 changed files with 31 additions and 5 deletions

View file

@ -945,6 +945,7 @@ struct player_t
UINT16 wavedash; // How long is our chained sliptide? Grant a proportional boost when it's over.
UINT8 wavedashdelay; // How long since the last sliptide? Only boost once you've been straightened out for a bit.
UINT16 wavedashboost; // The actual boost granted from wavedash.
fixed_t lastwavedash; // Is this a bullshit "tap" wavedash? Weaken lower-charge wavedashes while keeping long sliptides fully rewarding.
UINT16 speedpunt;

View file

@ -3322,13 +3322,19 @@ static void K_GetKartBoostPower(player_t *player)
if (player->wavedashboost)
{
// NB: This is intentionally under the 25% handleboost threshold required to initiate a sliptide
ADDBOOST(8*FRACUNIT/10,
ADDBOOST(
Easing_InCubic(
player->lastwavedash,
0,
8*FRACUNIT/10
),
Easing_InSine(
min(FRACUNIT, player->wavedashboost * FRACUNIT / 15),
player->lastwavedash,
0,
4*FRACUNIT
),
2*SLIPTIDEHANDLING/5); // + 80% top speed, +400% acceleration (peak), +20% handling
2*SLIPTIDEHANDLING/5
); // + 80% top speed (peak), +400% acceleration (peak), +20% handling
}
if (player->spindashboost) // Spindash boost
@ -8669,6 +8675,14 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
player->wavedashboost--;
}
if (player->wavedashboost == 0 || player->lastwavedash > FRACUNIT)
{
player->lastwavedash = FRACUNIT;
// lastwavedash is for nerfing tap wavedashes: when other parts of the code
// want to award wavedashboost, let them do that without unexpected side
// effects based on the last recorded wavedash. They can set this on their own!
}
if (player->speedpunt)
player->speedpunt--;
@ -10639,15 +10653,20 @@ static void K_KartDrift(player_t *player, boolean onground)
fixed_t yourPower = maxZipPower - FixedMul(yourPowerReduction, powerSpread);
int yourBoost = FixedInt(FixedMul(yourPower, player->wavedash/10 * FRACUNIT));
// Award boost.
player->wavedashboost += yourBoost;
// Set power of the resulting boost.
player->lastwavedash = min(FRACUNIT, FRACUNIT * player->wavedash / MIN_WAVEDASH_CHARGE);
// Scale boost sound to power.
S_StartSoundAtVolume(player->mo, sfx_waved3,
Easing_InSine(
min(FRACUNIT, player->wavedash * FRACUNIT / MIN_WAVEDASH_CHARGE),
player->lastwavedash,
120,
255
)
); // Boost
);
K_SpawnDriftBoostExplosion(player, 0);
}

View file

@ -343,6 +343,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->wavedashdelay);
else if (fastcmp(field,"wavedashboost"))
lua_pushinteger(L, plr->wavedashboost);
else if (fastcmp(field,"lastwavedash"))
lua_pushinteger(L, plr->lastwavedash);
else if (fastcmp(field,"speedpunt"))
lua_pushinteger(L, plr->speedpunt);
else if (fastcmp(field,"trickcharge"))
@ -879,6 +881,8 @@ static int player_set(lua_State *L)
plr->wavedashdelay = luaL_checkinteger(L, 3);
else if (fastcmp(field,"wavedashboost"))
plr->wavedashboost = luaL_checkinteger(L, 3);
else if (fastcmp(field,"lastwavedash"))
plr->lastwavedash = luaL_checkinteger(L, 3);
else if (fastcmp(field,"speedpunt"))
plr->speedpunt = luaL_checkinteger(L, 3);
else if (fastcmp(field,"trickcharge"))

View file

@ -565,6 +565,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT16(save->p, players[i].wavedash);
WRITEUINT8(save->p, players[i].wavedashdelay);
WRITEUINT16(save->p, players[i].wavedashboost);
WRITEFIXED(save->p, players[i].lastwavedash);
WRITEUINT16(save->p, players[i].speedpunt);
WRITEUINT16(save->p, players[i].trickcharge);
@ -1147,6 +1148,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].wavedash = READUINT16(save->p);
players[i].wavedashdelay = READUINT8(save->p);
players[i].wavedashboost = READUINT16(save->p);
players[i].lastwavedash = READFIXED(save->p);
players[i].speedpunt = READUINT16(save->p);
players[i].trickcharge = READUINT16(save->p);