diff --git a/src/g_doom/a_doomweaps.cpp b/src/g_doom/a_doomweaps.cpp index 21119f8a0b..95ce633428 100644 --- a/src/g_doom/a_doomweaps.cpp +++ b/src/g_doom/a_doomweaps.cpp @@ -636,6 +636,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireBFG) // A_BFGSpray // Spawn a BFG explosion on every monster in view // +enum BFG_Flags +{ + BFGF_HURTSOURCE = 1, + BFGF_MISSILEORIGIN = 2, +}; + DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray) { PARAM_ACTION_PROLOGUE; @@ -646,12 +652,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray) PARAM_FLOAT_OPT (distance) { distance = 0; } PARAM_ANGLE_OPT (vrange) { vrange = 0.; } PARAM_INT_OPT (defdamage) { defdamage = 0; } + PARAM_INT_OPT (flags) { flags = 0; } int i; int j; int damage; DAngle an; FTranslatedLineTarget t; + AActor *originator; if (spraytype == NULL) spraytype = PClass::FindActor("BFGExtra"); if (numrays <= 0) numrays = 40; @@ -664,13 +672,16 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray) if (!self->target) return 0; + // [XA] Set the originator of the attack to the projectile (self) if + // the new flag is set, else set it to the player (self->target) + originator = (flags & BFGF_MISSILEORIGIN) ? self : self->target; + // offset angles from its attack angle for (i = 0; i < numrays; i++) { an = self->Angles.Yaw - angle / 2 + angle / numrays*i; - // self->target is the originator (player) of the missile - P_AimLineAttack(self->target, an, distance, &t, vrange); + P_AimLineAttack(originator, an, distance, &t, vrange); if (t.linetarget != NULL) { @@ -681,7 +692,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray) if (spray != NULL) { - if (spray->flags6 & MF6_MTHRUSPECIES && self->target->GetSpecies() == t.linetarget->GetSpecies()) + if ((spray->flags6 & MF6_MTHRUSPECIES && self->target->GetSpecies() == t.linetarget->GetSpecies()) || + (!(flags & BFGF_HURTSOURCE) && self->target == t.linetarget)) // [XA] Don't hit oneself unless we say so. { spray->Destroy(); // [MC] Remove it because technically, the spray isn't trying to "hit" them. continue; @@ -704,7 +716,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray) damage = defdamage; } - int newdam = P_DamageMobj(t.linetarget, self->target, self->target, damage, dmgType, dmgFlags|DMG_USEANGLE, t.angleFromSource.Degrees); + int newdam = P_DamageMobj(t.linetarget, originator, self->target, damage, dmgType, dmgFlags|DMG_USEANGLE, t.angleFromSource.Degrees); P_TraceBleed(newdam > 0 ? newdam : damage, &t, self); } } diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 0d5e8e2dea..7e43196900 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -56,7 +56,7 @@ ACTOR Actor native //: Thinker // End of MBF redundant functions. action native A_MonsterRail(); - action native A_BFGSpray(class spraytype = "BFGExtra", int numrays = 40, int damagecount = 15, float/*angle*/ angle = 90, float distance = 16*64, float/*angle*/ vrange = 32, int damage = 0); + action native A_BFGSpray(class spraytype = "BFGExtra", int numrays = 40, int damagecount = 15, float/*angle*/ angle = 90, float distance = 16*64, float/*angle*/ vrange = 32, int damage = 0, int flags = 0); action native A_Pain(); action native A_NoBlocking(); action native A_XScream(); diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index f5072d55eb..813e561952 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -18,6 +18,10 @@ const int SF_NOPULLIN = 32; const int SF_NOTURN = 64; const int SF_STEALARMOR = 128; +// Flags for A_BFGSpray +const int BFGF_HURTSOURCE = 1; +const int BFGF_MISSILEORIGIN = 2; + // Flags for A_CustomMissile const int CMF_AIMOFFSET = 1; const int CMF_AIMDIRECTION = 2;