mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-24 21:11:26 +00:00
3a00480efd
As soon as default init for CON gets in this won't work right anymore - these must come last, not first. This commit contains all the trivial cases with no inheritance concerns.
56 lines
1.5 KiB
Text
56 lines
1.5 KiB
Text
class DukeMasterSwitch : DukeActor
|
|
{
|
|
override void Initialize()
|
|
{
|
|
self.cstat = CSTAT_SPRITE_INVISIBLE;
|
|
self.yint = 0;
|
|
self.ChangeStat(STAT_STANDABLE);
|
|
}
|
|
|
|
override void Tick()
|
|
{
|
|
if (self.yint == 1 && self.statnum == STAT_STANDABLE)
|
|
{
|
|
self.hitag--;
|
|
if (self.hitag <= 0)
|
|
{
|
|
self.operatesectors(self.sector);
|
|
|
|
DukeSectIterator it;
|
|
for (let effector = it.First(self.sector); effector; effector = it.Next())
|
|
{
|
|
if (effector.statnum == STAT_EFFECTOR)
|
|
{
|
|
// Todo: Once the effectors have been ported, do this with a virtual that can be overridden by custom effects.
|
|
switch (effector.lotag)
|
|
{
|
|
case SE_2_EARTHQUAKE:
|
|
case SE_21_DROP_FLOOR:
|
|
case SE_31_FLOOR_RISE_FALL:
|
|
case SE_32_CEILING_RISE_FALL:
|
|
case SE_36_PROJ_SHOOTER:
|
|
effector.temp_data[0] = 1;
|
|
break;
|
|
case SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT:
|
|
effector.temp_data[4] = 1;
|
|
break;
|
|
}
|
|
}
|
|
else //if (effector.statnum == STAT_STANDABLE) this check is not really needed.
|
|
{
|
|
if (effector.actorflag2(SFLAG2_BRIGHTEXPLODE)) // SEENINE and OOZFILTER
|
|
{
|
|
effector.shade = -31;
|
|
}
|
|
}
|
|
}
|
|
// we cannot delete this actor because it may be used as a sound source.
|
|
// This originally depended on undefined behavior as the deleted sprite was still used for the sound
|
|
// with no checking if it got reused in the mean time.
|
|
self.cstat |= CSTAT_SPRITE_INVISIBLE;
|
|
self.cstat2 |= CSTAT2_SPRITE_NOFIND;
|
|
self.ChangeStat(STAT_REMOVED);
|
|
}
|
|
}
|
|
}
|
|
}
|