Merge branch 'fix-sliptide-extension' into 'master'

Fix sliptide extensions activating out of fast drifts

See merge request KartKrew/Kart!1971
This commit is contained in:
AJ Martinez 2024-03-02 07:57:09 +00:00
commit 75adf359cb
4 changed files with 22 additions and 10 deletions

View file

@ -696,6 +696,7 @@ struct player_t
UINT8 gateSound; // Sound effect combo
SINT8 aizdriftstrat; // (-1 to 1) - Let go of your drift while boosting? Helper for the SICK STRATZ (sliptiding!) you have just unlocked
SINT8 aizdriftextend; // Nonzero when you were sliptiding last tic, sign indicates direction.
INT32 aizdrifttilt;
INT32 aizdriftturn;

View file

@ -10538,20 +10538,21 @@ static void K_KartDrift(player_t *player, boolean onground)
// No longer meet the conditions to sliptide?
// We'll spot you the sliptide as long as you keep turning, but no charging wavedashes.
boolean keepsliptide = false;
boolean extendedSliptide = false;
// We don't meet sliptide conditions!
if ((player->handleboost < (SLIPTIDEHANDLING/2))
|| (!player->steering)
|| (!player->aizdriftstrat)
|| (player->steering > 0) != (player->aizdriftstrat > 0))
{
if (!player->drift && player->steering && player->aizdriftstrat && player->wavedash // If we were sliptiding last tic,
&& (player->steering > 0) == (player->aizdriftstrat > 0) // we're steering in the right direction,
if (!player->drift && player->steering && player->aizdriftextend // If we were sliptiding last tic,
&& (player->steering > 0) == (player->aizdriftextend > 0) // we're steering in the right direction,
&& player->speed >= K_GetKartSpeed(player, false, true)) // and we're above the threshold to spawn dust...
{
keepsliptide = true; // Then keep your current sliptide, but note the behavior change for wavedash handling.
extendedSliptide = true; // Then keep your current sliptide, but note the behavior change for wavedash handling.
}
else
else // Otherwise, update sliptide status as usual.
{
if (!player->drift)
player->aizdriftstrat = 0;
@ -10563,16 +10564,22 @@ static void K_KartDrift(player_t *player, boolean onground)
if (player->airtime > 2) // Arbitrary number. Small discontinuities due to Super Jank shouldn't thrash your handling properties.
{
player->aizdriftstrat = 0;
keepsliptide = false;
extendedSliptide = false;
}
// If we're sliptiding, whether through an extension or otherwise, allow sliptide extensions next tic.
if (K_Sliptiding(player))
player->aizdriftextend = player->aizdriftstrat;
else
player->aizdriftextend = 0;
if ((player->aizdriftstrat && !player->drift)
|| (keepsliptide))
|| (extendedSliptide))
{
K_SpawnAIZDust(player);
if (!keepsliptide)
if (!extendedSliptide)
{
// Give charge proportional to your angle. Sharp turns are rewarding, slow analog slides are not—remember, this is giving back the speed you gave up.
UINT16 addCharge = FixedInt(
@ -10610,9 +10617,9 @@ static void K_KartDrift(player_t *player, boolean onground)
player->aizdriftstrat = 0;
*/
if (!K_Sliptiding(player) || keepsliptide)
if (!K_Sliptiding(player) || extendedSliptide)
{
if (!keepsliptide && K_IsLosingWavedash(player) && player->wavedash > 0)
if (!extendedSliptide && K_IsLosingWavedash(player) && player->wavedash > 0)
{
if (player->wavedash > HIDEWAVEDASHCHARGE && !S_SoundPlaying(player->mo, sfx_waved2))
S_StartSoundAtVolume(player->mo, sfx_waved2, 255); // Losing combo time, going to boost

View file

@ -287,6 +287,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->gateSound);
else if (fastcmp(field,"aizdriftstraft"))
lua_pushinteger(L, plr->aizdriftstrat);
else if (fastcmp(field,"aizdriftextend"))
lua_pushinteger(L, plr->aizdriftextend);
else if (fastcmp(field,"aizdrifttilt"))
lua_pushinteger(L, plr->aizdrifttilt);
else if (fastcmp(field,"aizdriftturn"))

View file

@ -443,6 +443,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT8(save->p, players[i].gateSound);
WRITESINT8(save->p, players[i].aizdriftstrat);
WRITESINT8(save->p, players[i].aizdriftextend);
WRITEINT32(save->p, players[i].aizdrifttilt);
WRITEINT32(save->p, players[i].aizdriftturn);
@ -1025,6 +1026,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].gateSound = READUINT8(save->p);
players[i].aizdriftstrat = READSINT8(save->p);
players[i].aizdriftextend = READSINT8(save->p);
players[i].aizdrifttilt = READINT32(save->p);
players[i].aizdriftturn = READINT32(save->p);