raze/wadsrc/static/zscript/games/duke/actors/glasspieces.zs
Christoph Oelckers 60af1b4c62 - renamed temp_data[0] to 'counter' and map temp_data[5] to the now free temp_data[0].
This not only matches its use in CON but seems to be used as a counter in most other places as well.
The main reason is to improve readability of CON to ZScript conversions.
2023-04-12 21:54:33 +02:00

64 lines
919 B
Text

class DukeGlassPieces : DukeActor
{
default
{
spriteset "GLASSPIECES";
}
override void Tick()
{
let sectp = self.sector;
self.makeitfall();
if (self.vel.Z > 16) self.vel.Z = 16;
if (sectp == null)
{
self.Destroy();
return;
}
if (self.pos.Z == self.floorz - 1 && self.counter < 3)
{
self.vel.Z = -(3 - self.counter) - frandom(0, 2);
if (sectp.lotag == 2)
self.vel.Z *= 0.5;
self.scale *= 0.5;
if (Duke.rnd(96))
self.SetPosition(self.pos);
self.counter++;//Number of bounces
}
else if (self.counter == 3)
{
self.Destroy();
return;
}
if(self.vel.X > 0)
{
self.vel.X -= 1/8.;
self.cstat = randomFlip();
}
else self.vel.X = 0;
self.DoMove(CLIPMASK0);
}
}
class DukeGlassPieces1 : DukeGlassPieces
{
default
{
spriteset "GLASSPIECES1";
}
}
class DukeGlassPieces2 : DukeGlassPieces
{
default
{
spriteset "GLASSPIECES2";
}
}