mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-27 14:20:59 +00:00
Added MTHRUSPECIES support for rails and sprays.
This commit is contained in:
parent
b6ca1947ff
commit
9a09fbd7ed
2 changed files with 28 additions and 9 deletions
src
|
@ -621,8 +621,16 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray)
|
|||
AActor *spray = Spawn(spraytype, linetarget->x, linetarget->y,
|
||||
linetarget->z + (linetarget->height >> 2), ALLOW_REPLACE);
|
||||
|
||||
if (spray && (spray->flags5 & MF5_PUFFGETSOWNER))
|
||||
if (spray)
|
||||
{
|
||||
if (spray->flags6 & MF6_MTHRUSPECIES && spray->GetSpecies() == linetarget->GetSpecies())
|
||||
{
|
||||
spray->Destroy(); // [MC] Remove it because technically, the spray isn't trying to "hit" them.
|
||||
continue;
|
||||
}
|
||||
if (spray->flags5 & MF5_PUFFGETSOWNER)
|
||||
spray->target = self->target;
|
||||
}
|
||||
|
||||
if (defdamage == 0)
|
||||
{
|
||||
|
|
|
@ -4099,9 +4099,11 @@ struct SRailHit
|
|||
};
|
||||
struct RailData
|
||||
{
|
||||
AActor *Caller;
|
||||
TArray<SRailHit> RailHits;
|
||||
bool StopAtOne;
|
||||
bool StopAtInvul;
|
||||
bool ThruSpecies;
|
||||
};
|
||||
|
||||
static ETraceStatus ProcessRailHit(FTraceResults &res, void *userdata)
|
||||
|
@ -4118,6 +4120,12 @@ static ETraceStatus ProcessRailHit(FTraceResults &res, void *userdata)
|
|||
return TRACE_Stop;
|
||||
}
|
||||
|
||||
// Skip actors with the same species if the puff has MTHRUSPECIES.
|
||||
if (data->ThruSpecies && res.Actor->GetSpecies() == data->Caller->GetSpecies())
|
||||
{
|
||||
return TRACE_Skip;
|
||||
}
|
||||
|
||||
// Save this thing for damaging later, and continue the trace
|
||||
SRailHit newhit;
|
||||
newhit.HitActor = res.Actor;
|
||||
|
@ -4172,6 +4180,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
|
|||
y1 += offset_xy * finesine[angle];
|
||||
|
||||
RailData rail_data;
|
||||
rail_data.Caller = source;
|
||||
|
||||
rail_data.StopAtOne = !!(railflags & RAF_NOPIERCE);
|
||||
start.X = FIXED2FLOAT(x1);
|
||||
|
@ -4185,7 +4194,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
|
|||
|
||||
flags = (puffDefaults->flags6 & MF6_NOTRIGGER) ? 0 : TRACE_PCross | TRACE_Impact;
|
||||
rail_data.StopAtInvul = (puffDefaults->flags3 & MF3_FOILINVUL) ? false : true;
|
||||
|
||||
rail_data.ThruSpecies = (puffDefaults->flags6 & MF6_MTHRUSPECIES) ? true : false;
|
||||
Trace(x1, y1, shootz, source->Sector, vx, vy, vz,
|
||||
distance, MF_SHOOTABLE, ML_BLOCKEVERYTHING, source, trace,
|
||||
flags, ProcessRailHit, &rail_data);
|
||||
|
@ -4201,6 +4210,8 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
|
|||
|
||||
for (i = 0; i < rail_data.RailHits.Size(); i++)
|
||||
{
|
||||
|
||||
|
||||
fixed_t x, y, z;
|
||||
bool spawnpuff;
|
||||
bool bleed = false;
|
||||
|
|
Loading…
Reference in a new issue