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

145 lines
2.6 KiB
Text
Raw Normal View History

2022-12-01 19:11:38 +00:00
class DukeBloodPool : DukeActor
{
default
{
pic "BLOODPOOL";
+BLOODY;
+SE24_REMOVE;
2022-12-01 19:11:38 +00:00
}
virtual void SetPalette()
{
let Owner = self.ownerActor;
if (Owner && !mapSpawned)
2022-12-01 19:11:38 +00:00
{
if (Owner.pal == 1)
self.pal = 1; // Blue
else if (Owner.pal == 6 || Owner.bGREENBLOOD)
2022-12-01 19:11:38 +00:00
{
self.pal = 0; // Green
self.temp_data[0] = 1; // this hurts!
2022-12-01 19:11:38 +00:00
}
else if (Owner.bBROWNBLOOD)
2022-12-01 19:11:38 +00:00
self.pal = 7; // Brown
else
self.pal = 2; // Red
}
}
override void Initialize()
{
if (!checkLocationForFloorSprite(6.75)) return;
SetPalette();
self.cstat |= CSTAT_SPRITE_ALIGNMENT_FLOOR;
if (!self.mapSpawned)
2022-12-01 19:11:38 +00:00
self.scale = (REPEAT_SCALE, REPEAT_SCALE);
self.ChangeStat(STAT_MISC);
2022-12-01 19:11:38 +00:00
}
override void Tick()
{
let sectp = self.sector;
if (self.counter == 0)
2022-12-01 19:11:38 +00:00
{
self.counter = 1;
2022-12-01 19:11:38 +00:00
if (sectp.floorstat & CSTAT_SECTOR_SLOPE)
{
self.Destroy();
return;
}
else self.insertspriteq();
}
if (Raze.isRR() && self.sector.lotag == 800)
{
self.Destroy();
return;
}
self.makeitfall();
double xx;
DukePlayer plr;
[plr, xx] = self.findplayer();
self.pos.Z = self.floorz - 0.125;
if (self.temp_data[2] < 32)
{
self.temp_data[2]++;
if (self.detail == 1)
{
if (self.scale.X < 1 && self.scale.Y < 1)
{
self.scale.X += (random(0, 3) * REPEAT_SCALE);
self.scale.Y += (random(0, 3) * REPEAT_SCALE);
}
}
else
{
if (self.scale.X < 0.5 && self.scale.Y < 0.5)
{
self.scale.X += (random(0, 3) * REPEAT_SCALE);
self.scale.Y += (random(0, 3) * REPEAT_SCALE);
}
}
}
if (xx < 844 / 16. && self.scale.X > 0.09375 && self.scale.Y > 0.09375)
{
if (random(0, 256) < 16 && self.temp_data[0])
2022-12-01 19:11:38 +00:00
{
if (plr.boot_amount > 0)
plr.boot_amount--;
else
{
if (!plr.actor.CheckSoundPlaying("PLAYER_LONGTERM_PAIN"))
plr.actor.PlayActorSound("PLAYER_LONGTERM_PAIN");
plr.actor.extra--;
plr.pals = Color(32, 16, 0, 0);
}
}
if (self.temp_data[1] == 1) return;
self.temp_data[1] = 1;
if (self.detail == 1)
plr.footprintcount = 10;
else plr.footprintcount = 3;
plr.footprintpal = self.pal;
plr.footprintshade = self.shade;
if (self.temp_data[2] == 32)
{
self.scale.X += (-0.09375);
self.scale.Y += (-0.09375);
}
}
else self.temp_data[1] = 0;
}
override bool Animate(tspritetype t)
{
if (self.shade == 127) t.shade = self.shade;
if (t.pal == 6) t.shade = -127;
return true;
}
}
class DukePuke : DukeBloodPool
{
default
{
pic "PUKE";
-BLOODY;
2022-12-01 19:11:38 +00:00
}
override bool Animate(tspritetype t)
{
if (self.shade == 127) t.shade = self.shade;
return true;
}
}