From 16bf1ef6d070c3131641493ed3d6ed62dc34f88e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 7 Jun 2009 17:04:40 +0000 Subject: [PATCH] - fixed FORCEPAIN logic. SVN r1650 (trunk) --- docs/rh-log.txt | 1 + src/p_interaction.cpp | 11 +++++++---- src/p_map.cpp | 31 ++++++++++++++++++------------- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 42bcef4253..7f24497b6a 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,5 @@ June 7, 2009 (Changes by Graf Zahl) +- fixed FORCEPAIN logic. - added Gez's infinite ammo powerup and random spawner fix patches. - reduced size of Hexen's flames to fix bug in Deathkings MAP01. - added checks for sidedef scaling values diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 6ec5bdccb2..a05ff314e6 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -878,6 +878,9 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage player_t *player = NULL; fixed_t thrust; int temp; + int painchance = 0; + FState * woundstate = NULL; + PainChanceList * pc = NULL; if (target == NULL || !(target->flags & MF_SHOOTABLE)) { // Shouldn't happen @@ -1233,7 +1236,7 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage return; } - FState * woundstate = target->FindState(NAME_Wound, mod); + woundstate = target->FindState(NAME_Wound, mod); if (woundstate != NULL) { int woundhealth = RUNTIME_TYPE(target)->Meta.GetMetaInt (AMETA_WoundHealth, 6); @@ -1244,9 +1247,9 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage return; } } - - PainChanceList * pc = target->GetClass()->ActorInfo->PainChances; - int painchance = target->PainChance; + + pc = target->GetClass()->ActorInfo->PainChances; + painchance = target->PainChance; if (pc != NULL) { BYTE * ppc = pc->CheckKey(mod); diff --git a/src/p_map.cpp b/src/p_map.cpp index af1a60f7c1..59ec6a8e2e 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -1011,21 +1011,25 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm) } // Do damage damage = tm.thing->GetMissileDamage ((tm.thing->flags4 & MF4_STRIFEDAMAGE) ? 3 : 7, 1); - if (damage > 0) + // [GZ] If MF6_FORCEPAIN is set, we need to call P_DamageMobj even if damage is 0! + if ((damage > 0) || (tm.thing->flags6 & MF6_FORCEPAIN)) { P_DamageMobj (thing, tm.thing, tm.thing->target, damage, tm.thing->DamageType); - if ((tm.thing->flags5 & MF5_BLOODSPLATTER) && - !(thing->flags & MF_NOBLOOD) && - !(thing->flags2 & MF2_REFLECTIVE) && - !(thing->flags2 & (MF2_INVULNERABLE|MF2_DORMANT)) && - !(tm.thing->flags3 & MF3_BLOODLESSIMPACT) && - (pr_checkthing() < 192)) + if (damage > 0) { - P_BloodSplatter (tm.thing->x, tm.thing->y, tm.thing->z, thing); - } - if (!(tm.thing->flags3 & MF3_BLOODLESSIMPACT)) - { - P_TraceBleed (damage, thing, tm.thing); + if ((tm.thing->flags5 & MF5_BLOODSPLATTER) && + !(thing->flags & MF_NOBLOOD) && + !(thing->flags2 & MF2_REFLECTIVE) && + !(thing->flags2 & (MF2_INVULNERABLE|MF2_DORMANT)) && + !(tm.thing->flags3 & MF3_BLOODLESSIMPACT) && + (pr_checkthing() < 192)) + { + P_BloodSplatter (tm.thing->x, tm.thing->y, tm.thing->z, thing); + } + if (!(tm.thing->flags3 & MF3_BLOODLESSIMPACT)) + { + P_TraceBleed (damage, thing, tm.thing); + } } } else if (damage < 0) @@ -3239,7 +3243,8 @@ AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, trace.Actor, srcangle, srcpitch); } } - if (damage) + // [GZ] If MF6_FORCEPAIN is set, we need to call P_DamageMobj even if damage is 0! + if (damage || puff->flags6 & MF6_FORCEPAIN) { int flags = DMG_INFLICTOR_IS_PUFF; // Allow MF5_PIERCEARMOR on a weapon as well.