Merge branch 'allow-top-tripwire' into 'master'

Allow Top to pass tripwire, once (resolves #814)

Closes #814

See merge request KartKrew/Kart!1743
This commit is contained in:
Oni 2023-12-29 09:18:30 +00:00
commit 7d35c0db4b
2 changed files with 26 additions and 3 deletions

View file

@ -267,6 +267,7 @@ typedef enum
TRIPWIRE_IGNORE, TRIPWIRE_IGNORE,
TRIPWIRE_BOOST, TRIPWIRE_BOOST,
TRIPWIRE_BLASTER, TRIPWIRE_BLASTER,
TRIPWIRE_CONSUME,
} tripwirepass_t; } tripwirepass_t;
typedef enum typedef enum

View file

@ -2868,6 +2868,12 @@ tripwirepass_t K_TripwirePassConditions(const player_t *player)
) )
return TRIPWIRE_IGNORE; return TRIPWIRE_IGNORE;
// TRIPWIRE_CONSUME should always be checked last; this category should be
// used for tripwire states that are partially detrimental, and check
// leniency from OTHER states, not themselves.
if (player->curshield == KSHIELD_TOP)
return TRIPWIRE_CONSUME;
return TRIPWIRE_NONE; return TRIPWIRE_NONE;
} }
@ -4592,12 +4598,22 @@ void K_ApplyTripWire(player_t *player, tripwirestate_t state)
if (state == TRIPSTATE_PASSED) if (state == TRIPSTATE_PASSED)
{ {
S_StartSound(player->mo, sfx_ssa015); S_StartSound(player->mo, sfx_ssa015);
if (player->roundconditions.tripwire_hyuu == false if (player->roundconditions.tripwire_hyuu == false
&& player->hyudorotimer > 0) && player->hyudorotimer > 0)
{ {
player->roundconditions.tripwire_hyuu = true; player->roundconditions.tripwire_hyuu = true;
player->roundconditions.checkthisframe = true; player->roundconditions.checkthisframe = true;
} }
if (player->tripwirePass == TRIPWIRE_CONSUME && player->tripwireLeniency == 0)
{
if (player->curshield == KSHIELD_TOP)
{
S_StartSound(player->mo, sfx_kc65); // Player's handling is about to change, alert them!
Obj_GardenTopDestroy(player);
}
}
} }
else if (state == TRIPSTATE_BLOCKED) else if (state == TRIPSTATE_BLOCKED)
{ {
@ -8107,9 +8123,15 @@ static void K_UpdateTripwire(player_t *player)
} }
player->tripwirePass = triplevel; player->tripwirePass = triplevel;
player->tripwireLeniency = max(player->tripwireLeniency, TRIPWIRETIME);
if (triplevel != TRIPWIRE_CONSUME)
player->tripwireLeniency = max(player->tripwireLeniency, TRIPWIRETIME);
} }
else
// TRIPWIRE_CONSUME is only applied in very specific cases (currently, riding Garden Top)
// and doesn't need leniency; however, it should track leniency from other pass conditions,
// so that stripping Garden Top feels consistent.
if (triplevel == TRIPWIRE_NONE || triplevel == TRIPWIRE_CONSUME)
{ {
if (boostExists) if (boostExists)
{ {
@ -8121,7 +8143,7 @@ static void K_UpdateTripwire(player_t *player)
} }
} }
if (player->tripwireLeniency <= 0) if (player->tripwireLeniency <= 0 && triplevel == TRIPWIRE_NONE)
{ {
player->tripwirePass = TRIPWIRE_NONE; player->tripwirePass = TRIPWIRE_NONE;
} }