- Turned A_Explode's affectsource parameter into a flags parameter and added XF_NOTMISSILE

and RTF_NOTMISSILE so that you can use A_Explode and A_RadiusThrust with non-missiles without
  them telling P_RadiusAttack() that the target is the source.

SVN r3860 (trunk)
This commit is contained in:
Randy Heit 2012-08-30 04:01:50 +00:00
parent 7af13c8d52
commit 6a91335841
15 changed files with 60 additions and 36 deletions

View file

@ -3367,7 +3367,7 @@ void FParser::SF_RadiusAttack()
if (spot && source)
{
P_RadiusAttack(spot, source, damage, damage, NAME_None, true);
P_RadiusAttack(spot, source, damage, damage, NAME_None, RADF_HURTSOURCE);
}
}
}

View file

@ -136,7 +136,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_VileAttack)
target->y - FixedMul (24*FRACUNIT, finesine[an]),
target->z);
P_RadiusAttack (fire, self, blastdmg, blastrad, dmgtype, false);
P_RadiusAttack (fire, self, blastdmg, blastrad, dmgtype, 0);
}
target->velz = Scale(thrust, 1000, target->Mass);
}

View file

@ -141,7 +141,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Mushroom)
if (n == 0) n = self->Damage; // GetMissileDamage (0, 1);
if (spawntype == NULL) spawntype = PClass::FindClass("FatShot");
P_RadiusAttack (self, self->target, 128, 128, self->DamageType, !(flags & MSF_DontHurt));
P_RadiusAttack (self, self->target, 128, 128, self->DamageType, (flags & MSF_DontHurt) ? 0 : RADF_HURTSOURCE);
P_CheckSplash(self, 128<<FRACBITS);
// Now launch mushroom cloud

View file

@ -50,7 +50,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_TimeBomb)
self->z += 32*FRACUNIT;
self->RenderStyle = STYLE_Add;
self->alpha = FRACUNIT;
P_RadiusAttack (self, self->target, 128, 128, self->DamageType, true);
P_RadiusAttack (self, self->target, 128, 128, self->DamageType, RADF_HURTSOURCE);
P_CheckSplash(self, 128<<FRACBITS);
}

View file

@ -198,7 +198,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_VolcBallImpact)
self->z += 28*FRACUNIT;
//self->velz = 3*FRACUNIT;
}
P_RadiusAttack (self, self->target, 25, 25, NAME_Fire, true);
P_RadiusAttack (self, self->target, 25, 25, NAME_Fire, RADF_HURTSOURCE);
for (i = 0; i < 4; i++)
{
tiny = Spawn("VolcanoTBlast", self->x, self->y, self->z, ALLOW_REPLACE);

View file

@ -420,7 +420,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PoisonBagDamage)
{
int bobIndex;
P_RadiusAttack (self, self->target, 4, 40, self->DamageType, true);
P_RadiusAttack (self, self->target, 4, 40, self->DamageType, RADF_HURTSOURCE);
bobIndex = self->special2;
self->z += finesine[bobIndex << BOBTOFINESHIFT] >> 1;
self->special2 = (bobIndex + 1) & 63;

View file

@ -683,7 +683,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DropFire)
{
AActor *drop = Spawn("FireDroplet", self->x, self->y, self->z + 24*FRACUNIT, ALLOW_REPLACE);
drop->velz = -FRACUNIT;
P_RadiusAttack (self, self, 64, 64, NAME_Fire, false);
P_RadiusAttack (self, self, 64, 64, NAME_Fire, 0);
}
DEFINE_ACTION_FUNCTION(AActor, A_CrispyPlayer)

View file

@ -567,7 +567,7 @@ int APhosphorousFire::DoSpecialDamage (AActor *target, int damage, FName damaget
DEFINE_ACTION_FUNCTION(AActor, A_BurnArea)
{
P_RadiusAttack (self, self->target, 128, 128, self->DamageType, true);
P_RadiusAttack (self, self->target, 128, 128, self->DamageType, RADF_HURTSOURCE);
}
DEFINE_ACTION_FUNCTION(AActor, A_Burnination)

View file

@ -69,7 +69,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ExtraLightOff)
DEFINE_ACTION_FUNCTION(AActor, A_Explode512)
{
P_RadiusAttack (self, self->target, 512, 512, NAME_None, true);
P_RadiusAttack (self, self->target, 512, 512, NAME_None, RADF_HURTSOURCE);
if (self->target != NULL && self->target->player != NULL)
{
self->target->player->extralight = 5;

View file

@ -3161,7 +3161,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Die)
DEFINE_ACTION_FUNCTION(AActor, A_Detonate)
{
int damage = self->GetMissileDamage (0, 1);
P_RadiusAttack (self, self->target, damage, damage, self->DamageType, true);
P_RadiusAttack (self, self->target, damage, damage, self->DamageType, RADF_HURTSOURCE);
P_CheckSplash(self, damage<<FRACBITS);
}

View file

@ -479,8 +479,15 @@ void P_PlaySpawnSound(AActor *missile, AActor *spawner);
void P_AimCamera (AActor *t1, fixed_t &x, fixed_t &y, fixed_t &z, sector_t *&sec);
// [RH] Means of death
enum
{
RADF_HURTSOURCE = 1,
RADF_NOIMPACTDAMAGE = 2,
RADF_SOURCEISSPOT = 4,
RADF_NODAMAGE = 8,
};
void P_RadiusAttack (AActor *spot, AActor *source, int damage, int distance,
FName damageType, bool hurtSelf, bool dodamage=true, int fulldamagedistance=0, bool noimpactdamage=false);
FName damageType, int flags, int fulldamagedistance=0);
void P_DelSector_List();
void P_DelSeclist(msecnode_t *); // phares 3/16/98

View file

@ -4442,7 +4442,7 @@ CUSTOM_CVAR (Float, splashfactor, 1.f, CVAR_SERVERINFO)
//==========================================================================
void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int bombdistance, FName bombmod,
bool DamageSource, bool bombdodamage, int fulldamagedistance, bool noimpactdamage)
int flags, int fulldamagedistance)
{
if (bombdistance <= 0)
return;
@ -4456,6 +4456,11 @@ void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int b
FBlockThingsIterator it(FBoundingBox(bombspot->x, bombspot->y, bombdistance<<FRACBITS));
AActor *thing;
if (flags & RADF_SOURCEISSPOT)
{ // The source is actually the same as the spot, even if that wasn't what we receized.
bombsource = bombspot;
}
while ((thing = it.Next()))
{
// Vulnerable actors can be damaged by radius attacks even if not shootable
@ -4468,7 +4473,7 @@ void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int b
if (thing->flags3 & MF3_NORADIUSDMG && !(bombspot->flags4 & MF4_FORCERADIUSDMG))
continue;
if (!DamageSource && (thing == bombsource || thing == bombspot))
if (!(flags & RADF_HURTSOURCE) && (thing == bombsource || thing == bombspot))
{ // don't damage the source of the explosion
continue;
}
@ -4488,7 +4493,7 @@ void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int b
// them far too "active." BossBrains also use the old code
// because some user levels require they have a height of 16,
// which can make them near impossible to hit with the new code.
if (!bombdodamage || !((bombspot->flags5 | thing->flags5) & MF5_OLDRADIUSDMG))
if ((flags & RADF_NODAMAGE) || !((bombspot->flags5 | thing->flags5) & MF5_OLDRADIUSDMG))
{
// [RH] New code. The bounding box only covers the
// height of the thing and not the height of the map.
@ -4547,14 +4552,17 @@ void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int b
double thrust;
int damage = (int)points;
if (bombdodamage) P_DamageMobj (thing, bombspot, bombsource, damage, bombmod);
else if (thing->player == NULL && !noimpactdamage) thing->flags2 |= MF2_BLASTED;
if (!(flags & RADF_NODAMAGE))
P_DamageMobj (thing, bombspot, bombsource, damage, bombmod);
else if (thing->player == NULL && !(flags & RADF_NOIMPACTDAMAGE))
thing->flags2 |= MF2_BLASTED;
if (!(thing->flags & MF_ICECORPSE))
{
if (bombdodamage && !(bombspot->flags3 & MF3_BLOODLESSIMPACT)) P_TraceBleed (damage, thing, bombspot);
if (!(flags & RADF_NODAMAGE) && !(bombspot->flags3 & MF3_BLOODLESSIMPACT))
P_TraceBleed (damage, thing, bombspot);
if (!bombdodamage || !(bombspot->flags2 & MF2_NODMGTHRUST))
if (!(flags & RADF_NODAMAGE) || !(bombspot->flags2 & MF2_NODMGTHRUST))
{
if (bombsource == NULL || !(bombsource->flags2 & MF2_NODMGTHRUST))
{
@ -4575,7 +4583,7 @@ void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int b
angle_t ang = R_PointToAngle2 (bombspot->x, bombspot->y, thing->x, thing->y) >> ANGLETOFINESHIFT;
thing->velx += fixed_t (finecosine[ang] * thrust);
thing->vely += fixed_t (finesine[ang] * thrust);
if (bombdodamage)
if (!(flags & RADF_NODAMAGE))
thing->velz += (fixed_t)velz; // this really doesn't work well
}
}

View file

@ -727,12 +727,18 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfArmorType)
//
//==========================================================================
enum
{
XF_HURTSOURCE = 1,
XF_NOTMISSILE = 4,
};
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Explode)
{
ACTION_PARAM_START(8);
ACTION_PARAM_INT(damage, 0);
ACTION_PARAM_INT(distance, 1);
ACTION_PARAM_BOOL(hurtSource, 2);
ACTION_PARAM_INT(flags, 2);
ACTION_PARAM_BOOL(alert, 3);
ACTION_PARAM_INT(fulldmgdistance, 4);
ACTION_PARAM_INT(nails, 5);
@ -743,7 +749,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Explode)
{
damage = self->GetClass()->Meta.GetMetaInt (ACMETA_ExplosionDamage, 128);
distance = self->GetClass()->Meta.GetMetaInt (ACMETA_ExplosionRadius, damage);
hurtSource = !self->GetClass()->Meta.GetMetaInt (ACMETA_DontHurtShooter);
flags = !self->GetClass()->Meta.GetMetaInt (ACMETA_DontHurtShooter);
alert = false;
}
else
@ -766,7 +772,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Explode)
}
}
P_RadiusAttack (self, self->target, damage, distance, self->DamageType, hurtSource, true, fulldmgdistance);
P_RadiusAttack (self, self->target, damage, distance, self->DamageType, flags, fulldmgdistance);
P_CheckSplash(self, distance<<FRACBITS);
if (alert && self->target != NULL && self->target->player != NULL)
{
@ -775,43 +781,41 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Explode)
}
}
enum
{
RTF_AFFECTSOURCE = 1,
RTF_NOIMPACTDAMAGE = 2,
};
//==========================================================================
//
// A_RadiusThrust
//
//==========================================================================
enum
{
RTF_AFFECTSOURCE = 1,
RTF_NOIMPACTDAMAGE = 2,
RTF_NOTMISSILE = 4,
};
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusThrust)
{
ACTION_PARAM_START(3);
ACTION_PARAM_INT(force, 0);
ACTION_PARAM_INT(distance, 1);
ACTION_PARAM_INT(thrustFlags, 2);
ACTION_PARAM_INT(flags, 2);
ACTION_PARAM_INT(fullthrustdistance, 3);
bool affectSource = !!(thrustFlags & RTF_AFFECTSOURCE);
bool noimpactdamage = !!(thrustFlags & RTF_NOIMPACTDAMAGE);
bool sourcenothrust = false;
if (force <= 0) force = 128;
if (distance <= 0) distance = force;
// Temporarily negate MF2_NODMGTHRUST on the shooter, since it renders this function useless.
if (self->target != NULL && self->target->flags2 & MF2_NODMGTHRUST)
if (!(flags & RTF_NOTMISSILE) && self->target != NULL && self->target->flags2 & MF2_NODMGTHRUST)
{
sourcenothrust = true;
self->target->flags2 &= ~MF2_NODMGTHRUST;
}
int sourceflags2 = self->target != NULL ? self->target->flags2 : 0;
P_RadiusAttack (self, self->target, force, distance, self->DamageType, affectSource, false, fullthrustdistance, noimpactdamage);
P_RadiusAttack (self, self->target, force, distance, self->DamageType, flags | RADF_NODAMAGE, fullthrustdistance);
P_CheckSplash(self, distance << FRACBITS);
if (sourcenothrust)

View file

@ -253,8 +253,8 @@ ACTOR Actor native //: Thinker
action native A_CustomComboAttack(class<Actor> missiletype, float spawnheight, int damage, sound meleesound = "", name damagetype = "none", bool bleed = true);
action native A_Burst(class<Actor> chunktype);
action native A_Blast(int flags = 0, int strength = 255, int radius = 255, float speed = 20, class<Actor> blasteffect = "BlastEffect", sound blastsound = "BlastRadius");
action native A_RadiusThrust(int force = 128, int distance = -1, bool affectsource = true, int fullthrustdistance = 0);
action native A_Explode(int damage = -1, int distance = -1, bool hurtsource = true, bool alert = false, int fulldamagedistance = 0, int nails = 0, int naildamage = 10, class<Actor> pufftype = "BulletPuff");
action native A_RadiusThrust(int force = 128, int distance = -1, int flags = RTF_AFFECTSOURCE, int fullthrustdistance = 0);
action native A_Explode(int damage = -1, int distance = -1, int flags = XF_HURTSOURCE, bool alert = false, int fulldamagedistance = 0, int nails = 0, int naildamage = 10, class<Actor> pufftype = "BulletPuff");
action native A_Stop();
action native A_Respawn(int flags = 1);
action native A_BarrelDestroy();

View file

@ -124,9 +124,14 @@ const int MSF_Standard = 0;
const int MSF_Classic = 1;
const int MSF_DontHurt = 2;
// Flags for A_Explode
const int XF_HURTSOURCE = 1;
const int XF_NOTMISSILE = 4;
// Flags for A_RadiusThrust
const int RTF_AFFECTSOURCE = 1;
const int RTF_NOIMPACTDAMAGE = 2;
const int RTF_NOTMISSILE = 4;
// Flags for A_Blast
const int BF_USEAMMO = 1;