mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
MTHRUSPECIES on puffs
You were right it's cleaner that way
This commit is contained in:
parent
5400ce1a21
commit
8c4c011ca2
1 changed files with 849 additions and 886 deletions
|
@ -3469,9 +3469,11 @@ fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **p
|
||||||
struct Origin
|
struct Origin
|
||||||
{
|
{
|
||||||
AActor *Caller;
|
AActor *Caller;
|
||||||
|
bool hitGhosts;
|
||||||
|
bool hitSameSpecie;
|
||||||
};
|
};
|
||||||
|
|
||||||
static ETraceStatus CheckForSameSpecie(FTraceResults &res, void *userdata)
|
static ETraceStatus CheckForActor(FTraceResults &res, void *userdata)
|
||||||
{
|
{
|
||||||
if (res.HitType != TRACE_HitActor)
|
if (res.HitType != TRACE_HitActor)
|
||||||
{
|
{
|
||||||
|
@ -3480,59 +3482,21 @@ static ETraceStatus CheckForSameSpecie(FTraceResults &res, void *userdata)
|
||||||
|
|
||||||
Origin *data = (Origin *)userdata;
|
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)
|
|
||||||
{
|
|
||||||
return TRACE_Stop;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check for physical attacks on a ghost
|
|
||||||
if (res.Actor->flags3 & MF3_GHOST || res.Actor->flags4 & MF4_SPECTRAL)
|
|
||||||
{
|
|
||||||
return TRACE_Skip;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRACE_Stop;
|
|
||||||
}
|
|
||||||
static ETraceStatus CheckForSpecieAndGhost(FTraceResults &res, void *userdata)
|
|
||||||
{
|
|
||||||
if (res.HitType != TRACE_HitActor)
|
|
||||||
{
|
|
||||||
return TRACE_Stop;
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
return TRACE_Stop;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check for physical attacks on spectrals
|
// check for physical attacks on spectrals
|
||||||
if (res.Actor->flags4 & MF4_SPECTRAL)
|
if (res.Actor->flags4 & MF4_SPECTRAL)
|
||||||
{
|
{
|
||||||
return TRACE_Skip;
|
return TRACE_Skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data->hitSameSpecie && res.Actor->GetSpecies() == data->Caller->GetSpecies())
|
||||||
|
{
|
||||||
|
return TRACE_Skip;
|
||||||
|
}
|
||||||
|
if (data->hitGhosts && res.Actor->flags3 & MF3_GHOST)
|
||||||
|
{
|
||||||
|
return TRACE_Skip;
|
||||||
|
}
|
||||||
|
|
||||||
return TRACE_Stop;
|
return TRACE_Stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3597,12 +3561,12 @@ 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));
|
||||||
|
|
||||||
hitSameSpecie = (puffDefaults && (puffDefaults->flags6 & MF6_MTHRUSPECIES));
|
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.
|
||||||
|
@ -3618,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 ? (hitSameSpecie ? CheckForSpecieAndGhost : CheckForGhost) : hitSameSpecie ? CheckForSameSpecie : CheckForSpectral, &TData))
|
tflags, CheckForActor, &TData))
|
||||||
{ // hit nothing
|
{ // hit nothing
|
||||||
if (puffDefaults == NULL)
|
if (puffDefaults == NULL)
|
||||||
{
|
{
|
||||||
|
@ -5317,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
|
||||||
|
|
Loading…
Reference in a new issue