From 213b3f1fe486b63e79ef5a7dd7c3855d2592974d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 12 Nov 2016 17:21:11 +0100 Subject: [PATCH] - scriptified Hexen's Centaur. --- src/CMakeLists.txt | 1 - src/g_hexen/a_centaur.cpp | 30 ------------------------- src/g_hexen/a_hexenmisc.cpp | 1 - wadsrc/static/zscript/actor.txt | 1 - wadsrc/static/zscript/hexen/centaur.txt | 23 +++++++++++++++++-- wadsrc/static/zscript/hexen/demons.txt | 26 ++++++++++++--------- 6 files changed, 37 insertions(+), 45 deletions(-) delete mode 100644 src/g_hexen/a_centaur.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d0f73bc9ba..ffd9f339a4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -859,7 +859,6 @@ set( NOT_COMPILED_SOURCE_FILES g_heretic/a_ironlich.cpp g_hexen/a_blastradius.cpp g_hexen/a_boostarmor.cpp - g_hexen/a_centaur.cpp g_hexen/a_clericflame.cpp g_hexen/a_clericholy.cpp g_hexen/a_clericmace.cpp diff --git a/src/g_hexen/a_centaur.cpp b/src/g_hexen/a_centaur.cpp deleted file mode 100644 index 9bf5e60467..0000000000 --- a/src/g_hexen/a_centaur.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* -#include "actor.h" -#include "p_enemy.h" -#include "a_action.h" -#include "m_random.h" -#include "vm.h" -*/ - -static FRandom pr_centaurdefend ("CentaurDefend"); - -//============================================================================ -// -// A_CentaurDefend -// -//============================================================================ - -DEFINE_ACTION_FUNCTION(AActor, A_CentaurDefend) -{ - PARAM_SELF_PROLOGUE(AActor); - - A_FaceTarget (self); - if (self->CheckMeleeRange() && pr_centaurdefend() < 32) - { - // This should unset REFLECTIVE as well - // (unless you want the Centaur to reflect projectiles forever!) - self->flags2&=~(MF2_REFLECTIVE|MF2_INVULNERABLE); - self->SetState (self->MeleeState); - } - return 0; -} diff --git a/src/g_hexen/a_hexenmisc.cpp b/src/g_hexen/a_hexenmisc.cpp index 1bb722d068..3676bf21b7 100644 --- a/src/g_hexen/a_hexenmisc.cpp +++ b/src/g_hexen/a_hexenmisc.cpp @@ -29,7 +29,6 @@ // Include all the Hexen stuff here to reduce compile time #include "a_blastradius.cpp" #include "a_boostarmor.cpp" -#include "a_centaur.cpp" #include "a_clericflame.cpp" #include "a_clericholy.cpp" #include "a_clericmace.cpp" diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 97b961eea1..c7a0090387 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -292,7 +292,6 @@ class Actor : Thinker native native void A_FreezeDeathChunks(); native void A_GenericFreezeDeath(); native void A_IceGuyDie(); - native void A_CentaurDefend(); native void A_CStaffMissileSlither(); native void A_PlayerScream(); native void A_SkullPop(class skulltype = "BloodySkull"); diff --git a/wadsrc/static/zscript/hexen/centaur.txt b/wadsrc/static/zscript/hexen/centaur.txt index 37a8d6b11d..f8c8e2c3d3 100644 --- a/wadsrc/static/zscript/hexen/centaur.txt +++ b/wadsrc/static/zscript/hexen/centaur.txt @@ -54,14 +54,17 @@ class Centaur : Actor XDeath: CTXD A 4; CTXD B 4 A_NoBlocking; - CTXD C 0 A_SpawnItemEx("CentaurSword", 0, 0, 45, + CTXD C 4 + { + A_SpawnItemEx("CentaurSword", 0, 0, 45, 1 + random[CentaurDrop](-128,127)*0.03125, 1 + random[CentaurDrop](-128,127)*0.03125, 8 + random[CentaurDrop](0,255)*0.015625, 270); - CTXD C 4 A_SpawnItemEx("CentaurShield", 0, 0, 45, + A_SpawnItemEx("CentaurShield", 0, 0, 45, 1 + random[CentaurDrop](-128,127)*0.03125, 1 + random[CentaurDrop](-128,127)*0.03125, 8 + random[CentaurDrop](0,255)*0.015625, 90); + } CTXD D 3 A_Scream; CTXD E 4 A_QueueCorpse; CTXD F 3; @@ -74,6 +77,22 @@ class Centaur : Actor CENT U 5 A_FreezeDeath; CENT U 1 A_FreezeDeathChunks; Wait; + } +} + +extend class Actor +{ + void A_CentaurDefend() + { + A_FaceTarget (); + if (CheckMeleeRange() && random[CentaurDefend]() < 32) + { + // This should unset REFLECTIVE as well + // (unless you want the Centaur to reflect projectiles forever!) + bReflective = false; + bInvulnerable = false; + SetState(MeleeState); + } } } diff --git a/wadsrc/static/zscript/hexen/demons.txt b/wadsrc/static/zscript/hexen/demons.txt index 56b4f3bdac..8aa65629de 100644 --- a/wadsrc/static/zscript/hexen/demons.txt +++ b/wadsrc/static/zscript/hexen/demons.txt @@ -56,11 +56,14 @@ class Demon1 : Actor Stop; XDeath: DEMN H 6; - DEMN I 0 A_SpawnItemEx("Demon1Chunk1", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle+90), frandom[DemonChunks](1,4.984375)*sin(Angle+90), 8, 90, ChunkFlags); - DEMN I 0 A_SpawnItemEx("Demon1Chunk2", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags); - DEMN I 0 A_SpawnItemEx("Demon1Chunk3", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags); - DEMN I 0 A_SpawnItemEx("Demon1Chunk4", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags); - DEMN I 6 A_SpawnItemEx("Demon1Chunk5", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags); + DEMN I 6 + { + A_SpawnItemEx("Demon1Chunk1", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle+90), frandom[DemonChunks](1,4.984375)*sin(Angle+90), 8, 90, ChunkFlags); + A_SpawnItemEx("Demon1Chunk2", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags); + A_SpawnItemEx("Demon1Chunk3", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags); + A_SpawnItemEx("Demon1Chunk4", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags); + A_SpawnItemEx("Demon1Chunk5", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags); + } Goto Death+2; Ice: DEMN Q 5 A_FreezeDeath; @@ -261,11 +264,14 @@ class Demon2 : Demon1 Stop; XDeath: DEM2 H 6; - DEM2 I 0 A_SpawnItemEx("Demon2Chunk1", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle+90), frandom[DemonChunks](1,4.984375)*sin(Angle+90), 8, 90, ChunkFlags); - DEM2 I 0 A_SpawnItemEx("Demon2Chunk2", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags); - DEM2 I 0 A_SpawnItemEx("Demon2Chunk3", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags); - DEM2 I 0 A_SpawnItemEx("Demon2Chunk4", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags); - DEM2 I 6 A_SpawnItemEx("Demon2Chunk5", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags); + DEM2 I 6 + { + A_SpawnItemEx("Demon2Chunk1", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle+90), frandom[DemonChunks](1,4.984375)*sin(Angle+90), 8, 90, ChunkFlags); + A_SpawnItemEx("Demon2Chunk2", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags); + A_SpawnItemEx("Demon2Chunk3", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags); + A_SpawnItemEx("Demon2Chunk4", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags); + A_SpawnItemEx("Demon2Chunk5", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags); + } Goto Death+2; } }