Hitscan attacks can now hit SPECTRAL actors if the hitscan puff has SPECTRAL flag set

This commit is contained in:
Cacodemon345 2021-01-20 00:44:16 +06:00 committed by Rachael Alexanderson
parent 3c5f5f392f
commit b5f80bb69c

View file

@ -4394,6 +4394,7 @@ struct Origin
bool ThruSpecies; bool ThruSpecies;
bool ThruActors; bool ThruActors;
bool UseThruBits; bool UseThruBits;
bool Spectral;
uint32_t ThruBits; uint32_t ThruBits;
}; };
@ -4407,12 +4408,14 @@ static ETraceStatus CheckForActor(FTraceResults &res, void *userdata)
Origin *data = (Origin *)userdata; Origin *data = (Origin *)userdata;
// Skip actors if the puff has: // Skip actors if the puff has:
// 1. THRUACTORS or SPECTRAL // 1. THRUACTORS
// 2. MTHRUSPECIES on puff and the shooter has same species as the hit actor // 2. SPECTRAL (unless the puff has SPECTRAL)
// 3. THRUSPECIES on puff and the puff has same species as the hit actor // 3. MTHRUSPECIES on puff and the shooter has same species as the hit actor
// 4. THRUGHOST on puff and the GHOST flag on the hit actor // 4. THRUSPECIES on puff and the puff has same species as the hit actor
// 5. THRUGHOST on puff and the GHOST flag on the hit actor
if ((data->ThruActors) || (res.Actor->flags4 & MF4_SPECTRAL) || if ((data->ThruActors) ||
(!(data->Spectral) && res.Actor->flags4 & MF4_SPECTRAL) ||
(data->MThruSpecies && res.Actor->GetSpecies() == data->Caller->GetSpecies()) || (data->MThruSpecies && res.Actor->GetSpecies() == data->Caller->GetSpecies()) ||
(data->ThruSpecies && res.Actor->GetSpecies() == data->PuffSpecies) || (data->ThruSpecies && res.Actor->GetSpecies() == data->PuffSpecies) ||
(data->hitGhosts && res.Actor->flags3 & MF3_GHOST)) (data->hitGhosts && res.Actor->flags3 & MF3_GHOST))
@ -4490,6 +4493,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
spawnSky = (puffDefaults && (puffDefaults->flags3 & MF3_SKYEXPLODE)); spawnSky = (puffDefaults && (puffDefaults->flags3 & MF3_SKYEXPLODE));
TData.MThruSpecies = (puffDefaults && (puffDefaults->flags6 & MF6_MTHRUSPECIES)); TData.MThruSpecies = (puffDefaults && (puffDefaults->flags6 & MF6_MTHRUSPECIES));
TData.PuffSpecies = NAME_None; TData.PuffSpecies = NAME_None;
TData.Spectral = (puffDefaults && (puffDefaults->flags4 & MF4_SPECTRAL));
// [MC] To prevent possible mod breakage, this flag is pretty much necessary. // [MC] To prevent possible mod breakage, this flag is pretty much necessary.
// Somewhere, someone is relying on these to spawn on actors and move through them. // Somewhere, someone is relying on these to spawn on actors and move through them.