From 5e4bd6adbb6f35221f4a8671a28dab01dc4df226 Mon Sep 17 00:00:00 2001 From: Ashnal Date: Fri, 25 Jul 2025 08:39:37 -0400 Subject: [PATCH 1/5] bailquake rename to bailhitlag --- src/d_player.h | 2 +- src/k_kart.c | 6 +++--- src/lua_playerlib.c | 8 ++++---- src/p_saveg.cpp | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 3abcaa18b..e73ff2e12 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -1092,7 +1092,7 @@ struct player_t UINT32 bailcharge; UINT32 baildrop; - boolean bailquake; + boolean bailhitlag; boolean analoginput; // Has an input been recorded that requires analog usage? For input display. diff --git a/src/k_kart.c b/src/k_kart.c index 580f13d1c..338e01747 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -10132,10 +10132,10 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) player->ringboost /= 3; } - if (player->bailquake && !player->mo->hitlag) // quake as soon as we leave hitlag + if (player->bailhitlag && !player->mo->hitlag) // quake as soon as we leave hitlag { P_StartQuakeFromMobj(7, 50 * player->mo->scale, 2048 * player->mo->scale, player->mo); - player->bailquake = false; + player->bailhitlag = false; } // The precise ordering of start-of-level made me want to cut my head off, @@ -14200,7 +14200,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->baildrop += baildrop * BAIL_DROPFREQUENCY + 1; K_AddHitLag(player->mo, TICRATE/4, false); - player->bailquake = true; // set for a one time quake effect as soon as hitlag ends + player->bailhitlag = true; // set for a one time quake effect as soon as hitlag ends if (P_PlayerInPain(player)) { diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 91b4908aa..ea452a7ab 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -286,8 +286,8 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->bailcharge); else if (fastcmp(field,"baildrop")) lua_pushinteger(L, plr->baildrop); - else if (fastcmp(field,"bailquake")) - lua_pushboolean(L, plr->bailquake); + else if (fastcmp(field,"bailhitlag")) + lua_pushboolean(L, plr->bailhitlag); else if (fastcmp(field,"dotrickfx")) lua_pushboolean(L, plr->dotrickfx); else if (fastcmp(field,"stingfx")) @@ -927,8 +927,8 @@ static int player_set(lua_State *L) plr->bailcharge = luaL_checkinteger(L, 3); else if (fastcmp(field,"baildrop")) plr->baildrop = luaL_checkinteger(L, 3); - else if (fastcmp(field,"bailquake")) - plr->bailquake = luaL_checkboolean(L, 3); + else if (fastcmp(field,"bailhitlag")) + plr->bailhitlag = luaL_checkboolean(L, 3); else if (fastcmp(field,"analoginput")) plr->analoginput = luaL_checkboolean(L, 3); else if (fastcmp(field,"transfer")) diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index a8c1db997..45da46e47 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -683,7 +683,7 @@ static void P_NetArchivePlayers(savebuffer_t *save) WRITEUINT32(save->p, players[i].bailcharge); WRITEUINT32(save->p, players[i].baildrop); - WRITEUINT8(save->p, players[i].bailquake); + WRITEUINT8(save->p, players[i].bailhitlag); WRITEUINT8(save->p, players[i].analoginput); @@ -1348,7 +1348,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save) players[i].bailcharge = READUINT32(save->p); players[i].baildrop = READUINT32(save->p); - players[i].bailquake = READUINT8(save->p); + players[i].bailhitlag = READUINT8(save->p); players[i].analoginput = READUINT8(save->p); From 371e34122a44ff3246b63d4ee48c268ffeed4254 Mon Sep 17 00:00:00 2001 From: Ashnal Date: Fri, 25 Jul 2025 21:49:41 -0400 Subject: [PATCH 2/5] move bail ring deduction to after hitlag --- src/k_kart.c | 66 ++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 338e01747..e76d133cd 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -10132,8 +10132,40 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) player->ringboost /= 3; } - if (player->bailhitlag && !player->mo->hitlag) // quake as soon as we leave hitlag + if (player->bailhitlag && !player->mo->hitlag) // do the ring reduction and set boost as soon as we leave hitlag { + UINT32 debtrings = 20; + if (player->rings < 0) + { + debtrings += player->rings; + player->rings = 0; + } + + UINT32 totalrings = player->rings + player->superring + player->pickuprings; + if (BAIL_CREDIT_DEBTRINGS) + totalrings += debtrings; + totalrings = max(totalrings, 0); + UINT32 bailboost = FixedInt(FixedMul(totalrings*FRACUNIT, BAIL_BOOST)); + UINT32 baildrop = FixedInt(FixedMul((totalrings)*FRACUNIT, BAIL_DROP)); + + player->rings = -20; + player->superring = 0; + player->pickuprings = 0; + player->ringboxaward = 0; + player->ringboxdelay = 0; + + player->superringdisplay = 0; + player->superringalert = 0; + player->superringpeak = 0; + + player->counterdash += TICRATE/8; + + player->ringboost += bailboost * (3+K_GetKartRingPower(player, true)); + player->baildrop += baildrop * BAIL_DROPFREQUENCY + 1; + + if (player->amps > 0) + K_DefensiveOverdrive(player); + P_StartQuakeFromMobj(7, 50 * player->mo->scale, 2048 * player->mo->scale, player->mo); player->bailhitlag = false; } @@ -14150,20 +14182,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground) mobj_t *bail = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, MT_BAIL); P_SetTarget(&bail->target, player->mo); - UINT32 debtrings = 20; - if (player->rings < 0) - { - debtrings += player->rings; - player->rings = 0; - } - - UINT32 totalrings = player->rings + player->superring + player->pickuprings; - if (BAIL_CREDIT_DEBTRINGS) - totalrings += debtrings; - totalrings = max(totalrings, 0); - UINT32 bailboost = FixedInt(FixedMul(totalrings*FRACUNIT, BAIL_BOOST)); - UINT32 baildrop = FixedInt(FixedMul((totalrings)*FRACUNIT, BAIL_DROP)); - if (player->itemRoulette.active) { player->itemRoulette.active = false; @@ -14184,21 +14202,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } */ - player->rings = -20; - player->superring = 0; - player->pickuprings = 0; - player->ringboxaward = 0; - player->ringboxdelay = 0; - - player->superringdisplay = 0; - player->superringalert = 0; - player->superringpeak = 0; - - player->counterdash += TICRATE/8; - - player->ringboost += bailboost * (3+K_GetKartRingPower(player, true)); - player->baildrop += baildrop * BAIL_DROPFREQUENCY + 1; - K_AddHitLag(player->mo, TICRATE/4, false); player->bailhitlag = true; // set for a one time quake effect as soon as hitlag ends @@ -14219,9 +14222,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground) S_StartSound(NULL, fl->hornsound); } - if (player->amps > 0) - K_DefensiveOverdrive(player); - S_StartSound(player->mo, sfx_kc33); } From 16628c59ca55359ea6c7cc8747f0b4421aef6d5e Mon Sep 17 00:00:00 2001 From: Ashnal Date: Sun, 27 Jul 2025 14:44:21 -0400 Subject: [PATCH 3/5] Rework logic ordering fixes charge logic --- src/k_kart.c | 112 ++++++++++++++++++++++++++------------------------- 1 file changed, 57 insertions(+), 55 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index e76d133cd..48e80d955 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -10095,10 +10095,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->baildrop) { - if (player->stunned & 0x8000) - player->stunned = 0x8000 | BAILSTUN; - else - player->stunned = BAILSTUN; + // freeze the stunned timer while baildrop is active + // while retaining the value that was initially set + player->stunned++; mobj_t *pmo = player->mo; // particle spawn @@ -10153,12 +10152,13 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) player->pickuprings = 0; player->ringboxaward = 0; player->ringboxdelay = 0; - player->superringdisplay = 0; player->superringalert = 0; player->superringpeak = 0; - player->counterdash += TICRATE/8; + CONS_Printf("bailcharge: %d\n", player->bailcharge); + player->stunned = BAILSTUN - player->bailcharge; // note: bailcharge goes up by 2 every tic, not 1, so this is actually - charge duration *2 + player->bailcharge = 0; player->ringboost += bailboost * (3+K_GetKartRingPower(player, true)); player->baildrop += baildrop * BAIL_DROPFREQUENCY + 1; @@ -10170,6 +10170,54 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) player->bailhitlag = false; } + if ((!P_PlayerInPain(player) && player->bailcharge >= 5) || player->bailcharge >= BAIL_MAXCHARGE) + { + mobj_t *bail = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, MT_BAIL); + P_SetTarget(&bail->target, player->mo); + + if (player->itemRoulette.active) + { + player->itemRoulette.active = false; + } + + K_PopPlayerShield(player); + K_DeleteHnextList(player); + K_DropItems(player); + + player->itemamount = 0; + player->itemtype = 0; + + /* + if (player->itemamount) + { + K_DropPaperItem(player, player->itemtype, player->itemamount); + player->itemtype = player->itemamount = 0; + } + */ + + K_AddHitLag(player->mo, TICRATE/4, false); + player->bailhitlag = true; // set for a one time quake effect as soon as hitlag ends + + if (P_PlayerInPain(player)) + { + player->spinouttimer = 0; + player->spinouttype = 0; + player->tumbleBounces = 0; + player->pflags &= ~PF_TUMBLELASTBOUNCE; + player->mo->rollangle = 0; + P_ResetPitchRoll(player->mo); + } + + INT32 fls = K_GetEffectiveFollowerSkin(player); + if (player->follower && fls >= 0 && fls < numfollowers) + { + const follower_t *fl = &followers[fls]; + S_StartSound(NULL, fl->hornsound); + } + + S_StartSound(player->mo, sfx_kc33); + } + // The precise ordering of start-of-level made me want to cut my head off, // so let's try this instead. Whatever! if (leveltime <= starttime || player->gradingpointnum == 0) @@ -14156,11 +14204,11 @@ void K_MoveKartPlayer(player_t *player, boolean onground) else if ((player->itemtype && player->itemamount) || player->rings > 0 || player->superring > 0 || player->pickuprings > 0 || player->itemRoulette.active) { // Set up bail charge, provided we have something to bail with (any rings or item resource). - boolean grounded = P_IsObjectOnGround(player->mo); + // boolean grounded = P_IsObjectOnGround(player->mo); // onground && player->tumbleBounces == 0 ? player->bailcharge += 2 : player->bailcharge++; // charge twice as fast on the ground player->bailcharge += 2; // if ((P_PlayerInPain(player) && player->bailcharge == 1) || (grounded && P_PlayerInPain(player) && player->bailcharge == 2)) // this is brittle .. - if (player->bailcharge == 2) + if (P_PlayerInPain(player) && player->bailcharge == 2) { mobj_t *bail = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, MT_BAILCHARGE); S_StartSound(bail, sfx_gshb9); // I tried to use info.c, but you can't play sounds on mobjspawn via A_PlaySound @@ -14174,55 +14222,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->bailcharge = 0; } } - - if ((!P_PlayerInPain(player) && player->bailcharge >= 5) || player->bailcharge >= BAIL_MAXCHARGE) + else { player->bailcharge = 0; - - mobj_t *bail = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, MT_BAIL); - P_SetTarget(&bail->target, player->mo); - - if (player->itemRoulette.active) - { - player->itemRoulette.active = false; - } - - K_PopPlayerShield(player); - K_DeleteHnextList(player); - K_DropItems(player); - - player->itemamount = 0; - player->itemtype = 0; - - /* - if (player->itemamount) - { - K_DropPaperItem(player, player->itemtype, player->itemamount); - player->itemtype = player->itemamount = 0; - } - */ - - K_AddHitLag(player->mo, TICRATE/4, false); - player->bailhitlag = true; // set for a one time quake effect as soon as hitlag ends - - if (P_PlayerInPain(player)) - { - player->spinouttimer = 0; - player->spinouttype = 0; - player->tumbleBounces = 0; - player->pflags &= ~PF_TUMBLELASTBOUNCE; - player->mo->rollangle = 0; - P_ResetPitchRoll(player->mo); - } - - INT32 fls = K_GetEffectiveFollowerSkin(player); - if (player->follower && fls >= 0 && fls < numfollowers) - { - const follower_t *fl = &followers[fls]; - S_StartSound(NULL, fl->hornsound); - } - - S_StartSound(player->mo, sfx_kc33); } if (player && player->mo && K_PlayerCanUseItem(player)) From 2b291c107f93d0ccca1c2fea55fe3c0ba7675548 Mon Sep 17 00:00:00 2001 From: Ashnal Date: Sun, 27 Jul 2025 15:10:57 -0400 Subject: [PATCH 4/5] Remove debugprint --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 48e80d955..c4110270c 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -10156,7 +10156,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) player->superringalert = 0; player->superringpeak = 0; player->counterdash += TICRATE/8; - CONS_Printf("bailcharge: %d\n", player->bailcharge); + // CONS_Printf("bailcharge: %d\n", player->bailcharge); player->stunned = BAILSTUN - player->bailcharge; // note: bailcharge goes up by 2 every tic, not 1, so this is actually - charge duration *2 player->bailcharge = 0; From 2e516b076131f7eff4feb3470641f82ffad95af9 Mon Sep 17 00:00:00 2001 From: VelocitOni Date: Sun, 27 Jul 2025 18:17:44 -0400 Subject: [PATCH 5/5] Even more forgiving + 125% --- src/k_kart.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index c4110270c..f30e3bbd4 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -10157,7 +10157,8 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) player->superringpeak = 0; player->counterdash += TICRATE/8; // CONS_Printf("bailcharge: %d\n", player->bailcharge); - player->stunned = BAILSTUN - player->bailcharge; // note: bailcharge goes up by 2 every tic, not 1, so this is actually - charge duration *2 + // Below: The stun the player gets from bailing is reduced as a pity if you did it out of Burst. Longer charge, shorter stun. + player->stunned = BAILSTUN - player->bailcharge*5/4; // note: bailcharge goes up by 2 every tic, not 1, so this is actually - charge duration *2 player->bailcharge = 0; player->ringboost += bailboost * (3+K_GetKartRingPower(player, true));