Merge branch 'master' of github.com:rheit/zdoom

This commit is contained in:
Randy Heit 2014-08-07 22:28:35 -05:00
commit 75dc7de632

View file

@ -3466,31 +3466,33 @@ 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;
bool hitGhosts;
bool hitSameSpecie;
};
static ETraceStatus CheckForActor(FTraceResults &res, void *userdata)
{ {
if (res.HitType != TRACE_HitActor) if (res.HitType != TRACE_HitActor)
{ {
return TRACE_Stop; return TRACE_Stop;
} }
// check for physical attacks on a ghost Origin *data = (Origin *)userdata;
if (res.Actor->flags3 & MF3_GHOST || res.Actor->flags4 & MF4_SPECTRAL)
// check for physical attacks on spectrals
if (res.Actor->flags4 & MF4_SPECTRAL)
{ {
return TRACE_Skip; return TRACE_Skip;
} }
return TRACE_Stop; if (data->hitSameSpecie && res.Actor->GetSpecies() == data->Caller->GetSpecies())
}
static ETraceStatus CheckForSpectral (FTraceResults &res, void *userdata)
{ {
if (res.HitType != TRACE_HitActor) return TRACE_Skip;
{
return TRACE_Stop;
} }
if (data->hitGhosts && res.Actor->flags3 & MF3_GHOST)
// check for physical attacks on spectrals
if (res.Actor->flags4 & MF4_SPECTRAL)
{ {
return TRACE_Skip; return TRACE_Skip;
} }
@ -3511,9 +3513,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;
@ -3556,11 +3561,13 @@ AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance,
// 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());
hitGhosts = (t1->player != NULL && TData.hitGhosts = (t1->player != NULL &&
t1->player->ReadyWeapon != NULL && t1->player->ReadyWeapon != NULL &&
(t1->player->ReadyWeapon->flags2 & MF2_THRUGHOST)) || (t1->player->ReadyWeapon->flags2 & MF2_THRUGHOST)) ||
(puffDefaults && (puffDefaults->flags2 & MF2_THRUGHOST)); (puffDefaults && (puffDefaults->flags2 & MF2_THRUGHOST));
TData.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 +3582,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, CheckForActor, &TData))
{ // hit nothing { // hit nothing
if (puffDefaults == NULL) if (puffDefaults == NULL)
{ {
@ -5274,8 +5281,7 @@ bool P_ChangeSector (sector_t *sector, int crunch, int amt, int floorOrCeil, boo
break; break;
} }
} }
} } while (n);
while (n);
} }
} }
P_Recalculate3DFloors(sector); // Must recalculate the 3d floor and light lists P_Recalculate3DFloors(sector); // Must recalculate the 3d floor and light lists