Merge branch 'no-wavedash-breakpoint' into 'master'

Award a (weaker) boost for short-charge wavedashes

Closes #612

See merge request KartKrew/Kart!1982
This commit is contained in:
Oni 2024-03-03 02:06:37 +00:00
commit d0a66f9a4e
4 changed files with 41 additions and 4 deletions

View file

@ -947,6 +947,7 @@ struct player_t
UINT16 wavedash; // How long is our chained sliptide? Grant a proportional boost when it's over. 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. 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. UINT16 wavedashboost; // The actual boost granted from wavedash.
fixed_t wavedashpower; // Is this a bullshit "tap" wavedash? Weaken lower-charge wavedashes while keeping long sliptides fully rewarding.
UINT16 speedpunt; UINT16 speedpunt;

View file

@ -3331,7 +3331,19 @@ static void K_GetKartBoostPower(player_t *player)
if (player->wavedashboost) if (player->wavedashboost)
{ {
// NB: This is intentionally under the 25% handleboost threshold required to initiate a sliptide // 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(
Easing_InCubic(
player->wavedashpower,
0,
8*FRACUNIT/10
),
Easing_InSine(
player->wavedashpower,
0,
4*FRACUNIT
),
2*SLIPTIDEHANDLING/5
); // + 80% top speed (peak), +400% acceleration (peak), +20% handling
} }
if (player->spindashboost) // Spindash boost if (player->spindashboost) // Spindash boost
@ -4422,7 +4434,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) static boolean K_IsLosingWavedash(player_t *player)
{ {
@ -8674,6 +8686,11 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
player->wavedashboost--; player->wavedashboost--;
} }
if (player->wavedashboost == 0 || player->wavedashpower > FRACUNIT)
{
player->wavedashpower = FRACUNIT; // Safety
}
if (player->speedpunt) if (player->speedpunt)
player->speedpunt--; player->speedpunt--;
@ -10402,6 +10419,7 @@ static void K_KartDrift(player_t *player, boolean onground)
{ {
player->driftboost += 20; player->driftboost += 20;
player->wavedashboost += 10; player->wavedashboost += 10;
player->wavedashpower = FRACUNIT;
P_Thrust(player->mo, pushdir, player->speed / 2); P_Thrust(player->mo, pushdir, player->speed / 2);
S_StartSound(player->mo, sfx_gshba); S_StartSound(player->mo, sfx_gshba);
player->trickcharge = 0; player->trickcharge = 0;
@ -10647,7 +10665,7 @@ static void K_KartDrift(player_t *player, boolean onground)
player->wavedashdelay++; player->wavedashdelay++;
if (player->wavedashdelay > TICRATE/2) if (player->wavedashdelay > TICRATE/2)
{ {
if (player->wavedash >= MIN_WAVEDASH_CHARGE) if (player->wavedash > HIDEWAVEDASHCHARGE)
{ {
fixed_t maxZipPower = 2*FRACUNIT; fixed_t maxZipPower = 2*FRACUNIT;
fixed_t minZipPower = 1*FRACUNIT; fixed_t minZipPower = 1*FRACUNIT;
@ -10664,9 +10682,20 @@ static void K_KartDrift(player_t *player, boolean onground)
fixed_t yourPower = maxZipPower - FixedMul(yourPowerReduction, powerSpread); fixed_t yourPower = maxZipPower - FixedMul(yourPowerReduction, powerSpread);
int yourBoost = FixedInt(FixedMul(yourPower, player->wavedash/10 * FRACUNIT)); int yourBoost = FixedInt(FixedMul(yourPower, player->wavedash/10 * FRACUNIT));
// Award boost.
player->wavedashboost += yourBoost; player->wavedashboost += yourBoost;
S_StartSoundAtVolume(player->mo, sfx_waved3, 255); // Boost // Set power of the resulting boost.
player->wavedashpower = min(FRACUNIT, FRACUNIT * player->wavedash / MIN_WAVEDASH_CHARGE);
// Scale boost sound to power.
S_StartSoundAtVolume(player->mo, sfx_waved3,
Easing_InSine(
player->wavedashpower,
120,
255
)
);
K_SpawnDriftBoostExplosion(player, 0); K_SpawnDriftBoostExplosion(player, 0);
} }
@ -12563,6 +12592,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
{ {
P_InstaThrust(player->mo, player->mo->angle, player->speed + (80 * mapobjectscale)); P_InstaThrust(player->mo, player->mo->angle, player->speed + (80 * mapobjectscale));
player->wavedashboost += TICRATE; // Just for keeping speed briefly vs. tripwire etc. 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. // If this doesn't turn out to be reliable, I'll change it to directly set leniency or something.
} }
K_PlayAttackTaunt(player->mo); K_PlayAttackTaunt(player->mo);

View file

@ -345,6 +345,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->wavedashdelay); lua_pushinteger(L, plr->wavedashdelay);
else if (fastcmp(field,"wavedashboost")) else if (fastcmp(field,"wavedashboost"))
lua_pushinteger(L, plr->wavedashboost); lua_pushinteger(L, plr->wavedashboost);
else if (fastcmp(field,"wavedashpower"))
lua_pushinteger(L, plr->wavedashpower);
else if (fastcmp(field,"speedpunt")) else if (fastcmp(field,"speedpunt"))
lua_pushinteger(L, plr->speedpunt); lua_pushinteger(L, plr->speedpunt);
else if (fastcmp(field,"trickcharge")) else if (fastcmp(field,"trickcharge"))
@ -883,6 +885,8 @@ static int player_set(lua_State *L)
plr->wavedashdelay = luaL_checkinteger(L, 3); plr->wavedashdelay = luaL_checkinteger(L, 3);
else if (fastcmp(field,"wavedashboost")) else if (fastcmp(field,"wavedashboost"))
plr->wavedashboost = luaL_checkinteger(L, 3); plr->wavedashboost = luaL_checkinteger(L, 3);
else if (fastcmp(field,"wavedashpower"))
plr->wavedashpower = luaL_checkinteger(L, 3);
else if (fastcmp(field,"speedpunt")) else if (fastcmp(field,"speedpunt"))
plr->speedpunt = luaL_checkinteger(L, 3); plr->speedpunt = luaL_checkinteger(L, 3);
else if (fastcmp(field,"trickcharge")) else if (fastcmp(field,"trickcharge"))

View file

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