mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-15 08:41:59 +00:00
added SMMU-BFG11k-style 'damrad' property to A_BFGSpray
This commit is contained in:
parent
8e8248284a
commit
481ef7a5b5
2 changed files with 35 additions and 2 deletions
|
@ -653,6 +653,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray)
|
|||
PARAM_ANGLE_OPT (vrange) { vrange = 0.; }
|
||||
PARAM_INT_OPT (defdamage) { defdamage = 0; }
|
||||
PARAM_INT_OPT (flags) { flags = 0; }
|
||||
PARAM_FLOAT_OPT (damrad) { damrad = 0; }
|
||||
|
||||
int i;
|
||||
int j;
|
||||
|
@ -660,6 +661,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray)
|
|||
DAngle an;
|
||||
FTranslatedLineTarget t;
|
||||
AActor *originator;
|
||||
double origdist;
|
||||
|
||||
if (spraytype == NULL) spraytype = PClass::FindActor("BFGExtra");
|
||||
if (numrays <= 0) numrays = 40;
|
||||
|
@ -672,7 +674,38 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray)
|
|||
if (!self->target)
|
||||
return 0;
|
||||
|
||||
// [XA] Set the originator of the attack to the projectile (self) if
|
||||
// [XA] If damrad is set, check the originator and hurt them if too close.
|
||||
// adapted from SMMU's BFG11K code with fraggle's blessing.
|
||||
origdist = self->Distance2D(self->target);
|
||||
if (origdist < damrad)
|
||||
{
|
||||
// [XA] Decrease damage with distance. This uses SMMU's formula
|
||||
// and is included mainly for emulation's sake. For more
|
||||
// customization, seek out A_Explode rather than this.
|
||||
damage = 0;
|
||||
for (j = 0; j < (damrad / 2) - (origdist / 2); ++j)
|
||||
damage += (pr_bfgspray() & 7) + 1;
|
||||
|
||||
// [XA] flash n' damage -- some slight copypasta here, but it works.
|
||||
AActor *spray = Spawn(spraytype, self->target->PosPlusZ(self->target->Height / 4), ALLOW_REPLACE);
|
||||
|
||||
int dmgFlags = 0;
|
||||
FName dmgType = NAME_BFGSplash;
|
||||
|
||||
if (spray != NULL)
|
||||
{
|
||||
// [XA] skip the species check since we've already decided to damage oneself.
|
||||
if (spray->flags5 & MF5_PUFFGETSOWNER) spray->target = self->target;
|
||||
if (spray->flags3 & MF3_FOILINVUL) dmgFlags |= DMG_FOILINVUL;
|
||||
if (spray->flags7 & MF7_FOILBUDDHA) dmgFlags |= DMG_FOILBUDDHA;
|
||||
dmgType = spray->DamageType;
|
||||
}
|
||||
|
||||
int selfdam = P_DamageMobj(self->target, self, self->target, damage, dmgType, dmgFlags);
|
||||
P_TraceBleed(selfdam > 0 ? selfdam : damage, self->target, self);
|
||||
}
|
||||
|
||||
// [XA] Set the originator of the rays 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;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ ACTOR Actor native //: Thinker
|
|||
// End of MBF redundant functions.
|
||||
|
||||
action native A_MonsterRail();
|
||||
action native A_BFGSpray(class<Actor> 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_BFGSpray(class<Actor> 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, float damrad = 0);
|
||||
action native A_Pain();
|
||||
action native A_NoBlocking();
|
||||
action native A_XScream();
|
||||
|
|
Loading…
Reference in a new issue