From ab60afd0b8cf281bd7884bef904f0c458107d93b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 13 Jun 2011 10:25:03 +0000 Subject: [PATCH] - added DavifPH's fix for poisoning invulnerable players. SVN r3231 (trunk) --- src/actor.h | 1 + src/p_interaction.cpp | 19 +++++++++++++++++++ src/thingdef/thingdef_data.cpp | 1 + 3 files changed, 21 insertions(+) diff --git a/src/actor.h b/src/actor.h index fecd11a73..a79b584cd 100644 --- a/src/actor.h +++ b/src/actor.h @@ -328,6 +328,7 @@ enum MF6_BOSSCUBE = 0x00800000, // Actor spawned by A_BrainSpit, flagged for timefreeze reasons. MF6_SEEINVISIBLE = 0x01000000, // Monsters can see invisible player. MF6_DONTCORPSE = 0x02000000, // [RC] Don't autoset MF_CORPSE upon death and don't force Crash state change. + MF6_POISONALWAYS = 0x04000000, // Always apply poison, even when target can't take the damage. // --- mobj.renderflags --- diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index c8dca95ec..957fdd2c8 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1373,6 +1373,25 @@ void P_PoisonMobj (AActor *target, AActor *inflictor, AActor *source, int damage int olddamage = target->PoisonDamageReceived; int oldduration = target->PoisonDurationReceived; + // Check for invulnerability. + if (!(inflictor->flags6 & MF6_POISONALWAYS)) + { + if (target->flags2 & MF2_INVULNERABLE) + { // actor is invulnerable + if (target->player == NULL) + { + if (!(inflictor->flags3 & MF3_FOILINVUL)) + { + return; + } + } + else + { + return; + } + } + } + target->Poisoner = source; if (inflictor->flags6 & MF6_ADDITIVEPOISONDAMAGE) diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index 5d0c274bf..24b0200f9 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -231,6 +231,7 @@ static FFlagDef ActorFlags[]= DEFINE_FLAG(MF6, NOMENU, AActor, flags6), DEFINE_FLAG(MF6, SEEINVISIBLE, AActor, flags6), DEFINE_FLAG(MF6, DONTCORPSE, AActor, flags6), + DEFINE_FLAG(MF6, POISONALWAYS, AActor, flags6), // Effect flags DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects),