mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-07 07:21:01 +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
|
@ -610,19 +610,27 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray)
|
||||||
// offset angles from its attack angle
|
// offset angles from its attack angle
|
||||||
for (i = 0; i < numrays; i++)
|
for (i = 0; i < numrays; i++)
|
||||||
{
|
{
|
||||||
an = self->angle - angle/2 + angle/numrays*i;
|
an = self->angle - angle / 2 + angle / numrays*i;
|
||||||
|
|
||||||
// self->target is the originator (player) of the missile
|
// self->target is the originator (player) of the missile
|
||||||
P_AimLineAttack (self->target, an, distance, &linetarget, vrange);
|
P_AimLineAttack(self->target, an, distance, &linetarget, vrange);
|
||||||
|
|
||||||
if (!linetarget)
|
if (!linetarget)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
AActor *spray = Spawn (spraytype, linetarget->x, linetarget->y,
|
AActor *spray = Spawn(spraytype, linetarget->x, linetarget->y,
|
||||||
linetarget->z + (linetarget->height>>2), ALLOW_REPLACE);
|
linetarget->z + (linetarget->height >> 2), ALLOW_REPLACE);
|
||||||
|
|
||||||
if (spray && (spray->flags5 & MF5_PUFFGETSOWNER))
|
if (spray)
|
||||||
spray->target = self->target;
|
{
|
||||||
|
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)
|
if (defdamage == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4099,9 +4099,11 @@ struct SRailHit
|
||||||
};
|
};
|
||||||
struct RailData
|
struct RailData
|
||||||
{
|
{
|
||||||
|
AActor *Caller;
|
||||||
TArray<SRailHit> RailHits;
|
TArray<SRailHit> RailHits;
|
||||||
bool StopAtOne;
|
bool StopAtOne;
|
||||||
bool StopAtInvul;
|
bool StopAtInvul;
|
||||||
|
bool ThruSpecies;
|
||||||
};
|
};
|
||||||
|
|
||||||
static ETraceStatus ProcessRailHit(FTraceResults &res, void *userdata)
|
static ETraceStatus ProcessRailHit(FTraceResults &res, void *userdata)
|
||||||
|
@ -4118,6 +4120,12 @@ static ETraceStatus ProcessRailHit(FTraceResults &res, void *userdata)
|
||||||
return TRACE_Stop;
|
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
|
// Save this thing for damaging later, and continue the trace
|
||||||
SRailHit newhit;
|
SRailHit newhit;
|
||||||
newhit.HitActor = res.Actor;
|
newhit.HitActor = res.Actor;
|
||||||
|
@ -4172,7 +4180,8 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
|
||||||
y1 += offset_xy * finesine[angle];
|
y1 += offset_xy * finesine[angle];
|
||||||
|
|
||||||
RailData rail_data;
|
RailData rail_data;
|
||||||
|
rail_data.Caller = source;
|
||||||
|
|
||||||
rail_data.StopAtOne = !!(railflags & RAF_NOPIERCE);
|
rail_data.StopAtOne = !!(railflags & RAF_NOPIERCE);
|
||||||
start.X = FIXED2FLOAT(x1);
|
start.X = FIXED2FLOAT(x1);
|
||||||
start.Y = FIXED2FLOAT(y1);
|
start.Y = FIXED2FLOAT(y1);
|
||||||
|
@ -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;
|
flags = (puffDefaults->flags6 & MF6_NOTRIGGER) ? 0 : TRACE_PCross | TRACE_Impact;
|
||||||
rail_data.StopAtInvul = (puffDefaults->flags3 & MF3_FOILINVUL) ? false : true;
|
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,
|
Trace(x1, y1, shootz, source->Sector, vx, vy, vz,
|
||||||
distance, MF_SHOOTABLE, ML_BLOCKEVERYTHING, source, trace,
|
distance, MF_SHOOTABLE, ML_BLOCKEVERYTHING, source, trace,
|
||||||
flags, ProcessRailHit, &rail_data);
|
flags, ProcessRailHit, &rail_data);
|
||||||
|
@ -4201,13 +4210,15 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
|
||||||
|
|
||||||
for (i = 0; i < rail_data.RailHits.Size(); i++)
|
for (i = 0; i < rail_data.RailHits.Size(); i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
fixed_t x, y, z;
|
fixed_t x, y, z;
|
||||||
bool spawnpuff;
|
bool spawnpuff;
|
||||||
bool bleed = false;
|
bool bleed = false;
|
||||||
|
|
||||||
int puffflags = PF_HITTHING;
|
int puffflags = PF_HITTHING;
|
||||||
AActor *hitactor = rail_data.RailHits[i].HitActor;
|
AActor *hitactor = rail_data.RailHits[i].HitActor;
|
||||||
fixed_t hitdist = rail_data.RailHits[i].Distance;
|
fixed_t hitdist = rail_data.RailHits[i].Distance;
|
||||||
|
|
||||||
x = x1 + FixedMul(hitdist, vx);
|
x = x1 + FixedMul(hitdist, vx);
|
||||||
y = y1 + FixedMul(hitdist, vy);
|
y = y1 + FixedMul(hitdist, vy);
|
||||||
|
|
Loading…
Reference in a new issue