From 7ea9f60464cc065246be8b5862bff8b13f363141 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 28 Nov 2016 10:41:36 +0100 Subject: [PATCH] - scriptified the Acolyte. --- src/CMakeLists.txt | 1 - src/g_level.cpp | 5 +- src/g_strife/a_acolyte.cpp | 86 ------------------------ src/g_strife/a_strifestuff.cpp | 1 - src/p_user.cpp | 16 +++++ wadsrc/static/zscript/shared/player.txt | 2 + wadsrc/static/zscript/strife/acolyte.txt | 70 +++++++++++++++++-- 7 files changed, 87 insertions(+), 94 deletions(-) delete mode 100644 src/g_strife/a_acolyte.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 553a66c127..269fd3bd79 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -861,7 +861,6 @@ set( NOT_COMPILED_SOURCE_FILES sc_man_scanner.re g_hexen/a_heresiarch.cpp g_hexen/a_spike.cpp - g_strife/a_acolyte.cpp g_strife/a_alienspectres.cpp g_strife/a_coin.cpp g_strife/a_crusader.cpp diff --git a/src/g_level.cpp b/src/g_level.cpp index ea34dc95c7..0e7820d93a 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -478,7 +478,8 @@ void G_InitNew (const char *mapname, bool bTitleLevel) // Set the initial quest log text for Strife. for (i = 0; i < MAXPLAYERS; ++i) { - players[i].SetLogText ("Find help"); + if (playeringame[i]) + players[i].SetLogText ("Find help"); } } @@ -1092,7 +1093,7 @@ void G_WorldDone (void) if (strncmp (nextlevel, "enDSeQ", 6) == 0) { FName endsequence = ENamedName(strtol(nextlevel.GetChars()+6, NULL, 16)); - // Strife needs a special case here to choose between good and sad ending. Bad is handled elsewherw. + // Strife needs a special case here to choose between good and sad ending. Bad is handled elsewhere. if (endsequence == NAME_Inter_Strife) { if (players[0].mo->FindInventory (QuestItemClasses[24]) || diff --git a/src/g_strife/a_acolyte.cpp b/src/g_strife/a_acolyte.cpp deleted file mode 100644 index f0ed0c414c..0000000000 --- a/src/g_strife/a_acolyte.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* -#include "actor.h" -#include "m_random.h" -#include "a_action.h" -#include "p_local.h" -#include "p_enemy.h" -#include "s_sound.h" -#include "a_strifeglobal.h" -#include "doomdata.h" -#include "vm.h" -#include "doomstat.h" -*/ - -//============================================================================ -// -// A_HideDecepticon -// -// Hide the Acolyte-to-be -> -// Hide the guy transforming into an Acolyte -> -// Hide the transformer -> -// Transformers are Autobots and Decepticons, and -// Decepticons are the bad guys, so... -> -// -// Hide the Decepticon! -// -//============================================================================ - -DEFINE_ACTION_FUNCTION(AActor, A_HideDecepticon) -{ - PARAM_SELF_PROLOGUE(AActor); - - EV_DoDoor (DDoor::doorClose, NULL, self, 999, 8., 0, 0, 0); - if (self->target != NULL && self->target->player != NULL) - { - P_NoiseAlert (self->target, self); - } - return 0; -} - -//============================================================================ -// -// A_AcolyteDie -// -//============================================================================ - -DEFINE_ACTION_FUNCTION(AActor, A_AcolyteDie) -{ - PARAM_SELF_PROLOGUE(AActor); - - int i; - - // [RH] Disable translucency here. - self->RenderStyle = STYLE_Normal; - - // Only the Blue Acolyte does extra stuff on death. - if (self->GetClass()->TypeName != NAME_AcolyteBlue) - return 0; - - // Make sure somebody is still alive - for (i = 0; i < MAXPLAYERS; ++i) - { - if (playeringame[i] && players[i].health > 0) - break; - } - if (i == MAXPLAYERS) - return 0; - - // Make sure all the other blue acolytes are dead. - TThinkerIterator iterator(NAME_AcolyteBlue); - AActor *other; - - while ( (other = iterator.Next ()) ) - { - if (other != self && other->health > 0) - { // Found a living one - return 0; - } - } - - players[i].mo->GiveInventoryType (QuestItemClasses[6]); - players[i].SetLogNumber (14); - S_StopSound (CHAN_VOICE); - S_Sound (CHAN_VOICE, "svox/voc14", 1, ATTN_NORM); - return 0; -} - diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index 6815b1d49d..ed56407f5e 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -24,7 +24,6 @@ #include "vm.h" // Include all the other Strife stuff here to reduce compile time -#include "a_acolyte.cpp" #include "a_spectral.cpp" #include "a_alienspectres.cpp" #include "a_coin.cpp" diff --git a/src/p_user.cpp b/src/p_user.cpp index ce78d04a83..5f2d19cb4d 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -486,6 +486,14 @@ void player_t::SetLogNumber (int num) } } +DEFINE_ACTION_FUNCTION(_PlayerInfo, SetLogNumber) +{ + PARAM_SELF_STRUCT_PROLOGUE(player_t); + PARAM_INT(log); + self->SetLogNumber(log); + return 0; +} + void player_t::SetLogText (const char *text) { LogText = text; @@ -496,6 +504,14 @@ void player_t::SetLogText (const char *text) AddToConsole(-1, "\n"); } +DEFINE_ACTION_FUNCTION(_PlayerInfo, SetLogText) +{ + PARAM_SELF_STRUCT_PROLOGUE(player_t); + PARAM_STRING(log); + self->SetLogText(log); + return 0; +} + int player_t::GetSpawnClass() { const PClass * type = PlayerClasses[CurrentPlayerClass].Type; diff --git a/wadsrc/static/zscript/shared/player.txt b/wadsrc/static/zscript/shared/player.txt index c7615e9c20..bcbc7db613 100644 --- a/wadsrc/static/zscript/shared/player.txt +++ b/wadsrc/static/zscript/shared/player.txt @@ -233,5 +233,7 @@ FWeaponSlots weapons; native void SetSafeFlash(Weapon weap, State flashstate, int index); native PSprite GetPSprite(int id); native PSprite FindPSprite(int id); + native void SetLogNumber (int text); + native void SetLogText (String text); } diff --git a/wadsrc/static/zscript/strife/acolyte.txt b/wadsrc/static/zscript/strife/acolyte.txt index 9a6b0105ad..1c50b318c0 100644 --- a/wadsrc/static/zscript/strife/acolyte.txt +++ b/wadsrc/static/zscript/strife/acolyte.txt @@ -26,8 +26,6 @@ class Acolyte : StrifeHumanoid Obituary "$OB_ACOLYTE"; } - native void A_AcolyteDie (); - States { Spawn: @@ -75,6 +73,49 @@ class Acolyte : StrifeHumanoid Stop; } + //============================================================================ + // + // A_AcolyteDie + // + //============================================================================ + + void A_AcolyteDie () + { + // [RH] Disable translucency here. + A_SetRenderStyle(1, STYLE_Normal); + + // Only the Blue Acolyte does extra stuff on death. + if (self is "AcolyteBlue") + { + int i; + // Make sure somebody is still alive + for (i = 0; i < MAXPLAYERS; ++i) + { + if (playeringame[i] && players[i].health > 0) + break; + } + if (i == MAXPLAYERS) + return; + + // Make sure all the other blue acolytes are dead. + ThinkerIterator it = ThinkerIterator.Create("AcolyteBlue"); + Actor other; + + while ( (other = Actor(it.Next ())) ) + { + if (other != self && other.health > 0) + { // Found a living one + return; + } + } + + players[i].mo.GiveInventoryType ("QuestItem7"); + players[i].SetLogNumber (14); + A_StopSound (CHAN_VOICE); + A_PlaySound ("svox/voc14", CHAN_VOICE); + } + } + //============================================================================ // // A_BeShadowyFoe @@ -238,8 +279,6 @@ class AcolyteToBe : Acolyte -ISMONSTER } - native void A_HideDecepticon (); - States { Spawn: @@ -251,4 +290,27 @@ class AcolyteToBe : Acolyte Death: Goto XDeath; } + + //============================================================================ + // + // A_HideDecepticon + // + // Hide the Acolyte-to-be -> + // Hide the guy transforming into an Acolyte -> + // Hide the transformer -> + // Transformers are Autobots and Decepticons, and + // Decepticons are the bad guys, so... -> + // + // Hide the Decepticon! + // + //============================================================================ + + void A_HideDecepticon () + { + Door_Close(999, 64); + if (target != null && target.player != null) + { + target.NoiseAlert (self); + } + } }