From fc455e9079e227a14634fab5bda626f2267fc6fb Mon Sep 17 00:00:00 2001 From: minenice55 Date: Thu, 5 Feb 2026 20:50:38 -0500 Subject: [PATCH] make holding brake while grounded not trigger airdrop --- src/d_player.h | 6 ++++-- src/k_kart.c | 42 +++++++++++++++++++++++++++++++++--------- src/p_saveg.c | 3 ++- 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 8f28b683e..bd194f8ae 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -113,8 +113,9 @@ typedef enum typedef enum { - PAF_WANTSAIRDROP = 1<<0, // Wants air drop (active while holding down brake, used for bouncy air drop) + PAF_WANTSAIRDROP = 1<<0, // Wants Air drop (input pressed and buffered) PAF_AIRDROP = 1<<1, // Is in Air Drop (activation / deactivation criteria change if light or heavy) + PAF_AIRDROPINPUT = 1<<2, // Air drop input held } p_airdropflags_t; typedef enum @@ -680,7 +681,8 @@ struct player_t UINT8 ringvolume; // When consuming lots of rings, lower the sound a little. UINT8 ringtransparency; // When consuming lots of rings, fade out the rings again. - tic_t airdroptime; // Tracks how long airdrop has been active, used for delay before airdrop kicks in. + tic_t airdroptime; // Tracks how long the player has been in airdrop. In light airdrop, handles the delay before it kicks in. + tic_t airdropbuffer; // Time during which heavy air drop will instantly trigger upon going airborne. p_airdropflags_t airdropflags; // Airdrop-exclusive bitflags. mobj_t *shieldtracer; // Blankart: Shield mobj diff --git a/src/k_kart.c b/src/k_kart.c index 6c9091755..897bbc5dc 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6978,10 +6978,34 @@ static void K_SpawnFallLines(player_t *player, boolean ringdrop) static void K_AirDrop(player_t *player, ticcmd_t *cmd) { - if (!(cmd->buttons & BT_BRAKE)) + if (player->airdropbuffer > 0) + { + player->airdropbuffer--; + } + + if ((cmd->buttons & BT_BRAKE)) + { + if (!(player->airdropflags & PAF_AIRDROPINPUT)) + { + player->airdropflags |= PAF_WANTSAIRDROP|PAF_AIRDROPINPUT; + if (P_IsObjectOnGround(player->mo)) + player->airdropbuffer = 2; + } + } + else + { + player->airdropflags &= ~PAF_AIRDROPINPUT; + if (airdropactive == AIRDROP_LIGHT) + { + player->airdropflags &= ~PAF_WANTSAIRDROP; + } + } + + if (P_IsObjectOnGround(player->mo) && player->airdropbuffer == 0) { player->airdropflags &= ~PAF_WANTSAIRDROP; } + if (!(player->airdropflags & PAF_AIRDROP)) { if (player->karthud[khud_heavydropcam] > 0) @@ -7031,10 +7055,12 @@ static void K_AirDrop(player_t *player, ticcmd_t *cmd) return; } - if ((cmd->buttons & BT_BRAKE) && !(player->airdropflags & PAF_WANTSAIRDROP)) + if (player->airdropflags & PAF_WANTSAIRDROP) { if (airdropactive == AIRDROP_HEAVY && !(player->airdropflags & (PAF_AIRDROP))) { + player->airdropbuffer = 0; + // TODO: heavy air drop should allow keeping current boost stack S_StartSound(player->mo, sfx_s3k77); S_StartSound(player->mo, sfx_s3k51); @@ -7043,22 +7069,22 @@ static void K_AirDrop(player_t *player, ticcmd_t *cmd) player->mo->momy = FixedMul(player->mo->momy, 90*FRACUNIT/100); player->mo->momz -= 8*P_MobjFlip(player->mo)*mapobjectscale; } - player->airdropflags |= PAF_AIRDROP|PAF_WANTSAIRDROP; + player->airdropflags |= PAF_AIRDROP; } else { - if (airdropactive == AIRDROP_LIGHT && !(cmd->buttons & BT_BRAKE)) + if (airdropactive == AIRDROP_LIGHT) player->airdropflags &= ~PAF_AIRDROP; } if (player->airdropflags & PAF_AIRDROP) { - + tic_t airbrakedelay = TICRATE/3; K_SpawnFallLines(player, false); if (airdropactive == AIRDROP_HEAVY) { - if (player->airdroptime <= TICRATE/4) + if (player->airdroptime <= airbrakedelay) { player->mo->momz -= FixedMul(4*gravity, mapobjectscale)*P_MobjFlip(player->mo); K_SpawnAirdropTrail(player); @@ -7073,15 +7099,13 @@ static void K_AirDrop(player_t *player, ticcmd_t *cmd) } else if (airdropactive == AIRDROP_LIGHT) { - SINT8 airbrakedelay = TICRATE/3; if (player->airdroptime >= airbrakedelay) { player->mo->momz -= FixedMul(gravity, mapobjectscale)*P_MobjFlip(player->mo); K_SpawnAirdropTrail(player); } } - if (player->airdroptime < UINT8_MAX) - player->airdroptime++; + player->airdroptime++; } } diff --git a/src/p_saveg.c b/src/p_saveg.c index 1ce77719c..cb8d27cd1 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -710,7 +710,8 @@ static void P_NetSyncPlayers(savebuffer_t *save) SYNC(players[i].ringtransparency); SYNC(players[i].airdroptime); - //SYNCBOOLEAN(players[i].ringdrop); + SYNC(players[i].airdropbuffer); + SYNC(players[i].airdropflags); RSYNC(players[i].shieldtracer);