From 0cc46a2aafa7e5290f13bec4fb62e8161e7729b4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 26 Feb 2017 19:05:20 +0100 Subject: [PATCH] - added a FORCEINFIGHTING flag. --- src/actor.h | 1 + src/p_interaction.cpp | 3 ++- src/p_map.cpp | 1 + src/scripting/thingdef_data.cpp | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/actor.h b/src/actor.h index c8c7cbc5f..b52cb6571 100644 --- a/src/actor.h +++ b/src/actor.h @@ -389,6 +389,7 @@ enum ActorFlag7 MF7_NOSHIELDREFLECT = 0x08000000, // will not be reflected by shields. MF7_FORCEZERORADIUSDMG = 0x10000000, // passes zero radius damage on to P_DamageMobj, this is necessary in some cases where DoSpecialDamage gets overrideen. MF7_NOINFIGHTSPECIES = 0x20000000, // don't start infights with one's own species. + MF7_FORCEINFIGHTING = 0x40000000, // overrides a map setting of 'no infighting'. }; // --- mobj.renderflags --- diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 33605e4e3..c13024fcf 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1772,7 +1772,8 @@ bool AActor::OkayToSwitchTarget (AActor *other) } int infight; - if (flags5 & MF5_NOINFIGHTING) infight=-1; + if (flags7 & MF7_FORCEINFIGHTING) infight = 1; + else if (flags5 & MF5_NOINFIGHTING) infight = -1; else infight = G_SkillProperty(SKILLP_Infight); if (infight < 0 && other->player == NULL && !IsHostile (other)) diff --git a/src/p_map.cpp b/src/p_map.cpp index 13f566b1f..58aaefc17 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -1177,6 +1177,7 @@ static bool CanAttackHurt(AActor *victim, AActor *shooter) if (!victim->player && !shooter->player) { int infight = G_SkillProperty(SKILLP_Infight); + if (infight < 0 && (victim->flags7 & MF7_FORCEINFIGHTING)) infight = 0; // This must override the 'no infight' setting to take effect. if (infight < 0) { diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index f68667bbb..3a76002fa 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -318,6 +318,7 @@ static FFlagDef ActorFlagDefs[]= DEFINE_FLAG(MF7, NOSHIELDREFLECT, AActor, flags7), DEFINE_FLAG(MF7, FORCEZERORADIUSDMG, AActor, flags7), DEFINE_FLAG(MF7, NOINFIGHTSPECIES, AActor, flags7), + DEFINE_FLAG(MF7, FORCEINFIGHTING, AActor, flags7), // Effect flags DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects),