mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-28 06:53:29 +00:00
9ddb5987cd
slowly getting closer to sorting this one out. The new flags already make operation a lot clearer.
123 lines
2.6 KiB
Text
123 lines
2.6 KiB
Text
class DukeShrinker : DukeActor
|
|
{
|
|
default
|
|
{
|
|
pic "SHRINKER";
|
|
}
|
|
|
|
override bool ShootThis(DukeActor shooter, DukePlayer p, Vector3 pos, double ang) const
|
|
{
|
|
double vel = 48.;
|
|
double zvel;
|
|
if (shooter.extra >= 0) shooter.shade = -96;
|
|
if (p != null)
|
|
{
|
|
let aimed = Raze.IsNamWW2GI()? null : shooter.aim(self);
|
|
if (aimed)
|
|
{
|
|
double dal = ((aimed.scale.X * aimed.spriteHeight()) * 0.5); // note the incorrect scale this uses!
|
|
double dist = (p.actor.pos.XY - aimed.pos.XY).Length();
|
|
zvel = ((aimed.pos.Z - pos.Z - dal - 4) * 48) / dist;
|
|
ang = (aimed.pos.XY - pos.XY).Angle();
|
|
}
|
|
else
|
|
[vel, zvel] = Raze.setFreeAimVelocity(vel, zvel, p.getPitchWithView(), 49.);
|
|
}
|
|
else if (shooter.statnum != STAT_EFFECTOR)
|
|
{
|
|
double x;
|
|
DukePlayer j;
|
|
[j, x] = shooter.findplayer();
|
|
double dist = (j.actor.pos.XY - shooter.pos.XY).Length();
|
|
zvel = ((j.actor.pos.Z + j.actor.viewzoffset - pos.Z) * 32) / dist;
|
|
}
|
|
else zvel = 0;
|
|
|
|
let spawned = dlevel.SpawnActor(shooter.sector, pos.plusZ(2) + ang.ToVector() * 0.25, "DukeShrinkSpark", -16, (0.4375, 0.4375), ang, vel, zvel, shooter, STAT_PROJECTILE);
|
|
|
|
if (spawned)
|
|
{
|
|
spawned.cstat = CSTAT_SPRITE_YCENTER;
|
|
spawned.clipdist = 8;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
/*
|
|
class NamShrinker : DukeShrinker
|
|
{
|
|
default
|
|
{
|
|
+NOAUTOAIM;
|
|
}
|
|
}
|
|
*/
|
|
|
|
//---------------------------------------------------------------------------
|
|
//
|
|
//
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
class DukeShrinkSpark : DukeProjectile
|
|
{
|
|
default
|
|
{
|
|
spriteset "SHRINKSPARK", "SHRINKSPARK1", "SHRINKSPARK2", "SHRINKSPARK3";
|
|
+FULLBRIGHT;
|
|
+MIRRORREFLECT;
|
|
+NOFLOORPAL;
|
|
+NOCEILINGBLAST;
|
|
+HITRADIUS_DONTHURTSHOOTER;
|
|
+HITRADIUS_NODAMAGE;
|
|
}
|
|
|
|
override void posthiteffect(CollisionData coll)
|
|
{
|
|
self.spawn('DukeShrinkerExplosion');
|
|
self.PlayActorSound("SHRINKER_HIT");
|
|
self.hitradius(gs.shrinkerblastradius, 0, 0, 0, 0);
|
|
self.Destroy();
|
|
}
|
|
|
|
override bool animate(tspritetype tspr)
|
|
{
|
|
tspr.setSpritePic(self, (PlayClock >> 4) & 3);
|
|
return true;
|
|
}
|
|
|
|
override class<DukeActor> GetRadiusDamageType(int targhealth)
|
|
{
|
|
return 'DukeShrinkSpark';
|
|
}
|
|
|
|
}
|
|
|
|
|
|
class DukeShrinkerExplosion : DukeActor
|
|
{
|
|
default
|
|
{
|
|
spriteset "SHRINKEREXPLOSION";
|
|
+FULLBRIGHT;
|
|
+FORCERUNCON;
|
|
}
|
|
|
|
override void Initialize()
|
|
{
|
|
let owner = self.ownerActor;
|
|
if (owner != self)
|
|
{
|
|
self.Angle = owner.Angle;
|
|
self.cstat = CSTAT_SPRITE_YCENTER | randomXFlip();
|
|
double c,f;
|
|
[c, f] = self.sector.getSlopes(self.pos.XY);
|
|
self.pos.Z = min(self.pos.Z, f - 12);
|
|
}
|
|
self.shade = -64;
|
|
self.scale = (0.5, 0.5);
|
|
self.ChangeStat(STAT_MISC);
|
|
}
|
|
|
|
}
|
|
|