2022-11-24 06:42:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
class DukeGenericDestructible : DukeActor
|
|
|
|
{
|
|
|
|
TextureID spawnstate, brokenstate;
|
|
|
|
Sound breaksound;
|
2022-11-25 19:54:51 +00:00
|
|
|
int fullbright;
|
|
|
|
int broken;
|
2022-11-24 06:42:17 +00:00
|
|
|
|
|
|
|
native bool SetBroken(bool bust); // sets broken texture. Must be done natively as long as we do not have proper texture support.
|
|
|
|
|
|
|
|
virtual bool DestroyAction() { return false; } // for customized subclasses
|
|
|
|
|
|
|
|
override void Initialize()
|
|
|
|
{
|
|
|
|
self.SetBroken(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
override void OnHit(DukeActor proj)
|
|
|
|
{
|
|
|
|
if (broken) return;
|
|
|
|
|
|
|
|
broken = true;
|
|
|
|
bool res1 = self.SetBroken(true);
|
|
|
|
bool res2 = DestroyAction();
|
|
|
|
if (res1 || res2)
|
|
|
|
self.Destroy();
|
|
|
|
}
|
2022-11-25 19:54:51 +00:00
|
|
|
|
|
|
|
override bool Animate(tspritetype tspr)
|
|
|
|
{
|
|
|
|
if (fullbright & (1 << broken)) tspr.shade = -127;
|
|
|
|
return true;
|
|
|
|
}
|
2022-11-24 06:42:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class DukeGenericDamagingDestructible : DukeGenericDestructible
|
|
|
|
{
|
|
|
|
override bool DestroyAction()
|
|
|
|
{
|
|
|
|
self.hitradius(10, 0, 0, 1, 1);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class DukeGenericGlassSpawningDestructible : DukeGenericDestructible
|
|
|
|
{
|
|
|
|
override bool DestroyAction()
|
|
|
|
{
|
|
|
|
self.lotsofglass(10);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-25 19:54:51 +00:00
|
|
|
class DukeGenericScrapSpawningDestructible : DukeGenericDestructible
|
|
|
|
{
|
|
|
|
override bool DestroyAction()
|
|
|
|
{
|
|
|
|
for(int i = 0; i < 16; i++) self.RandomScrap();
|
|
|
|
self.Destroy();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-24 06:42:17 +00:00
|
|
|
class DukeGenericUnblockingDestructible : DukeGenericDestructible
|
|
|
|
{
|
|
|
|
override bool DestroyAction()
|
|
|
|
{
|
|
|
|
self.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-25 19:54:51 +00:00
|
|
|
class DukeGenericSolidScrapSpawningDestructible : DukeGenericDestructible
|
|
|
|
{
|
|
|
|
override void Initialize()
|
|
|
|
{
|
|
|
|
self.SetBroken(false);
|
|
|
|
self.cstat |= CSTAT_SPRITE_BLOCK_ALL;
|
|
|
|
}
|
|
|
|
|
|
|
|
override bool DestroyAction()
|
|
|
|
{
|
|
|
|
for(int i = 0; i < 16; i++) self.RandomScrap();
|
|
|
|
self.Destroy();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2022-11-24 06:42:17 +00:00
|
|
|
|
2022-11-25 19:54:51 +00:00
|
|
|
class DukeGenericSolidUnblockingDestructible : DukeGenericDestructible
|
|
|
|
{
|
|
|
|
override void Initialize()
|
|
|
|
{
|
|
|
|
self.SetBroken(false);
|
|
|
|
self.cstat |= CSTAT_SPRITE_BLOCK_ALL;
|
|
|
|
}
|
|
|
|
|
|
|
|
override bool DestroyAction()
|
|
|
|
{
|
|
|
|
self.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|