- scriptified A_RailAttack.

This commit is contained in:
Christoph Oelckers 2018-11-24 15:12:30 +01:00
commit 4c1b3f81ab
6 changed files with 107 additions and 74 deletions

View file

@ -1626,77 +1626,6 @@ DEFINE_ACTION_FUNCTION(AStateProvider, A_JumpIfNoAmmo)
//==========================================================================
//
// customizable railgun attack function
//
//==========================================================================
DEFINE_ACTION_FUNCTION(AStateProvider, A_RailAttack)
{
PARAM_ACTION_PROLOGUE(AStateProvider);
PARAM_INT (damage);
PARAM_INT (spawnofs_xy);
PARAM_BOOL (useammo);
PARAM_COLOR (color1);
PARAM_COLOR (color2);
PARAM_INT (flags);
PARAM_FLOAT (maxdiff);
PARAM_CLASS (pufftype, AActor);
PARAM_ANGLE (spread_xy);
PARAM_ANGLE (spread_z);
PARAM_FLOAT (range) ;
PARAM_INT (duration);
PARAM_FLOAT (sparsity);
PARAM_FLOAT (driftspeed);
PARAM_CLASS (spawnclass, AActor);
PARAM_FLOAT (spawnofs_z);
PARAM_INT (SpiralOffset);
PARAM_INT (limit);
if (range == 0) range = 8192;
if (sparsity == 0) sparsity=1.0;
if (self->player == NULL)
return 0;
AWeapon *weapon = self->player->ReadyWeapon;
// only use ammo when actually hitting something!
if (useammo && weapon != NULL && ACTION_CALL_FROM_PSPRITE())
{
if (!weapon->DepleteAmmo(weapon->bAltFire, true))
return 0; // out of ammo
}
if (!(flags & RAF_EXPLICITANGLE))
{
spread_xy = spread_xy * pr_crailgun.Random2() / 255;
spread_z = spread_z * pr_crailgun.Random2() / 255;
}
FRailParams p;
p.source = self;
p.damage = damage;
p.offset_xy = spawnofs_xy;
p.offset_z = spawnofs_z;
p.color1 = color1;
p.color2 = color2;
p.maxdiff = maxdiff;
p.flags = flags;
p.puff = pufftype;
p.angleoffset = spread_xy;
p.pitchoffset = spread_z;
p.distance = range;
p.duration = duration;
p.sparsity = sparsity;
p.drift = driftspeed;
p.spawnclass = spawnclass;
p.SpiralOffset = SpiralOffset;
p.limit = limit;
P_RailAttack(&p);
return 0;
}
//==========================================================================
//
// also for monsters