From 53270554951a3b97d65b96b12ce444833c6dd614 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 26 Dec 2016 20:37:04 +0100 Subject: [PATCH] - fixed: Source for nailbomb damage in A_Explode should be the caller's target, if defined and the caller is a missile. --- src/p_actionfunctions.cpp | 4 ++-- src/p_local.h | 1 + src/p_map.cpp | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index 4136ec331..5bf5bf450 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -1286,9 +1286,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_Explode) { ang = i*360./nails; // Comparing the results of a test wad with Eternity, it seems A_NailBomb does not aim - P_LineAttack (self, ang, MISSILERANGE, 0., + P_LineAttack(self, ang, MISSILERANGE, 0., //P_AimLineAttack (self, ang, MISSILERANGE), - naildamage, NAME_Hitscan, pufftype); + naildamage, NAME_Hitscan, pufftype, (self->flags & MF_MISSILE) ? LAF_TARGETISSOURCE : 0); } } diff --git a/src/p_local.h b/src/p_local.h index 93bbbbf11..41f980d44 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -323,6 +323,7 @@ enum // P_LineAttack flags LAF_NORANDOMPUFFZ = 2, LAF_NOIMPACTDECAL = 4, LAF_NOINTERACT = 8, + LAF_TARGETISSOURCE = 16, }; AActor *P_LineAttack(AActor *t1, DAngle angle, double distance, DAngle pitch, int damage, FName damageType, PClassActor *pufftype, int flags = 0, FTranslatedLineTarget *victim = NULL, int *actualdamage = NULL); diff --git a/src/p_map.cpp b/src/p_map.cpp index 85c3e3da8..560b39de6 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -4476,7 +4476,9 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance, puff = P_SpawnPuff(t1, pufftype, bleedpos, 0., 0., 2, puffFlags | PF_HITTHING | PF_TEMPORARY); killPuff = true; } - newdam = P_DamageMobj(trace.Actor, puff ? puff : t1, t1, damage, damageType, dmgflags|DMG_USEANGLE, trace.SrcAngleFromTarget); + auto src = t1; + if ((flags & LAF_TARGETISSOURCE) && t1 && t1->target) src = t1->target; + newdam = P_DamageMobj(trace.Actor, puff ? puff : t1, src, damage, damageType, dmgflags|DMG_USEANGLE, trace.SrcAngleFromTarget); if (actualdamage != NULL) { *actualdamage = newdam;