Alt. Invin. bottlenecker prevention prelim

This commit is contained in:
yamamama 2025-11-13 12:33:32 -05:00
parent 911c454fa8
commit 16ff617c8b
3 changed files with 16 additions and 3 deletions

View file

@ -668,8 +668,9 @@ struct player_t
UINT16 rocketsneakertimer; // Rocket Sneaker duration timer
UINT16 invincibilitytimer; // Invincibility timer
UINT16 maxinvincibilitytime; // (Alternate) Initial time for Invincibility, used for the item bar.
UINT16 invincibilitytimer; // Invincibility timer
boolean shortinvin; // (Alternate) This Invincibility is too short to punish with bottleneckers,
UINT16 maxinvincibilitytime; // (Alternate) Initial time for Invincibility, used for the item bar.
UINT16 invincibilitybottleneck; // (Alternate) Prevents breakaways by gradienting towards a heavier decrement.
INT16 invincibilitycancel; // (Alternate) Duration of Invincibility canceling.
UINT8 invincibilitywarning; // (Alternate) "Timer warning" boolean to signal Alt. Invin. is running out.

View file

@ -2388,6 +2388,9 @@ UINT16 K_GetInvincibilityTime(player_t *player)
UINT32 i, pingame;
fixed_t distmul = FRACUNIT;
// ALWAYS reset shortinvin!
player->shortinvin = false;
if (!K_IsKartItemAlternate(KITEM_INVINCIBILITY))
return BASEINVINTIME;
@ -2418,7 +2421,15 @@ UINT16 K_GetInvincibilityTime(player_t *player)
}
fixed_t clustermul = K_InvincibilityEasing(FixedMul(player->distancefromcluster,distmul));
return FixedMul(BASEINVINTIME, clustermul);
UINT16 invintics = FixedMul(BASEINVINTIME, clustermul);
if (invintics <= MININVINTIME)
{
player->shortinvin = true;
invintics = MININVINTIME;
}
return invintics;
}
#undef LEGACYALTINVINMUL

View file

@ -33,6 +33,7 @@ Make sure this matches the actual number of states
#define SHRINK_SCALE ((6*FRACUNIT)/8)
#define BASEINVINTIME (10 * TICRATE)
#define MININVINTIME (7 * TICRATE)
#define AUTORESPAWN_TIME (TICRATE/2)
#define AUTORESPAWN_THRESHOLD (TICRATE/4)