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,40 +10505,43 @@ 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);
player->mo->scalespeed = mapobjectscale/TICRATE;
player->mo->destscale = FixedMul(mapobjectscale, GROW_SCALE);
if (K_PlayerShrinkCheat(player) == true)
{ {
K_PlayPowerGloatSound(player->mo); player->mo->destscale = FixedMul(player->mo->destscale, SHRINK_SCALE);
player->mo->scalespeed = mapobjectscale/TICRATE;
player->mo->destscale = FixedMul(mapobjectscale, GROW_SCALE);
if (K_PlayerShrinkCheat(player) == true)
{
player->mo->destscale = FixedMul(player->mo->destscale, SHRINK_SCALE);
}
player->growshrinktimer = max(player->growshrinktimer, ((gametyperules & GTR_CLOSERPLAYERS) ? 8 : 12) * TICRATE);
if (player->invincibilitytimer > 0)
{
; // invincibility has priority in P_RestoreMusic, no point in starting here
}
else if (P_IsLocalPlayer(player) == true)
{
S_ChangeMusicSpecial("kgrow");
}
else //used to be "if (P_IsDisplayPlayer(player) == false)"
{
S_StartSound(player->mo, sfx_alarmg);
}
P_RestoreMusic(player);
S_StartSound(player->mo, sfx_kc5a);
} }
if (player->invincibilitytimer > 0)
{
; // invincibility has priority in P_RestoreMusic, no point in starting here
}
else if (P_IsLocalPlayer(player) == true)
{
if (player->growshrinktimer < 1)
S_ChangeMusicSpecial("kgrow");
}
else //used to be "if (P_IsDisplayPlayer(player) == false)"
{
S_StartSound(player->mo, sfx_alarmg);
}
P_RestoreMusic(player);
player->growshrinktimer = max(0, player->growshrinktimer);
player->growshrinktimer += ((gametyperules & GTR_CLOSERPLAYERS) ? 8 : 12) * TICRATE;
S_StartSound(player->mo, sfx_kc5a);
player->itemamount--; player->itemamount--;
} }
break; break;

View file

@ -542,50 +542,51 @@ 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;
S_StartSound(victim, sfx_kc5a);
if (prevTimer <= 0)
{ {
victim->player->growshrinktimer += 3*TICRATE; victim->scalespeed = mapobjectscale/TICRATE;
S_StartSound(victim, sfx_kc5a); victim->destscale = FixedMul(mapobjectscale, GROW_SCALE);
if (prevTimer <= 0) if (K_PlayerShrinkCheat(victim->player) == true)
{ {
victim->scalespeed = mapobjectscale/TICRATE; victim->destscale = FixedMul(victim->destscale, SHRINK_SCALE);
victim->destscale = FixedMul(mapobjectscale, GROW_SCALE);
if (K_PlayerShrinkCheat(victim->player) == true)
{
victim->destscale = FixedMul(victim->destscale, SHRINK_SCALE);
}
if (victim->player->invincibilitytimer > 0)
{
; // invincibility has priority in P_RestoreMusic, no point in starting here
}
else if (P_IsLocalPlayer(victim->player) == true)
{
S_ChangeMusicSpecial("kgrow");
}
else //used to be "if (P_IsDisplayPlayer(victim->player) == false)"
{
S_StartSound(victim, sfx_alarmg);
}
P_RestoreMusic(victim->player);
} }
if (victim->player->invincibilitytimer > 0)
{
; // invincibility has priority in P_RestoreMusic, no point in starting here
}
else if (P_IsLocalPlayer(victim->player) == true)
{
S_ChangeMusicSpecial("kgrow");
}
else //used to be "if (P_IsDisplayPlayer(victim->player) == false)"
{
S_StartSound(victim, sfx_alarmg);
}
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)
{ {