From 2a0f9da975ba0f2f7e44bc01c7cea2c4112e1cbb Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Fri, 13 Oct 2023 17:36:06 -0700 Subject: [PATCH] More instawhip tuning cleanup --- src/k_kart.c | 26 +++++++++++++++----------- src/k_kart.h | 3 ++- src/objects/instawhip.c | 2 +- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 9ec27955f..9c89535e2 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8275,7 +8275,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (!(player->cmd.buttons & BT_ATTACK)) // Deliberate Item button release, no need to protect you from lockout player->instaWhipChargeLockout = 0; - if (player->instaWhipCharge && player->instaWhipCharge < INSTAWHIP_COOLDOWN) + if (player->instaWhipCharge && player->instaWhipCharge < INSTAWHIP_CHARGETIME) { if (!S_SoundPlaying(player->mo, sfx_wchrg1)) S_StartSound(player->mo, sfx_wchrg1); @@ -8285,7 +8285,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) S_StopSoundByID(player->mo, sfx_wchrg1); } - if (player->instaWhipCharge >= INSTAWHIP_COOLDOWN) + if (player->instaWhipCharge >= INSTAWHIP_CHARGETIME) { if (!S_SoundPlaying(player->mo, sfx_wchrg2)) S_StartSound(player->mo, sfx_wchrg2); @@ -8295,7 +8295,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) S_StopSoundByID(player->mo, sfx_wchrg2); } - if (P_PlayerInPain(player) || player->itemamount) + if (P_PlayerInPain(player) || player->itemamount || player->respawn.state != RESPAWNST_NONE) player->instaWhipCharge = 0; if (player->tiregrease) @@ -11031,7 +11031,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { chargingwhip = false; releasedwhip = (ATTACK_IS_DOWN && player->rings <= 0); - player->instaWhipCharge = INSTAWHIP_COOLDOWN; + player->instaWhipCharge = INSTAWHIP_CHARGETIME; } if (leveltime < starttime || player->spindash) @@ -11043,7 +11043,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (chargingwhip) { //CONS_Printf("charging %d\n", player->instaWhipCharge); - player->instaWhipCharge = min(player->instaWhipCharge + 1, INSTAWHIP_COOLDOWN + 1); + player->instaWhipCharge = min(player->instaWhipCharge + 1, INSTAWHIP_CHARGETIME + 1); if (player->instaWhipCharge == 1) { @@ -11052,20 +11052,24 @@ void K_MoveKartPlayer(player_t *player, boolean onground) Obj_SpawnInstaWhipRecharge(player, ANGLE_240); } - if (player->instaWhipCharge == INSTAWHIP_COOLDOWN) + if (player->instaWhipCharge == INSTAWHIP_CHARGETIME) { Obj_SpawnInstaWhipReject(player); } - if (player->instaWhipCharge > INSTAWHIP_COOLDOWN) + if (player->instaWhipCharge > INSTAWHIP_CHARGETIME) { - if (leveltime%(TICRATE/2) == 0) - P_PlayerRingBurst(player, 1); + if ((leveltime%(INSTAWHIP_RINGDRAINEVERY)) == 0 && !(gametyperules & GTR_SPHERES)) + { + if (player->rings > -20) + S_StartSound(player->mo, sfx_antiri); + player->rings--; + } } } else if (releasedwhip) { - if (player->instaWhipCharge < INSTAWHIP_COOLDOWN) + if (player->instaWhipCharge < INSTAWHIP_CHARGETIME) { S_StartSound(player->mo, sfx_kc50); player->instaWhipCharge = 0; @@ -11076,7 +11080,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->guardCooldown = INSTAWHIP_DROPGUARD; if (!K_PowerUpRemaining(player, POWERUP_BARRIER)) { - player->guardCooldown = INSTAWHIP_COOLDOWN; + player->guardCooldown = INSTAWHIP_CHARGETIME; } S_StartSound(player->mo, sfx_iwhp); diff --git a/src/k_kart.h b/src/k_kart.h index 1aeb16768..62d75e756 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -30,8 +30,9 @@ Make sure this matches the actual number of states #define SHRINK_PHYSICS_SCALE (3*FRACUNIT/4) #define INSTAWHIP_DURATION (12) -#define INSTAWHIP_COOLDOWN (5*TICRATE/4) +#define INSTAWHIP_CHARGETIME (5*TICRATE/4) #define INSTAWHIP_DROPGUARD (12) +#define INSTAWHIP_RINGDRAINEVERY (TICRATE/2) #define GUARDBREAK_COOLDOWN (TICRATE*4) #define FLAMESHIELD_MAX (120) diff --git a/src/objects/instawhip.c b/src/objects/instawhip.c index e98c12cf2..9236c525c 100644 --- a/src/objects/instawhip.c +++ b/src/objects/instawhip.c @@ -50,7 +50,7 @@ void Obj_SpawnInstaWhipRecharge(player_t *player, angle_t angleOffset) { mobj_t *x = P_SpawnMobjFromMobj(player->mo, 0, 0, 0, MT_INSTAWHIP_RECHARGE); - x->tics = max(INSTAWHIP_COOLDOWN - player->instaWhipCharge - states[x->info->raisestate].tics, 0); + x->tics = max(INSTAWHIP_CHARGETIME - player->instaWhipCharge - states[x->info->raisestate].tics, 0); x->renderflags |= RF_SLOPESPLAT | RF_NOSPLATBILLBOARD; P_SetTarget(&recharge_target(x), player->mo);