mirror of
https://github.com/DrBeef/Raze.git
synced 2024-12-14 22:51:42 +00:00
116 lines
1.9 KiB
Text
116 lines
1.9 KiB
Text
|
|
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();
|
|
}
|
|
}
|
|
|
|
}
|
|
|