mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-27 06:22:13 +00:00
- scriptified shootfireball.
This commit is contained in:
parent
76b9314f63
commit
1d887755a5
2 changed files with 49 additions and 63 deletions
|
@ -81,59 +81,6 @@ void incur_damage_d(player_struct* p)
|
|||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void shootfireball(DDukeActor *actor, int p, DVector3 pos, DAngle ang)
|
||||
{
|
||||
// World Tour's values for angles and velocities are quite arbitrary...
|
||||
double vel, zvel;
|
||||
|
||||
if (actor->spr.extra >= 0)
|
||||
actor->spr.shade = -96;
|
||||
|
||||
pos.Z -= 2;
|
||||
if (actor->spr.picnum != DTILE_BOSS5)
|
||||
vel = 840/16.;
|
||||
else {
|
||||
vel = 968/16.;
|
||||
pos.Z += 24;
|
||||
}
|
||||
|
||||
if (p < 0)
|
||||
{
|
||||
ang += DAngle22_5 / 8 - randomAngle(22.5 / 4);
|
||||
double scratch;
|
||||
int j = findplayer(actor, &scratch);
|
||||
double dist = (ps[j].GetActor()->spr.pos.XY() - actor->spr.pos.XY()).Length();
|
||||
zvel = ((ps[j].GetActor()->getPrevOffsetZ() - pos.Z + 3) * vel) / dist;
|
||||
}
|
||||
else
|
||||
{
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 49.);
|
||||
pos += (ang + DAngle1 * 61.171875).ToVector() * (1024. / 448.);
|
||||
pos.Z += 3;
|
||||
}
|
||||
|
||||
double scale = p >= 0? 0.109375 : 0.28125;
|
||||
|
||||
auto spawned = CreateActor(actor->sector(), pos, DTILE_FIREBALL, -127, DVector2(scale, scale), ang, vel, zvel, actor, (short)4);
|
||||
if (spawned)
|
||||
{
|
||||
spawned->spr.extra += (krand() & 7);
|
||||
if (actor->spr.picnum == DTILE_BOSS5 || p >= 0)
|
||||
{
|
||||
spawned->spr.scale = DVector2(0.625, 0.625);
|
||||
}
|
||||
spawned->spr.yint = p;
|
||||
spawned->spr.cstat = CSTAT_SPRITE_YCENTER;
|
||||
spawned->clipdist = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
@ -753,16 +700,6 @@ void shoot_d(DDukeActor* actor, int atwith, PClass *cls)
|
|||
if (cls && cls->IsDescendantOf(RUNTIME_CLASS(DDukeActor)) && CallShootThis(static_cast<DDukeActor*>(GetDefaultByType(cls)), actor, p, spos, sang)) return;
|
||||
if (cls && atwith == -1) atwith = GetDefaultByType(cls)->spr.picnum;
|
||||
|
||||
if (isWorldTour())
|
||||
{ // Twentieth Anniversary World Tour
|
||||
switch (atwith)
|
||||
{
|
||||
case DTILE_FIREBALL:
|
||||
shootfireball(actor, p, spos, sang);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (atwith)
|
||||
{
|
||||
case DTILE_KNEE:
|
||||
|
|
|
@ -573,6 +573,55 @@ class DukeFireball : DukeProjectile // WorldTour only
|
|||
+FULLBRIGHT;
|
||||
}
|
||||
|
||||
|
||||
override bool ShootThis(DukeActor actor, DukePlayer p, Vector3 pos, double ang) const
|
||||
{
|
||||
// World Tour's values for angles and velocities are quite arbitrary...
|
||||
double vel, zvel;
|
||||
|
||||
if (actor.extra >= 0)
|
||||
actor.shade = -96;
|
||||
|
||||
pos.Z -= 2;
|
||||
if (!(actor is 'DukeBoss5'))
|
||||
vel = 840/16.;
|
||||
else {
|
||||
vel = 968/16.;
|
||||
pos.Z += 24;
|
||||
}
|
||||
|
||||
if (p == null)
|
||||
{
|
||||
ang += 22.5 / 8 - frandom(0, 22.5 / 4);
|
||||
let j = actor.findplayer();
|
||||
double dist = (j.actor.pos.XY - actor.pos.XY).Length();
|
||||
zvel = ((j.actor.opos.z + j.actor.oviewzoffset - pos.Z + 3) * vel) / dist;
|
||||
}
|
||||
else
|
||||
{
|
||||
[vel, zvel] = Raze.setFreeAimVelocity(vel, zvel, p.getPitchWithView(), 49.);
|
||||
pos += (ang + 61.171875).ToVector() * (1024. / 448.);
|
||||
pos.Z += 3;
|
||||
}
|
||||
|
||||
double scale = 0.28125;
|
||||
|
||||
let spawned = dlevel.SpawnActor(actor.sector, pos, GetClass(), -127, (0.28125, 0.28125), ang, vel, zvel, actor, STAT_PROJECTILE);
|
||||
if (spawned)
|
||||
{
|
||||
spawned.extra += random(0, 7);
|
||||
if ((actor is 'DukeBoss5') || p)
|
||||
{
|
||||
spawned.scale = (0.625, 0.625);
|
||||
}
|
||||
//spawned.yint = p;
|
||||
spawned.cstat = CSTAT_SPRITE_YCENTER;
|
||||
spawned.clipdist = 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
override bool premoveeffect()
|
||||
{
|
||||
let Owner = self.ownerActor;
|
||||
|
|
Loading…
Reference in a new issue