Extend SKYEXPLODE flag for LineAttack

This commit is contained in:
Cacodemon345 2018-11-02 11:14:02 +06:00 committed by drfrag666
parent 84585d9507
commit 57e51debec
8 changed files with 52 additions and 8 deletions

View file

@ -110,7 +110,8 @@ enum EPuffFlags
PF_MELEERANGE = 2,
PF_TEMPORARY = 4,
PF_HITTHINGBLEED = 8,
PF_NORANDOMZ = 16
PF_NORANDOMZ = 16,
PF_HITSKY = 32
};
AActor *P_SpawnPuff(AActor *source, PClassActor *pufftype, const DVector3 &pos, DAngle hitdir, DAngle particledir, int updown, int flags = 0, AActor *vict = NULL);

View file

@ -4632,9 +4632,13 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
damageType = puffDefaults->DamageType;
}
int tflags;
if (nointeract || (puffDefaults && puffDefaults->flags6 & MF6_NOTRIGGER)) tflags = TRACE_NoSky;
else tflags = TRACE_NoSky | TRACE_Impact;
uint32_t tflags = TRACE_NoSky | TRACE_Impact;
if (nointeract || (puffDefaults && puffDefaults->flags6 & MF6_NOTRIGGER)) tflags &= ~TRACE_Impact;
if (spawnSky)
{
tflags &= ~TRACE_NoSky;
tflags |= TRACE_HitSky;
}
// [MC] Check the flags and set the position according to what is desired.
// LAF_ABSPOSITION: Treat the offset parameters as direct coordinates.
@ -4692,8 +4696,16 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
{
if (trace.HitType != TRACE_HitActor)
{
if (trace.HitType == TRACE_HasHitSky || (trace.HitType == TRACE_HitWall
&& trace.Line->special == Line_Horizon && spawnSky))
{
puffFlags |= PF_HITSKY;
}
P_GeometryLineAttack(trace, t1, damage, damageType);
// position a bit closer for puffs
if (nointeract || trace.HitType != TRACE_HitWall || ((trace.Line->special != Line_Horizon) || spawnSky))
{

View file

@ -6259,7 +6259,11 @@ AActor *P_SpawnPuff (AActor *source, PClassActor *pufftype, const DVector3 &pos1
// it will enter the crash state. This is used by the StrifeSpark
// and BlasterPuff.
FState *crashstate;
if (!(flags & PF_HITTHING) && (crashstate = puff->FindState(NAME_Crash)) != NULL)
if ((flags & PF_HITSKY) && (crashstate = puff->FindState(NAME_Death, NAME_Sky, true)) != NULL)
{
puff->SetState (crashstate);
}
else if (!(flags & PF_HITTHING) && (crashstate = puff->FindState(NAME_Crash)) != NULL)
{
puff->SetState (crashstate);
}

View file

@ -940,6 +940,27 @@ bool FTraceInfo::CheckPlane (const secplane_t &plane)
static bool EditTraceResult (uint32_t flags, FTraceResults &res)
{
if (flags & TRACE_HitSky)
{ // Throw away sky hits
if (res.HitType == TRACE_HitFloor || res.HitType == TRACE_HitCeiling)
{
if (res.HitTexture == skyflatnum)
{
res.HitType = TRACE_HasHitSky;
return true;
}
}
else if (res.HitType == TRACE_HitWall)
{
if (res.Tier == TIER_Upper &&
res.Line->frontsector->GetTexture(sector_t::ceiling) == skyflatnum &&
res.Line->backsector->GetTexture(sector_t::ceiling) == skyflatnum)
{
res.HitType = TRACE_HasHitSky;
return true;
}
}
}
if (flags & TRACE_NoSky)
{ // Throw away sky hits
if (res.HitType == TRACE_HitFloor || res.HitType == TRACE_HitCeiling)

View file

@ -52,6 +52,7 @@ enum ETraceResult
TRACE_HitWall,
TRACE_HitActor,
TRACE_CrossingPortal,
TRACE_HasHitSky,
};
enum
@ -98,6 +99,7 @@ enum
TRACE_PortalRestrict= 0x0008, // Cannot go through portals without a static link offset.
TRACE_ReportPortals = 0x0010, // Report any portal crossing to the TraceCallback
TRACE_3DCallback = 0x0020, // [ZZ] use TraceCallback to determine whether we need to go through a line to do 3D floor check, or not. without this, only line flag mask is used
TRACE_HitSky = 0x0040, // Hitting the sky returns TRACE_HasHitSky
};
// return values from callback

View file

@ -38,7 +38,8 @@ struct FLineTraceData
TRACE_HitCeiling,
TRACE_HitWall,
TRACE_HitActor,
TRACE_CrossingPortal
TRACE_CrossingPortal,
TRACE_HasHitSky
};
Actor HitActor;

View file

@ -497,6 +497,7 @@ enum ETraceFlags
TRACE_PortalRestrict = 0x0008, // Cannot go through portals without a static link offset.
TRACE_ReportPortals = 0x0010, // Report any portal crossing to the TraceCallback
//TRACE_3DCallback = 0x0020, // [ZZ] use TraceCallback to determine whether we need to go through a line to do 3D floor check, or not. without this, only line flag mask is used
TRACE_HitSky = 0x0040 // Hitting the sky returns TRACE_HasHitSky
}
@ -507,7 +508,8 @@ enum ETraceResult
TRACE_HitCeiling,
TRACE_HitWall,
TRACE_HitActor,
TRACE_CrossingPortal
TRACE_CrossingPortal,
TRACE_HasHitSky
}
enum ELineTier

View file

@ -1122,7 +1122,8 @@ enum EPuffFlags
PF_MELEERANGE = 2,
PF_TEMPORARY = 4,
PF_HITTHINGBLEED = 8,
PF_NORANDOMZ = 16
PF_NORANDOMZ = 16,
PF_HITSKY = 32
};
enum EPlayerCheats