From 9fa7cb096b19087819318c565b7a1ec4bc3ddf82 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 13 Jan 2024 13:16:58 -0800 Subject: [PATCH] P_DamageMobj: items and PvP damage bypass flashing tics if the victim is in a damage state --- src/p_inter.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/p_inter.c b/src/p_inter.c index c0001e4c8..a36f74262 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2812,6 +2812,34 @@ static void AddNullHitlag(player_t *player, tic_t oldHitlag) } } +static boolean P_FlashingException(const player_t *player, const mobj_t *inflictor) +{ + if (!inflictor) + { + // Sector damage always behaves the same. + return false; + } + + if (!P_IsKartItem(inflictor->type) && inflictor->type != MT_PLAYER) + { + // Exception only applies to player items. + // Also applies to players because of PvP collision. + // Lightning Shield also uses the player object as inflictor. + return false; + } + + if (!P_PlayerInPain(player)) + { + // Flashing tics is sometimes used in a way unrelated to damage. + // E.g. picking up a power-up gives you flashing tics. + // Respect this usage of flashing tics. + return false; + } + + // Flashing tics are ignored. + return true; +} + /** Damages an object, which may or may not be a player. * For melee attacks, source and inflictor are the same. * @@ -3176,7 +3204,12 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da } // DMG_EXPLODE excluded from flashtic checks to prevent dodging eggbox/SPB with weak spinout - if ((target->hitlag == 0 || allowcombo == false) && player->flashing > 0 && type != DMG_EXPLODE && type != DMG_STUMBLE && type != DMG_WHUMBLE) + if ((target->hitlag == 0 || allowcombo == false) && + player->flashing > 0 && + type != DMG_EXPLODE && + type != DMG_STUMBLE && + type != DMG_WHUMBLE && + P_FlashingException(player, inflictor) == false) { // Post-hit invincibility K_DoInstashield(player);