Merge branch 'keep-powerups-in-midair' into 'master'

Make powerup timers less frustrating

See merge request KartKrew/Kart!981
This commit is contained in:
Oni 2023-02-27 07:04:27 +00:00
commit 42dc2a1bfd
2 changed files with 66 additions and 61 deletions

View file

@ -7748,12 +7748,12 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
} }
} }
if (player->invincibilitytimer) if (player->invincibilitytimer && onground == true)
player->invincibilitytimer--; player->invincibilitytimer--;
if ((player->respawn.state == RESPAWNST_NONE) && player->growshrinktimer != 0) if ((player->respawn.state == RESPAWNST_NONE) && player->growshrinktimer != 0)
{ {
if (player->growshrinktimer > 0) if (player->growshrinktimer > 0 && onground == true)
player->growshrinktimer--; player->growshrinktimer--;
if (player->growshrinktimer < 0) if (player->growshrinktimer < 0)
player->growshrinktimer++; player->growshrinktimer++;
@ -7810,7 +7810,8 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->stealingtimer == 0 if (player->stealingtimer == 0
&& player->rocketsneakertimer) && player->rocketsneakertimer
&& onground == true)
player->rocketsneakertimer--; player->rocketsneakertimer--;
if (player->hyudorotimer) if (player->hyudorotimer)
@ -10504,11 +10505,12 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
{ {
if (player->growshrinktimer < 0) if (player->growshrinktimer < 0)
{ {
// If you're shrunk, then "grow" will just make you normal again. // Old v1 behavior was to have Grow counter Shrink,
// but Shrink is now so ephemeral that it should just work.
K_RemoveGrowShrink(player); K_RemoveGrowShrink(player);
// So we fall through here.
} }
else
{
K_PlayPowerGloatSound(player->mo); K_PlayPowerGloatSound(player->mo);
player->mo->scalespeed = mapobjectscale/TICRATE; player->mo->scalespeed = mapobjectscale/TICRATE;
@ -10519,14 +10521,13 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
player->mo->destscale = FixedMul(player->mo->destscale, SHRINK_SCALE); player->mo->destscale = FixedMul(player->mo->destscale, SHRINK_SCALE);
} }
player->growshrinktimer = max(player->growshrinktimer, ((gametyperules & GTR_CLOSERPLAYERS) ? 8 : 12) * TICRATE);
if (player->invincibilitytimer > 0) if (player->invincibilitytimer > 0)
{ {
; // invincibility has priority in P_RestoreMusic, no point in starting here ; // invincibility has priority in P_RestoreMusic, no point in starting here
} }
else if (P_IsLocalPlayer(player) == true) else if (P_IsLocalPlayer(player) == true)
{ {
if (player->growshrinktimer < 1)
S_ChangeMusicSpecial("kgrow"); S_ChangeMusicSpecial("kgrow");
} }
else //used to be "if (P_IsDisplayPlayer(player) == false)" else //used to be "if (P_IsDisplayPlayer(player) == false)"
@ -10535,8 +10536,11 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
} }
P_RestoreMusic(player); P_RestoreMusic(player);
player->growshrinktimer = max(0, player->growshrinktimer);
player->growshrinktimer += ((gametyperules & GTR_CLOSERPLAYERS) ? 8 : 12) * TICRATE;
S_StartSound(player->mo, sfx_kc5a); S_StartSound(player->mo, sfx_kc5a);
}
player->itemamount--; player->itemamount--;
} }

View file

@ -542,8 +542,7 @@ boolean Obj_ShrinkLaserCollide(mobj_t *gun, mobj_t *victim)
// Take away Shrink. // Take away Shrink.
K_RemoveGrowShrink(victim->player); K_RemoveGrowShrink(victim->player);
} }
else
{
victim->player->growshrinktimer += 3*TICRATE; victim->player->growshrinktimer += 3*TICRATE;
S_StartSound(victim, sfx_kc5a); S_StartSound(victim, sfx_kc5a);
@ -571,21 +570,23 @@ boolean Obj_ShrinkLaserCollide(mobj_t *gun, mobj_t *victim)
} }
P_RestoreMusic(victim->player); P_RestoreMusic(victim->player);
}
} }
} }
else else
{ {
if (prevTimer > 0) if (prevTimer > 0)
{ {
// Take away Grow. // Dock some Grow time.
K_RemoveGrowShrink(victim->player); // (Hack-adjacent: Always make sure there's a tic left so standard timer handling can remove the effect properly.)
victim->player->growshrinktimer -= min(3*TICRATE/2, victim->player->growshrinktimer - 1);
S_StartSound(victim, sfx_s3k40);
} }
else else
{ {
// Start shrinking! // Start shrinking!
victim->player->growshrinktimer -= 5*TICRATE; victim->player->growshrinktimer -= 5*TICRATE;
S_StartSound(victim, sfx_kc59); S_StartSound(victim, sfx_kc59); // I don't think you ever get to hear this while the pohbee laser is in your teeth, but best effort.
if (prevTimer >= 0) if (prevTimer >= 0)
{ {