2016-10-18 16:11:13 +00:00
|
|
|
|
|
|
|
// Dirt clump (spawned by spike) --------------------------------------------
|
|
|
|
|
|
|
|
class DirtClump : Actor
|
|
|
|
{
|
|
|
|
Default
|
|
|
|
{
|
|
|
|
+NOBLOCKMAP
|
|
|
|
+NOTELEPORT
|
|
|
|
}
|
|
|
|
States
|
|
|
|
{
|
|
|
|
Spawn:
|
|
|
|
TSPK C 20;
|
|
|
|
Loop;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Spike (thrust floor) -----------------------------------------------------
|
|
|
|
|
2016-11-29 17:42:48 +00:00
|
|
|
class ThrustFloor : Actor
|
2016-10-18 16:11:13 +00:00
|
|
|
{
|
|
|
|
Default
|
|
|
|
{
|
|
|
|
Radius 20;
|
|
|
|
Height 128;
|
|
|
|
}
|
|
|
|
|
|
|
|
States
|
|
|
|
{
|
|
|
|
ThrustRaising:
|
|
|
|
TSPK A 2 A_ThrustRaise;
|
|
|
|
Loop;
|
|
|
|
BloodThrustRaising:
|
|
|
|
TSPK B 2 A_ThrustRaise;
|
|
|
|
Loop;
|
|
|
|
ThrustLower:
|
|
|
|
TSPK A 2 A_ThrustLower;
|
|
|
|
Loop;
|
|
|
|
BloodThrustLower:
|
|
|
|
TSPK B 2 A_ThrustLower;
|
|
|
|
Loop;
|
|
|
|
ThrustInit1:
|
|
|
|
TSPK A 3;
|
|
|
|
TSPK A 4 A_ThrustInitDn;
|
|
|
|
TSPK A -1;
|
|
|
|
Loop;
|
|
|
|
BloodThrustInit1:
|
|
|
|
TSPK B 3;
|
|
|
|
TSPK B 4 A_ThrustInitDn;
|
|
|
|
TSPK B -1;
|
|
|
|
Loop;
|
|
|
|
ThrustInit2:
|
|
|
|
TSPK A 3;
|
|
|
|
TSPK A 4 A_ThrustInitUp;
|
|
|
|
TSPK A 10;
|
|
|
|
Loop;
|
|
|
|
BloodThrustInit2:
|
|
|
|
TSPK B 3;
|
|
|
|
TSPK B 4 A_ThrustInitUp;
|
|
|
|
TSPK B 10;
|
|
|
|
Loop;
|
|
|
|
ThrustRaise:
|
|
|
|
TSPK A 8 A_ThrustRaise;
|
|
|
|
TSPK A 6 A_ThrustRaise;
|
|
|
|
TSPK A 4 A_ThrustRaise;
|
|
|
|
TSPK A 3 A_SetSolid;
|
|
|
|
TSPK A 2 A_ThrustImpale;
|
|
|
|
Loop;
|
|
|
|
BloodThrustRaise:
|
|
|
|
TSPK B 8 A_ThrustRaise;
|
|
|
|
TSPK B 6 A_ThrustRaise;
|
|
|
|
TSPK B 4 A_ThrustRaise;
|
|
|
|
TSPK B 3 A_SetSolid;
|
|
|
|
TSPK B 2 A_ThrustImpale;
|
|
|
|
Loop;
|
|
|
|
}
|
2016-11-16 23:44:43 +00:00
|
|
|
|
2016-11-29 17:42:48 +00:00
|
|
|
override void Activate (Actor activator)
|
|
|
|
{
|
|
|
|
if (args[0] == 0)
|
|
|
|
{
|
2020-01-04 13:15:32 +00:00
|
|
|
A_StartSound ("ThrustSpikeLower", CHAN_BODY);
|
2016-11-29 17:42:48 +00:00
|
|
|
bInvisible = false;
|
|
|
|
if (args[1])
|
|
|
|
SetStateLabel("BloodThrustRaise");
|
|
|
|
else
|
|
|
|
SetStateLabel("ThrustRaise");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
override void Deactivate (Actor activator)
|
|
|
|
{
|
|
|
|
if (args[0] == 1)
|
|
|
|
{
|
2020-01-04 13:15:32 +00:00
|
|
|
A_StartSound ("ThrustSpikeRaise", CHAN_BODY);
|
2016-11-29 17:42:48 +00:00
|
|
|
if (args[1])
|
|
|
|
SetStateLabel("BloodThrustLower");
|
|
|
|
else
|
|
|
|
SetStateLabel("ThrustLower");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-16 23:44:43 +00:00
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Thrust floor stuff
|
|
|
|
//
|
|
|
|
// Thrust Spike Variables
|
|
|
|
// master pointer to dirt clump actor
|
|
|
|
// special2 speed of raise
|
|
|
|
// args[0] 0 = lowered, 1 = raised
|
|
|
|
// args[1] 0 = normal, 1 = bloody
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
void A_ThrustInitUp()
|
|
|
|
{
|
|
|
|
special2 = 5; // Raise speed
|
|
|
|
args[0] = 1; // Mark as up
|
|
|
|
Floorclip = 0;
|
|
|
|
bSolid = true;
|
|
|
|
bNoTeleport = true;
|
|
|
|
bFloorClip = true;
|
|
|
|
special1 = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void A_ThrustInitDn()
|
|
|
|
{
|
|
|
|
special2 = 5; // Raise speed
|
|
|
|
args[0] = 0; // Mark as down
|
|
|
|
Floorclip = Default.Height;
|
|
|
|
bSolid = false;
|
|
|
|
bNoTeleport = true;
|
|
|
|
bFloorClip = true;
|
|
|
|
bInvisible = true;
|
|
|
|
master = Spawn("DirtClump", Pos, ALLOW_REPLACE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void A_ThrustRaise()
|
|
|
|
{
|
|
|
|
if (RaiseMobj (special2))
|
|
|
|
{ // Reached it's target height
|
|
|
|
args[0] = 1;
|
|
|
|
if (args[1])
|
|
|
|
SetStateLabel ("BloodThrustInit2", true);
|
|
|
|
else
|
|
|
|
SetStateLabel ("ThrustInit2", true);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Lose the dirt clump
|
|
|
|
if ((Floorclip < Height) && master)
|
|
|
|
{
|
|
|
|
master.Destroy ();
|
|
|
|
master = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Spawn some dirt
|
|
|
|
if (random[Thrustraise]()<40)
|
|
|
|
SpawnDirt (radius);
|
|
|
|
special2++; // Increase raise speed
|
|
|
|
}
|
|
|
|
|
|
|
|
void A_ThrustLower()
|
|
|
|
{
|
|
|
|
if (SinkMobj (6))
|
|
|
|
{
|
|
|
|
args[0] = 0;
|
|
|
|
if (args[1])
|
|
|
|
SetStateLabel ("BloodThrustInit1", true);
|
|
|
|
else
|
|
|
|
SetStateLabel ("ThrustInit1", true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-11-29 17:42:48 +00:00
|
|
|
void A_ThrustImpale()
|
|
|
|
{
|
|
|
|
BlockThingsIterator it = BlockThingsIterator.Create(self);
|
|
|
|
while (it.Next())
|
|
|
|
{
|
2017-06-06 07:12:23 +00:00
|
|
|
let targ = it.thing;
|
2018-10-07 17:59:51 +00:00
|
|
|
if (targ != null)
|
2016-11-29 17:42:48 +00:00
|
|
|
{
|
2018-10-07 17:59:51 +00:00
|
|
|
double blockdist = radius + targ.radius;
|
|
|
|
if (abs(targ.pos.x - it.Position.X) >= blockdist || abs(targ.pos.y - it.Position.Y) >= blockdist)
|
2016-11-29 17:42:48 +00:00
|
|
|
continue;
|
|
|
|
|
2018-10-07 17:59:51 +00:00
|
|
|
// Q: Make this z-aware for everything? It never was before.
|
|
|
|
if (targ.pos.z + targ.height < pos.z || targ.pos.z > pos.z + height)
|
|
|
|
{
|
|
|
|
if (CurSector.PortalGroup != targ.CurSector.PortalGroup)
|
|
|
|
continue;
|
|
|
|
}
|
2016-11-29 17:42:48 +00:00
|
|
|
|
2018-10-07 17:59:51 +00:00
|
|
|
if (!targ.bShootable)
|
|
|
|
continue;
|
2016-11-29 17:42:48 +00:00
|
|
|
|
2018-10-07 17:59:51 +00:00
|
|
|
if (targ == self)
|
|
|
|
continue; // don't clip against self
|
|
|
|
|
|
|
|
int newdam = targ.DamageMobj (self, self, 10001, 'Crush');
|
|
|
|
targ.TraceBleed (newdam > 0 ? newdam : 10001, null);
|
|
|
|
args[1] = 1; // Mark thrust thing as bloody
|
|
|
|
}
|
2016-11-29 17:42:48 +00:00
|
|
|
}
|
|
|
|
}
|
2016-10-18 16:11:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Spike up -----------------------------------------------------------------
|
|
|
|
|
|
|
|
class ThrustFloorUp : ThrustFloor
|
|
|
|
{
|
|
|
|
Default
|
|
|
|
{
|
|
|
|
+SOLID
|
|
|
|
+NOTELEPORT +FLOORCLIP
|
|
|
|
}
|
|
|
|
States
|
|
|
|
{
|
|
|
|
Spawn:
|
|
|
|
Goto ThrustInit2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Spike down ---------------------------------------------------------------
|
|
|
|
|
|
|
|
class ThrustFloorDown : ThrustFloor
|
|
|
|
{
|
|
|
|
Default
|
|
|
|
{
|
|
|
|
+NOTELEPORT +FLOORCLIP
|
|
|
|
+INVISIBLE
|
|
|
|
}
|
|
|
|
States
|
|
|
|
{
|
|
|
|
Spawn:
|
|
|
|
Goto ThrustInit1;
|
|
|
|
}
|
|
|
|
}
|