raze/wadsrc/static/zscript/games/duke/actors/paper.zs

117 lines
1.9 KiB
Text
Raw Normal View History

2022-12-01 19:11:38 +00:00
class DukeMoney : DukeActor
{
default
{
statnum STAT_MISC;
spriteset "MONEY", "MONEY1";
ScaleX 0.125;
ScaleY 0.125;
}
override void Initialize()
{
self.temp_data[0] = random(0, 2047);
self.cstat = self.randomFlip();
self.angle = frandom(0, 360);
}
override void Tick()
{
let sectp = self.sector;
if (self.spriteSetIndex == 1)
{
double x;
[x, self.floorz] = sectp.getSlopes(self.pos.XY);
self.vel.Z = self.floorz;
return;
}
self.vel.X = frandom(0, 0.5) + Raze.BobVal(self.temp_data[0]) * 2;
self.temp_data[0] += random(0, 63);
if ((self.temp_data[0] & 2047) > 512 && (self.temp_data[0] & 2047) < 1596)
{
if (sectp.lotag == ST_2_UNDERWATER)
{
if (self.vel.Z < 0.25)
self.vel.Z += gs.gravity / 32. + frandom(0, 1/32.);
}
else
if (self.vel.Z < 0.5625)
self.vel.Z += gs.gravity / 32. + frandom(0, 1 / 32.);
}
self.DoMove(CLIPMASK0);
if ( random(0, 3) == 0)
self.SetPosition(self.pos);
if (self.sector == null)
{
self.Destroy();
return;
}
double x, l;
[x, l] = sectp.getSlopes(self.pos.XY);
if (self.pos.Z > l)
{
self.pos.Z = l;
self.insertspriteq();
self.setSpriteSetImage(1);
DukeStatIterator it;
for (let aa = it.First(STAT_MISC); aa; aa = it.Next())
{
if (aa.actorflag3(SFLAG3_BLOODY))
{
double dist = (aa.pos.XY - self.pos.XY).Length();
if (dist < 348/16.)
{
self.pal = 2;
break;
}
}
}
}
}
}
class DukeMail : DukeMoney
{
default
{
spriteset "MAIL", "MAIL1";
}
}
class DukePaper : DukeMoney
{
default
{
spriteset "PAPER", "PAPER1";
}
}
class RedneckFeather : DukeMoney
{
default
{
spriteset "FEATHER", "FEATHER1";
}
override void Tick()
{
Super.Tick();
if (self.sector.lotag == 800)
{
if ((self.pos.Z >= self.sector.floorz - 8) || self.spritesetindex == 1)
self.Destroy();
}
}
}