raze/wadsrc/static/zscript/games/duke/actors/watersplash.zs
Christoph Oelckers 4a306a21dc - split several texture flags off into a surface type value.
Using the same field in the TexExtInfo struct as Blood's surfType.
This frees up a lot of flags for later use.
2022-12-18 13:56:54 +01:00

99 lines
1.9 KiB
Text

class DukeWatersplash : DukeActor
{
default
{
shade -16;
statnum STAT_MISC;
spriteset "WATERSPLASH2", "WATERSPLASH2A", "WATERSPLASH2B", "WATERSPLASH2C", "WATERSPLASH2D";
}
override void Initialize()
{
let Owner = self.ownerActor;
let sectp = self.sector;
if (Owner && !self.mapSpawned)
{
self.SetPosition(Owner.pos);
double s = 0.125 + random(0, 7) * REPEAT_SCALE;
self.scale = (s, s);
}
else
{
double s = 0.25 + random(0, 15) * REPEAT_SCALE;
self.scale = (s, s);
}
self.cstat |= CSTAT_SPRITE_YCENTER;
if (Owner)
{
double c, f;
[c, f] = self.sector.getSlopes(self.pos.XY);
if (Owner.sector.lotag == ST_2_UNDERWATER)
{
self.pos.Z = c + 16;
self.cstat |= CSTAT_SPRITE_YFLIP;
}
else if (Owner.sector.lotag == ST_1_ABOVE_WATER)
self.pos.Z = f;
}
if ((dlevel.floorsurface(sectp) == Duke.TSURF_SLIME) || (dlevel.ceilingsurface(sectp) & Duke.TSURF_SLIME))
self.pal = 7;
self.ChangeStat(STAT_MISC);
}
void DoTick(bool check)
{
let sectp = self.sector;
self.temp_data[0]++;
if (self.temp_data[0] == 1)
{
if (check)
{
self.Destroy();
return;
}
if (!Duke.CheckSoundPlaying("ITEM_SPLASH"))
self.PlayActorSound("ITEM_SPLASH");
}
if (self.temp_data[0] == 3)
{
self.temp_data[0] = 0;
self.temp_data[1]++;
}
if (self.temp_data[1] == 5)
{
self.Destroy();
return;
}
self.setspritesetImage(self.temp_data[1]);
}
override void Tick()
{
let sectp = self.sector;
DoTick(sectp.lotag != ST_1_ABOVE_WATER && sectp.lotag != ST_2_UNDERWATER);
}
}
class RedneckMudSplash : DukeWatersplash
{
default
{
spriteset "MUD", "MUD1", "MUD2", "MUD3", "MUD4";
}
override void Initialize()
{
Super.Initialize();
self.cstat |= CSTAT_SPRITE_BLOCK_ALL;
}
override void Tick()
{
let sectp = self.sector;
DoTick(dlevel.floorsurface(sectp) & Duke.TSURF_MUDDY);
}
}