Add species parameter to A_RadiusThrust

This is the last parameter for A_RadiusThrust() DECORATE function.
If it is omitted or none, then A_RadiusThrust will behave as usual.

If it is set for some species name, it witt thrust only that species.
Of course, these species should be +VULNERABLE to be thrustable.
This commit is contained in:
makise-homura 2020-08-20 23:55:00 +03:00 committed by drfrag
parent 0ae0bffa58
commit 9e28aeac14
5 changed files with 14 additions and 8 deletions

View file

@ -420,7 +420,7 @@ enum
}; };
int P_GetRadiusDamage(AActor *self, AActor *thing, int damage, int distance, int fulldmgdistance, bool oldradiusdmg); int P_GetRadiusDamage(AActor *self, AActor *thing, int damage, int distance, int fulldmgdistance, bool oldradiusdmg);
int P_RadiusAttack (AActor *spot, AActor *source, int damage, int distance, int P_RadiusAttack (AActor *spot, AActor *source, int damage, int distance,
FName damageType, int flags, int fulldamagedistance=0); FName damageType, int flags, int fulldamagedistance=0, FName species = NAME_None);
void P_DelSeclist(msecnode_t *, msecnode_t *sector_t::*seclisthead); void P_DelSeclist(msecnode_t *, msecnode_t *sector_t::*seclisthead);
void P_DelSeclist(portnode_t *, portnode_t *FLinePortal::*seclisthead); void P_DelSeclist(portnode_t *, portnode_t *FLinePortal::*seclisthead);

View file

@ -5890,7 +5890,7 @@ int P_GetRadiusDamage(AActor *self, AActor *thing, int damage, int distance, int
//========================================================================== //==========================================================================
int P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bombdistance, FName bombmod, int P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bombdistance, FName bombmod,
int flags, int fulldamagedistance) int flags, int fulldamagedistance, FName species)
{ {
if (bombdistance <= 0) if (bombdistance <= 0)
return 0; return 0;
@ -5938,6 +5938,11 @@ int P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bom
) )
) continue; ) continue;
if((species != NAME_None) && (thing->Species != species))
{
continue;
}
targets.Push(thing); targets.Push(thing);
} }

View file

@ -1238,9 +1238,9 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, GetRadiusDamage, P_GetRadiusDamage)
ACTION_RETURN_INT(P_GetRadiusDamage(self, thing, damage, distance, fulldmgdistance, oldradiusdmg)); ACTION_RETURN_INT(P_GetRadiusDamage(self, thing, damage, distance, fulldmgdistance, oldradiusdmg));
} }
static int RadiusAttack(AActor *self, AActor *bombsource, int bombdamage, int bombdistance, int damagetype, int flags, int fulldamagedistance) static int RadiusAttack(AActor *self, AActor *bombsource, int bombdamage, int bombdistance, int damagetype, int flags, int fulldamagedistance, int species)
{ {
return P_RadiusAttack(self, bombsource, bombdamage, bombdistance, ENamedName(damagetype), flags, fulldamagedistance); return P_RadiusAttack(self, bombsource, bombdamage, bombdistance, ENamedName(damagetype), flags, fulldamagedistance, ENamedName(species));
} }
DEFINE_ACTION_FUNCTION_NATIVE(AActor, RadiusAttack, RadiusAttack) DEFINE_ACTION_FUNCTION_NATIVE(AActor, RadiusAttack, RadiusAttack)
@ -1252,7 +1252,8 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, RadiusAttack, RadiusAttack)
PARAM_INT(damagetype); PARAM_INT(damagetype);
PARAM_INT(flags); PARAM_INT(flags);
PARAM_INT(fulldamagedistance); PARAM_INT(fulldamagedistance);
ACTION_RETURN_INT(RadiusAttack(self, bombsource, bombdamage, bombdistance, damagetype, flags, fulldamagedistance)); PARAM_INT(species);
ACTION_RETURN_INT(RadiusAttack(self, bombsource, bombdamage, bombdistance, damagetype, flags, fulldamagedistance, species));
} }
static int ZS_GetSpriteIndex(int sprt) static int ZS_GetSpriteIndex(int sprt)

View file

@ -1110,7 +1110,7 @@ class Actor : Thinker native
native void A_Burst(class<Actor> chunktype); native void A_Burst(class<Actor> chunktype);
native void A_RadiusDamageSelf(int damage = 128, double distance = 128, int flags = 0, class<Actor> flashtype = null); native void A_RadiusDamageSelf(int damage = 128, double distance = 128, int flags = 0, class<Actor> flashtype = null);
native int GetRadiusDamage(Actor thing, int damage, int distance, int fulldmgdistance = 0, bool oldradiusdmg = false); native int GetRadiusDamage(Actor thing, int damage, int distance, int fulldmgdistance = 0, bool oldradiusdmg = false);
native int RadiusAttack(Actor bombsource, int bombdamage, int bombdistance, Name bombmod = 'none', int flags = RADF_HURTSOURCE, int fulldamagedistance = 0); native int RadiusAttack(Actor bombsource, int bombdamage, int bombdistance, Name bombmod = 'none', int flags = RADF_HURTSOURCE, int fulldamagedistance = 0, name species = "None");
native void A_Respawn(int flags = 1); native void A_Respawn(int flags = 1);
native void A_RestoreSpecialPosition(); native void A_RestoreSpecialPosition();

View file

@ -613,7 +613,7 @@ extend class Actor
// //
//========================================================================== //==========================================================================
void A_RadiusThrust(int force = 128, int distance = -1, int flags = RTF_AFFECTSOURCE, int fullthrustdistance = 0) void A_RadiusThrust(int force = 128, int distance = -1, int flags = RTF_AFFECTSOURCE, int fullthrustdistance = 0, name species = "None")
{ {
if (force == 0) force = 128; if (force == 0) force = 128;
if (distance <= 0) distance = abs(force); if (distance <= 0) distance = abs(force);
@ -628,7 +628,7 @@ extend class Actor
target.bNoDamageThrust = false; target.bNoDamageThrust = false;
} }
} }
RadiusAttack (target, force, distance, DamageType, flags | RADF_NODAMAGE, fullthrustdistance); RadiusAttack (target, force, distance, DamageType, flags | RADF_NODAMAGE, fullthrustdistance, species);
CheckSplash(distance); CheckSplash(distance);
if (target) target.bNoDamageThrust = nothrust; if (target) target.bNoDamageThrust = nothrust;
} }