- Added limit parameter to A_RailAttack and A_CustomRailgun.

This commit is contained in:
MajorCooke 2016-06-14 18:20:43 -05:00
commit 2d4eb8dde4
5 changed files with 16 additions and 4 deletions

View file

@ -334,6 +334,7 @@ struct FRailParams
double drift = 1.0;
PClassActor *spawnclass = nullptr;
int SpiralOffset = 270;
int limit = 0;
}; // [RH] Shoot a railgun
void P_RailAttack(FRailParams *params);

View file

@ -4610,6 +4610,8 @@ struct RailData
bool ThruSpecies;
bool MThruSpecies;
bool ThruActors;
int limit;
int count;
};
static ETraceStatus ProcessRailHit(FTraceResults &res, void *userdata)
@ -4664,7 +4666,11 @@ static ETraceStatus ProcessRailHit(FTraceResults &res, void *userdata)
}
data->RailHits.Push(newhit);
return data->StopAtOne ? TRACE_Stop : TRACE_Continue;
if (data->limit)
{
data->count++;
}
return (data->StopAtOne || (data->limit && (data->count >= data->limit))) ? TRACE_Stop : TRACE_Continue;
}
//==========================================================================
@ -4706,7 +4712,8 @@ void P_RailAttack(FRailParams *p)
RailData rail_data;
rail_data.Caller = source;
rail_data.limit = p->limit;
rail_data.count = 0;
rail_data.StopAtOne = !!(p->flags & RAF_NOPIERCE);
start.X = xy.X;
start.Y = xy.Y;

View file

@ -1996,6 +1996,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RailAttack)
PARAM_CLASS_OPT (spawnclass, AActor){ spawnclass = NULL; }
PARAM_FLOAT_OPT (spawnofs_z) { spawnofs_z = 0; }
PARAM_INT_OPT (SpiralOffset) { SpiralOffset = 270; }
PARAM_INT_OPT (limit) { limit = 0; }
if (range == 0) range = 8192;
if (sparsity == 0) sparsity=1.0;
@ -2036,6 +2037,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RailAttack)
p.drift = driftspeed;
p.spawnclass = spawnclass;
p.SpiralOffset = SpiralOffset;
p.limit = limit;
P_RailAttack(&p);
return 0;
}
@ -2073,6 +2075,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
PARAM_CLASS_OPT (spawnclass, AActor){ spawnclass = NULL; }
PARAM_FLOAT_OPT (spawnofs_z) { spawnofs_z = 0; }
PARAM_INT_OPT (SpiralOffset) { SpiralOffset = 270; }
PARAM_INT_OPT (limit) { limit = 0; }
if (range == 0) range = 8192.;
if (sparsity == 0) sparsity = 1;
@ -2155,6 +2158,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
p.drift = driftspeed;
p.spawnclass = spawnclass;
p.SpiralOffset = SpiralOffset;
p.limit = 0;
P_RailAttack(&p);
self->SetXYZ(savedpos);