- scriptified the Acolyte.

This commit is contained in:
Christoph Oelckers 2016-11-28 10:41:36 +01:00
parent d4427e696d
commit 7ea9f60464
7 changed files with 87 additions and 94 deletions

View file

@ -861,7 +861,6 @@ set( NOT_COMPILED_SOURCE_FILES
sc_man_scanner.re sc_man_scanner.re
g_hexen/a_heresiarch.cpp g_hexen/a_heresiarch.cpp
g_hexen/a_spike.cpp g_hexen/a_spike.cpp
g_strife/a_acolyte.cpp
g_strife/a_alienspectres.cpp g_strife/a_alienspectres.cpp
g_strife/a_coin.cpp g_strife/a_coin.cpp
g_strife/a_crusader.cpp g_strife/a_crusader.cpp

View file

@ -478,7 +478,8 @@ void G_InitNew (const char *mapname, bool bTitleLevel)
// Set the initial quest log text for Strife. // Set the initial quest log text for Strife.
for (i = 0; i < MAXPLAYERS; ++i) 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) if (strncmp (nextlevel, "enDSeQ", 6) == 0)
{ {
FName endsequence = ENamedName(strtol(nextlevel.GetChars()+6, NULL, 16)); 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 (endsequence == NAME_Inter_Strife)
{ {
if (players[0].mo->FindInventory (QuestItemClasses[24]) || if (players[0].mo->FindInventory (QuestItemClasses[24]) ||

View file

@ -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<AActor> 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;
}

View file

@ -24,7 +24,6 @@
#include "vm.h" #include "vm.h"
// Include all the other Strife stuff here to reduce compile time // Include all the other Strife stuff here to reduce compile time
#include "a_acolyte.cpp"
#include "a_spectral.cpp" #include "a_spectral.cpp"
#include "a_alienspectres.cpp" #include "a_alienspectres.cpp"
#include "a_coin.cpp" #include "a_coin.cpp"

View file

@ -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) void player_t::SetLogText (const char *text)
{ {
LogText = text; LogText = text;
@ -496,6 +504,14 @@ void player_t::SetLogText (const char *text)
AddToConsole(-1, "\n"); 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() int player_t::GetSpawnClass()
{ {
const PClass * type = PlayerClasses[CurrentPlayerClass].Type; const PClass * type = PlayerClasses[CurrentPlayerClass].Type;

View file

@ -233,5 +233,7 @@ FWeaponSlots weapons;
native void SetSafeFlash(Weapon weap, State flashstate, int index); native void SetSafeFlash(Weapon weap, State flashstate, int index);
native PSprite GetPSprite(int id); native PSprite GetPSprite(int id);
native PSprite FindPSprite(int id); native PSprite FindPSprite(int id);
native void SetLogNumber (int text);
native void SetLogText (String text);
} }

View file

@ -26,8 +26,6 @@ class Acolyte : StrifeHumanoid
Obituary "$OB_ACOLYTE"; Obituary "$OB_ACOLYTE";
} }
native void A_AcolyteDie ();
States States
{ {
Spawn: Spawn:
@ -75,6 +73,49 @@ class Acolyte : StrifeHumanoid
Stop; 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 // A_BeShadowyFoe
@ -238,8 +279,6 @@ class AcolyteToBe : Acolyte
-ISMONSTER -ISMONSTER
} }
native void A_HideDecepticon ();
States States
{ {
Spawn: Spawn:
@ -251,4 +290,27 @@ class AcolyteToBe : Acolyte
Death: Death:
Goto XDeath; 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);
}
}
} }