+MTHRUSPECIES on puffs

This commit is contained in:
Leonard2 2014-08-07 15:50:21 +02:00
parent 1d02ad3aa2
commit 5400ce1a21

View file

@ -3466,7 +3466,29 @@ fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **p
// //
//========================================================================== //==========================================================================
static ETraceStatus CheckForGhost (FTraceResults &res, void *userdata) struct Origin
{
AActor *Caller;
};
static ETraceStatus CheckForSameSpecie(FTraceResults &res, void *userdata)
{
if (res.HitType != TRACE_HitActor)
{
return TRACE_Stop;
}
Origin *data = (Origin *)userdata;
// check for physical attacks on the same specie
if (res.Actor->GetSpecies() == data->Caller->GetSpecies() || res.Actor->flags4 & MF4_SPECTRAL)
{
return TRACE_Skip;
}
return TRACE_Stop;
}
static ETraceStatus CheckForGhost(FTraceResults &res, void *userdata)
{ {
if (res.HitType != TRACE_HitActor) if (res.HitType != TRACE_HitActor)
{ {
@ -3481,8 +3503,24 @@ static ETraceStatus CheckForGhost (FTraceResults &res, void *userdata)
return TRACE_Stop; return TRACE_Stop;
} }
static ETraceStatus CheckForSpecieAndGhost(FTraceResults &res, void *userdata)
{
if (res.HitType != TRACE_HitActor)
{
return TRACE_Stop;
}
static ETraceStatus CheckForSpectral (FTraceResults &res, void *userdata) Origin *data = (Origin *)userdata;
// check for physical attacks
if (res.Actor->GetSpecies() == data->Caller->GetSpecies() || res.Actor->flags3 & MF3_GHOST || res.Actor->flags4 & MF4_SPECTRAL)
{
return TRACE_Skip;
}
return TRACE_Stop;
}
static ETraceStatus CheckForSpectral(FTraceResults &res, void *userdata)
{ {
if (res.HitType != TRACE_HitActor) if (res.HitType != TRACE_HitActor)
{ {
@ -3511,9 +3549,12 @@ AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance,
{ {
fixed_t vx, vy, vz, shootz; fixed_t vx, vy, vz, shootz;
FTraceResults trace; FTraceResults trace;
Origin TData;
TData.Caller = t1;
angle_t srcangle = angle; angle_t srcangle = angle;
int srcpitch = pitch; int srcpitch = pitch;
bool hitGhosts; bool hitGhosts;
bool hitSameSpecie;
bool killPuff = false; bool killPuff = false;
AActor *puff = NULL; AActor *puff = NULL;
int pflag = 0; int pflag = 0;
@ -3561,6 +3602,8 @@ AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance,
(t1->player->ReadyWeapon->flags2 & MF2_THRUGHOST)) || (t1->player->ReadyWeapon->flags2 & MF2_THRUGHOST)) ||
(puffDefaults && (puffDefaults->flags2 & MF2_THRUGHOST)); (puffDefaults && (puffDefaults->flags2 & MF2_THRUGHOST));
hitSameSpecie = (puffDefaults && (puffDefaults->flags6 & MF6_MTHRUSPECIES));
// if the puff uses a non-standard damage type, this will override default, hitscan and melee damage type. // if the puff uses a non-standard damage type, this will override default, hitscan and melee damage type.
// All other explicitly passed damage types (currenty only MDK) will be preserved. // All other explicitly passed damage types (currenty only MDK) will be preserved.
if ((damageType == NAME_None || damageType == NAME_Melee || damageType == NAME_Hitscan) && if ((damageType == NAME_None || damageType == NAME_Melee || damageType == NAME_Hitscan) &&
@ -3575,7 +3618,7 @@ AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance,
if (!Trace (t1->x, t1->y, shootz, t1->Sector, vx, vy, vz, distance, if (!Trace (t1->x, t1->y, shootz, t1->Sector, vx, vy, vz, distance,
MF_SHOOTABLE, ML_BLOCKEVERYTHING|ML_BLOCKHITSCAN, t1, trace, MF_SHOOTABLE, ML_BLOCKEVERYTHING|ML_BLOCKHITSCAN, t1, trace,
tflags, hitGhosts ? CheckForGhost : CheckForSpectral)) tflags, hitGhosts ? (hitSameSpecie ? CheckForSpecieAndGhost : CheckForGhost) : hitSameSpecie ? CheckForSameSpecie : CheckForSpectral, &TData))
{ // hit nothing { // hit nothing
if (puffDefaults == NULL) if (puffDefaults == NULL)
{ {