From dcf9d37c8ee1117312769e1d018571d56d30811b Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Fri, 1 Mar 2024 16:18:07 -0700 Subject: [PATCH 1/3] Grant a (weak) boost even for low-charge wavedash attempts --- src/k_kart.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 0444d3c11..0c02c7dc3 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3322,7 +3322,13 @@ 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, 4*FRACUNIT, 2*SLIPTIDEHANDLING/5); // + 80% top speed, + 400% acceleration, +20% handling + ADDBOOST(8*FRACUNIT/10, + Easing_InSine( + min(FRACUNIT, player->wavedashboost * FRACUNIT / 15), + 0, + 4*FRACUNIT + ), + 2*SLIPTIDEHANDLING/5); // + 80% top speed, +400% acceleration (peak), +20% handling } if (player->spindashboost) // Spindash boost @@ -10616,7 +10622,7 @@ static void K_KartDrift(player_t *player, boolean onground) player->wavedashdelay++; if (player->wavedashdelay > TICRATE/2) { - if (player->wavedash >= MIN_WAVEDASH_CHARGE) + if (player->wavedash > HIDEWAVEDASHCHARGE) { fixed_t maxZipPower = 2*FRACUNIT; fixed_t minZipPower = 1*FRACUNIT; @@ -10635,7 +10641,13 @@ static void K_KartDrift(player_t *player, boolean onground) player->wavedashboost += yourBoost; - S_StartSoundAtVolume(player->mo, sfx_waved3, 255); // Boost + S_StartSoundAtVolume(player->mo, sfx_waved3, + Easing_InSine( + min(FRACUNIT, player->wavedash * FRACUNIT / MIN_WAVEDASH_CHARGE), + 120, + 255 + ) + ); // Boost K_SpawnDriftBoostExplosion(player, 0); } From 19c62d37b900ec3ced2cc9384cf787e75f0783ae Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Fri, 1 Mar 2024 16:41:35 -0700 Subject: [PATCH 2/3] Scale wavedash boost power to initial charge, not to remaining boost --- src/d_player.h | 1 + src/k_kart.c | 29 ++++++++++++++++++++++++----- src/lua_playerlib.c | 4 ++++ src/p_saveg.c | 2 ++ 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 9659340ed..81db794c7 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -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; diff --git a/src/k_kart.c b/src/k_kart.c index 0c02c7dc3..d32f35ca4 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -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); } diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index fbd93153a..201e52e59 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -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")) diff --git a/src/p_saveg.c b/src/p_saveg.c index 8a423f5ec..8e249c9b7 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -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); From af06d575fd7d3769b23d4876738caa79fdda5fe1 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Fri, 1 Mar 2024 17:18:42 -0700 Subject: [PATCH 3/3] Set wavedash power everywhere wavedashboost is directly awarded, increase threshold --- src/d_player.h | 2 +- src/k_kart.c | 19 +++++++++---------- src/lua_playerlib.c | 8 ++++---- src/p_saveg.c | 4 ++-- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 81db794c7..cb1dd141d 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -945,7 +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. + fixed_t wavedashpower; // Is this a bullshit "tap" wavedash? Weaken lower-charge wavedashes while keeping long sliptides fully rewarding. UINT16 speedpunt; diff --git a/src/k_kart.c b/src/k_kart.c index d32f35ca4..2f6625794 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3324,12 +3324,12 @@ static void K_GetKartBoostPower(player_t *player) // NB: This is intentionally under the 25% handleboost threshold required to initiate a sliptide ADDBOOST( Easing_InCubic( - player->lastwavedash, + player->wavedashpower, 0, 8*FRACUNIT/10 ), Easing_InSine( - player->lastwavedash, + player->wavedashpower, 0, 4*FRACUNIT ), @@ -4425,7 +4425,7 @@ void K_UpdateStumbleIndicator(player_t *player) } } -#define MIN_WAVEDASH_CHARGE ((7*TICRATE/16)*9) +#define MIN_WAVEDASH_CHARGE ((11*TICRATE/16)*9) static boolean K_IsLosingWavedash(player_t *player) { @@ -8675,12 +8675,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) player->wavedashboost--; } - if (player->wavedashboost == 0 || player->lastwavedash > FRACUNIT) + if (player->wavedashboost == 0 || player->wavedashpower > 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! + player->wavedashpower = FRACUNIT; // Safety } if (player->speedpunt) @@ -10398,6 +10395,7 @@ static void K_KartDrift(player_t *player, boolean onground) { player->driftboost += 20; player->wavedashboost += 10; + player->wavedashpower = FRACUNIT; P_Thrust(player->mo, pushdir, player->speed / 2); S_StartSound(player->mo, sfx_gshba); player->trickcharge = 0; @@ -10657,12 +10655,12 @@ static void K_KartDrift(player_t *player, boolean onground) player->wavedashboost += yourBoost; // Set power of the resulting boost. - player->lastwavedash = min(FRACUNIT, FRACUNIT * player->wavedash / MIN_WAVEDASH_CHARGE); + player->wavedashpower = min(FRACUNIT, FRACUNIT * player->wavedash / MIN_WAVEDASH_CHARGE); // Scale boost sound to power. S_StartSoundAtVolume(player->mo, sfx_waved3, Easing_InSine( - player->lastwavedash, + player->wavedashpower, 120, 255 ) @@ -12563,6 +12561,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { P_InstaThrust(player->mo, player->mo->angle, player->speed + (80 * mapobjectscale)); player->wavedashboost += TICRATE; // Just for keeping speed briefly vs. tripwire etc. + player->wavedashpower = FRACUNIT; // If this doesn't turn out to be reliable, I'll change it to directly set leniency or something. } K_PlayAttackTaunt(player->mo); diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 201e52e59..e591ea825 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -343,8 +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,"wavedashpower")) + lua_pushinteger(L, plr->wavedashpower); else if (fastcmp(field,"speedpunt")) lua_pushinteger(L, plr->speedpunt); else if (fastcmp(field,"trickcharge")) @@ -881,8 +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,"wavedashpower")) + plr->wavedashpower = luaL_checkinteger(L, 3); else if (fastcmp(field,"speedpunt")) plr->speedpunt = luaL_checkinteger(L, 3); else if (fastcmp(field,"trickcharge")) diff --git a/src/p_saveg.c b/src/p_saveg.c index 8e249c9b7..d7eeb976d 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -565,7 +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); + WRITEFIXED(save->p, players[i].wavedashpower); WRITEUINT16(save->p, players[i].speedpunt); WRITEUINT16(save->p, players[i].trickcharge); @@ -1148,7 +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].wavedashpower = READFIXED(save->p); players[i].speedpunt = READUINT16(save->p); players[i].trickcharge = READUINT16(save->p);