mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 06:53:40 +00:00
added BFGF_HURTSOURCE and BFGF_MISSILEORIGIN to A_BFGSpray
This commit is contained in:
parent
2d4eb8dde4
commit
8e8248284a
3 changed files with 21 additions and 5 deletions
|
@ -636,6 +636,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireBFG)
|
||||||
// A_BFGSpray
|
// A_BFGSpray
|
||||||
// Spawn a BFG explosion on every monster in view
|
// 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)
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray)
|
||||||
{
|
{
|
||||||
PARAM_ACTION_PROLOGUE;
|
PARAM_ACTION_PROLOGUE;
|
||||||
|
@ -646,12 +652,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray)
|
||||||
PARAM_FLOAT_OPT (distance) { distance = 0; }
|
PARAM_FLOAT_OPT (distance) { distance = 0; }
|
||||||
PARAM_ANGLE_OPT (vrange) { vrange = 0.; }
|
PARAM_ANGLE_OPT (vrange) { vrange = 0.; }
|
||||||
PARAM_INT_OPT (defdamage) { defdamage = 0; }
|
PARAM_INT_OPT (defdamage) { defdamage = 0; }
|
||||||
|
PARAM_INT_OPT (flags) { flags = 0; }
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
int damage;
|
int damage;
|
||||||
DAngle an;
|
DAngle an;
|
||||||
FTranslatedLineTarget t;
|
FTranslatedLineTarget t;
|
||||||
|
AActor *originator;
|
||||||
|
|
||||||
if (spraytype == NULL) spraytype = PClass::FindActor("BFGExtra");
|
if (spraytype == NULL) spraytype = PClass::FindActor("BFGExtra");
|
||||||
if (numrays <= 0) numrays = 40;
|
if (numrays <= 0) numrays = 40;
|
||||||
|
@ -664,13 +672,16 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray)
|
||||||
if (!self->target)
|
if (!self->target)
|
||||||
return 0;
|
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
|
// offset angles from its attack angle
|
||||||
for (i = 0; i < numrays; i++)
|
for (i = 0; i < numrays; i++)
|
||||||
{
|
{
|
||||||
an = self->Angles.Yaw - angle / 2 + angle / numrays*i;
|
an = self->Angles.Yaw - angle / 2 + angle / numrays*i;
|
||||||
|
|
||||||
// self->target is the originator (player) of the missile
|
P_AimLineAttack(originator, an, distance, &t, vrange);
|
||||||
P_AimLineAttack(self->target, an, distance, &t, vrange);
|
|
||||||
|
|
||||||
if (t.linetarget != NULL)
|
if (t.linetarget != NULL)
|
||||||
{
|
{
|
||||||
|
@ -681,7 +692,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray)
|
||||||
|
|
||||||
if (spray != NULL)
|
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.
|
spray->Destroy(); // [MC] Remove it because technically, the spray isn't trying to "hit" them.
|
||||||
continue;
|
continue;
|
||||||
|
@ -704,7 +716,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray)
|
||||||
damage = defdamage;
|
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);
|
P_TraceBleed(newdam > 0 ? newdam : damage, &t, self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ ACTOR Actor native //: Thinker
|
||||||
// End of MBF redundant functions.
|
// End of MBF redundant functions.
|
||||||
|
|
||||||
action native A_MonsterRail();
|
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);
|
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_Pain();
|
action native A_Pain();
|
||||||
action native A_NoBlocking();
|
action native A_NoBlocking();
|
||||||
action native A_XScream();
|
action native A_XScream();
|
||||||
|
|
|
@ -18,6 +18,10 @@ const int SF_NOPULLIN = 32;
|
||||||
const int SF_NOTURN = 64;
|
const int SF_NOTURN = 64;
|
||||||
const int SF_STEALARMOR = 128;
|
const int SF_STEALARMOR = 128;
|
||||||
|
|
||||||
|
// Flags for A_BFGSpray
|
||||||
|
const int BFGF_HURTSOURCE = 1;
|
||||||
|
const int BFGF_MISSILEORIGIN = 2;
|
||||||
|
|
||||||
// Flags for A_CustomMissile
|
// Flags for A_CustomMissile
|
||||||
const int CMF_AIMOFFSET = 1;
|
const int CMF_AIMOFFSET = 1;
|
||||||
const int CMF_AIMDIRECTION = 2;
|
const int CMF_AIMDIRECTION = 2;
|
||||||
|
|
Loading…
Reference in a new issue