From c01d1a8003dcfb90abd3170545ec3891e5f67f79 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Mon, 27 Oct 2014 22:29:10 -0500 Subject: [PATCH] - Added DMSS_NOPROTECT. Bypasses PowerProtection inventory items. --- src/p_interaction.cpp | 10 +++++----- src/p_local.h | 1 + src/thingdef/thingdef_codeptr.cpp | 3 +++ wadsrc/static/actors/constants.txt | 1 + 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 0a615d3cc..db6dcdc7d 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1053,8 +1053,8 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, return -1; } } - // Handle passive damage modifiers (e.g. PowerProtection) - if (target->Inventory != NULL) + // Handle passive damage modifiers (e.g. PowerProtection), provided they are not afflicted with protection penetrating powers. + if ((target->Inventory != NULL) && !(flags & DMG_NO_PROTECT)) { int olddam = damage; target->Inventory->ModifyDamage(olddam, mod, damage, true); @@ -1592,7 +1592,7 @@ bool AActor::OkayToSwitchTarget (AActor *other) bool P_PoisonPlayer (player_t *player, AActor *poisoner, AActor *source, int poison) { - if((player->cheats&CF_GODMODE) || (player->mo->flags2 & MF2_INVULNERABLE)) + if((player->cheats&CF_GODMODE) || (player->mo->flags2 & MF2_INVULNERABLE) || (player->cheats & CF_GODMODE2)) { return false; } @@ -1643,8 +1643,8 @@ void P_PoisonDamage (player_t *player, AActor *source, int damage, { return; } - if (damage < TELEFRAG_DAMAGE && ((target->flags2 & MF2_INVULNERABLE) || - (player->cheats & CF_GODMODE))) + if ((damage < TELEFRAG_DAMAGE && ((target->flags2 & MF2_INVULNERABLE) || + (player->cheats & CF_GODMODE))) || (player->cheats & CF_GODMODE2)) { // target is invulnerable return; } diff --git a/src/p_local.h b/src/p_local.h index f7e473845..dec80ecaa 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -560,6 +560,7 @@ enum EDmgFlags DMG_PLAYERATTACK = 32, DMG_FOILINVUL = 64, DMG_FOILBUDDHA = 128, + DMG_NO_PROTECT = 256, }; diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 6a1cf6e67..a8f0a4d40 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -4832,6 +4832,7 @@ enum DMSS DMSS_KILL = 4, DMSS_NOFACTOR = 8, DMSS_FOILBUDDHA = 16, + DMSS_NOPROTECT = 32, }; static void DoDamage(AActor *dmgtarget, AActor *self, int amount, FName DamageType, int flags) @@ -4847,6 +4848,8 @@ static void DoDamage(AActor *dmgtarget, AActor *self, int amount, FName DamageTy dmgFlags += DMG_NO_ARMOR; if (flags & DMSS_KILL) //Kill adds the value of the damage done to it. Allows for more controlled extreme death types. amount += dmgtarget->health; + if (flags & DMSS_NOPROTECT) //Ignore PowerProtection. + dmgFlags += DMG_NO_PROTECT; if (amount > 0) P_DamageMobj(dmgtarget, self, self, amount, DamageType, dmgFlags); //Should wind up passing them through just fine. diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index f806f8224..278d4b90f 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -383,6 +383,7 @@ const int DMSS_AFFECTARMOR = 2; const int DMSS_KILL = 4; const int DMSS_NOFACTOR = 8; const int DMSS_FOILBUDDHA = 16; +const int DMSS_NOPROTECT = 32; // Flags for A_AlertMonsters const int AMF_TARGETEMITTER = 1;