This commit is contained in:
Rachael Alexanderson 2017-05-17 22:15:48 -04:00
commit 1472627f6a
4 changed files with 16 additions and 7 deletions

View file

@ -328,10 +328,11 @@ enum // P_LineAttack flags
LAF_NOIMPACTDECAL = 4, LAF_NOIMPACTDECAL = 4,
LAF_NOINTERACT = 8, LAF_NOINTERACT = 8,
LAF_TARGETISSOURCE = 16, LAF_TARGETISSOURCE = 16,
LAF_OVERRIDEZ = 32,
}; };
AActor *P_LineAttack(AActor *t1, DAngle angle, double distance, DAngle pitch, int damage, FName damageType, PClassActor *pufftype, int flags = 0, FTranslatedLineTarget *victim = NULL, int *actualdamage = NULL); AActor *P_LineAttack(AActor *t1, DAngle angle, double distance, DAngle pitch, int damage, FName damageType, PClassActor *pufftype, int flags = 0, FTranslatedLineTarget *victim = NULL, int *actualdamage = NULL, double sz = 0.0);
AActor *P_LineAttack(AActor *t1, DAngle angle, double distance, DAngle pitch, int damage, FName damageType, FName pufftype, int flags = 0, FTranslatedLineTarget *victim = NULL, int *actualdamage = NULL); AActor *P_LineAttack(AActor *t1, DAngle angle, double distance, DAngle pitch, int damage, FName damageType, FName pufftype, int flags = 0, FTranslatedLineTarget *victim = NULL, int *actualdamage = NULL, double sz = 0.0);
void P_TraceBleed(int damage, const DVector3 &pos, AActor *target, DAngle angle, DAngle pitch); void P_TraceBleed(int damage, const DVector3 &pos, AActor *target, DAngle angle, DAngle pitch);
void P_TraceBleed(int damage, AActor *target, DAngle angle, DAngle pitch); void P_TraceBleed(int damage, AActor *target, DAngle angle, DAngle pitch);

View file

@ -4390,7 +4390,7 @@ static ETraceStatus CheckForActor(FTraceResults &res, void *userdata)
//========================================================================== //==========================================================================
AActor *P_LineAttack(AActor *t1, DAngle angle, double distance, AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
DAngle pitch, int damage, FName damageType, PClassActor *pufftype, int flags, FTranslatedLineTarget*victim, int *actualdamage) DAngle pitch, int damage, FName damageType, PClassActor *pufftype, int flags, FTranslatedLineTarget*victim, int *actualdamage, double sz)
{ {
bool nointeract = !!(flags & LAF_NOINTERACT); bool nointeract = !!(flags & LAF_NOINTERACT);
DVector3 direction; DVector3 direction;
@ -4435,6 +4435,12 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
shootz += 8; shootz += 8;
} }
// [MC] If overriding, set it to the base of the actor.
// Offset by the amount specified.
if (flags & LAF_OVERRIDEZ)
shootz = t1->Z();
shootz += sz;
// We need to check the defaults of the replacement here // We need to check the defaults of the replacement here
AActor *puffDefaults = GetDefaultByType(pufftype->GetReplacement()); AActor *puffDefaults = GetDefaultByType(pufftype->GetReplacement());
@ -4691,7 +4697,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
} }
AActor *P_LineAttack(AActor *t1, DAngle angle, double distance, AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
DAngle pitch, int damage, FName damageType, FName pufftype, int flags, FTranslatedLineTarget *victim, int *actualdamage) DAngle pitch, int damage, FName damageType, FName pufftype, int flags, FTranslatedLineTarget *victim, int *actualdamage, double sz)
{ {
PClassActor *type = PClass::FindActor(pufftype); PClassActor *type = PClass::FindActor(pufftype);
if (type == NULL) if (type == NULL)
@ -4705,7 +4711,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
} }
else else
{ {
return P_LineAttack(t1, angle, distance, pitch, damage, damageType, type, flags, victim, actualdamage); return P_LineAttack(t1, angle, distance, pitch, damage, damageType, type, flags, victim, actualdamage, sz);
} }
} }
@ -4720,10 +4726,11 @@ DEFINE_ACTION_FUNCTION(AActor, LineAttack)
PARAM_CLASS(puffType, AActor); PARAM_CLASS(puffType, AActor);
PARAM_INT_DEF(flags); PARAM_INT_DEF(flags);
PARAM_POINTER_DEF(victim, FTranslatedLineTarget); PARAM_POINTER_DEF(victim, FTranslatedLineTarget);
PARAM_FLOAT_DEF(offsetz);
int acdmg; int acdmg;
if (puffType == nullptr) puffType = PClass::FindActor("BulletPuff"); // P_LineAttack does not work without a puff to take info from. if (puffType == nullptr) puffType = PClass::FindActor("BulletPuff"); // P_LineAttack does not work without a puff to take info from.
auto puff = P_LineAttack(self, angle, distance, pitch, damage, damageType, puffType, flags, victim, &acdmg); auto puff = P_LineAttack(self, angle, distance, pitch, damage, damageType, puffType, flags, victim, &acdmg, offsetz);
if (numret > 0) ret[0].SetObject(puff); if (numret > 0) ret[0].SetObject(puff);
if (numret > 1) ret[1].SetInt(acdmg), numret = 2; if (numret > 1) ret[1].SetInt(acdmg), numret = 2;
return numret; return numret;

View file

@ -585,7 +585,7 @@ class Actor : Thinker native
native virtual int DamageMobj(Actor inflictor, Actor source, int damage, Name mod, int flags = 0, double angle = 0); native virtual int DamageMobj(Actor inflictor, Actor source, int damage, Name mod, int flags = 0, double angle = 0);
native void PoisonMobj (Actor inflictor, Actor source, int damage, int duration, int period, Name type); native void PoisonMobj (Actor inflictor, Actor source, int damage, int duration, int period, Name type);
native double AimLineAttack(double angle, double distance, out FTranslatedLineTarget pLineTarget = null, double vrange = 0., int flags = 0, Actor target = null, Actor friender = null); native double AimLineAttack(double angle, double distance, out FTranslatedLineTarget pLineTarget = null, double vrange = 0., int flags = 0, Actor target = null, Actor friender = null);
native Actor, int LineAttack(double angle, double distance, double pitch, int damage, Name damageType, class<Actor> pufftype, int flags = 0, out FTranslatedLineTarget victim = null); native Actor, int LineAttack(double angle, double distance, double pitch, int damage, Name damageType, class<Actor> pufftype, int flags = 0, out FTranslatedLineTarget victim = null, double offsetz = 0.);
native bool CheckSight(Actor target, int flags = 0); native bool CheckSight(Actor target, int flags = 0);
native bool IsVisible(Actor other, bool allaround, LookExParams params = null); native bool IsVisible(Actor other, bool allaround, LookExParams params = null);
native bool HitFriend(); native bool HitFriend();

View file

@ -881,6 +881,7 @@ enum ELineAttackFlags
LAF_NORANDOMPUFFZ = 2, LAF_NORANDOMPUFFZ = 2,
LAF_NOIMPACTDECAL = 4, LAF_NOIMPACTDECAL = 4,
LAF_NOINTERACT = 8, LAF_NOINTERACT = 8,
LAF_OVERRIDEZ = 32,
} }
const DEFMELEERANGE = 64; const DEFMELEERANGE = 64;