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)
{
return TRACE_Stop;
}
// check for physical attacks on a ghost
if (res.Actor->flags3 & MF3_GHOST || res.Actor->flags4 & MF4_SPECTRAL)
Origin *data = (Origin *)userdata;
// check for physical attacks on spectrals
if (res.Actor->flags4 & MF4_SPECTRAL)
{
return TRACE_Skip;
}
return TRACE_Stop;
}
static ETraceStatus CheckForSpectral (FTraceResults &res, void *userdata)
if (data->hitSameSpecie && res.Actor->GetSpecies() == data->Caller->GetSpecies())
{
if (res.HitType != TRACE_HitActor)
{
return TRACE_Stop;
return TRACE_Skip;
}
// check for physical attacks on spectrals
if (res.Actor->flags4 & MF4_SPECTRAL)
if (data->hitGhosts && res.Actor->flags3 & MF3_GHOST)
{
return TRACE_Skip;
}
@ -3511,9 +3513,12 @@ AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance,
{
fixed_t vx, vy, vz, shootz;
FTraceResults trace;
Origin TData;
TData.Caller = t1;
angle_t srcangle = angle;
int srcpitch = pitch;
bool hitGhosts;
bool hitSameSpecie;
bool killPuff = false;
AActor *puff = NULL;
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
AActor *puffDefaults = GetDefaultByType(pufftype->GetReplacement());
hitGhosts = (t1->player != NULL &&
TData.hitGhosts = (t1->player != NULL &&
t1->player->ReadyWeapon != NULL &&
(t1->player->ReadyWeapon->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.
// All other explicitly passed damage types (currenty only MDK) will be preserved.
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,
MF_SHOOTABLE, ML_BLOCKEVERYTHING | ML_BLOCKHITSCAN, t1, trace,
tflags, hitGhosts ? CheckForGhost : CheckForSpectral))
tflags, CheckForActor, &TData))
{ // hit nothing
if (puffDefaults == NULL)
{
@ -5274,8 +5281,7 @@ bool P_ChangeSector (sector_t *sector, int crunch, int amt, int floorOrCeil, boo
break;
}
}
}
while (n);
} while (n);
}
}
P_Recalculate3DFloors(sector); // Must recalculate the 3d floor and light lists