From 6ba548511b02c95023785b14fa8bd9c06e55b058 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 8 Jan 2010 03:24:22 +0000 Subject: [PATCH] - Fixed: Macil2 and the Oracle need to be immune to SpectralLightningV2 as well as V1, since they are both created by the first-stage Sigil. AlienSpectre3 should have also been immune to them but was not. In addition, Macil1 was erroneously immune to V1, when he should not be immune to any spectral damage. (Though, since he's immortal, all that really amounts to is that he can enter his pain state.) SVN r2106 (trunk) --- src/actor.h | 1 + src/g_strife/a_alienspectres.cpp | 34 +++++++++++++++++++ src/g_strife/a_macil.cpp | 26 ++++++++++---- src/g_strife/a_oracle.cpp | 8 +++-- src/g_strife/a_spectral.cpp | 6 ++-- src/g_strife/a_strifestuff.cpp | 2 +- src/namedef.h | 1 + src/p_mobj.cpp | 14 ++++++-- wadsrc/static/actors/strife/alienspectres.txt | 4 +-- wadsrc/static/actors/strife/macil.txt | 2 +- 10 files changed, 80 insertions(+), 18 deletions(-) diff --git a/src/actor.h b/src/actor.h index 5fd0619b9..d870e8df2 100644 --- a/src/actor.h +++ b/src/actor.h @@ -982,6 +982,7 @@ inline AActor *Spawn (const PClass *type, fixed_t x, fixed_t y, fixed_t z, repla } AActor *Spawn (const char *type, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement); +AActor *Spawn (FName classname, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement); template inline T *Spawn (fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement) diff --git a/src/g_strife/a_alienspectres.cpp b/src/g_strife/a_alienspectres.cpp index 6506cdb1c..b09c1b098 100644 --- a/src/g_strife/a_alienspectres.cpp +++ b/src/g_strife/a_alienspectres.cpp @@ -13,6 +13,20 @@ #include "doomstat.h" */ +class AAlienSpectre1 : public ASpectralMonster +{ + DECLARE_CLASS (AAlienSpectre1, ASpectralMonster) +}; +IMPLEMENT_CLASS(AAlienSpectre1); + +class AAlienSpectre3 : public AAlienSpectre1 +{ + DECLARE_CLASS (AAlienSpectre3, AAlienSpectre1) +public: + int TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype); +}; +IMPLEMENT_CLASS(AAlienSpectre3); + static FRandom pr_spectrespawn ("AlienSpectreSpawn"); static FRandom pr_spectrechunk ("212e4"); @@ -190,3 +204,23 @@ DEFINE_ACTION_FUNCTION(AActor, A_AlienSpectreDeath) S_Sound (CHAN_VOICE, voc, 1, ATTN_NORM); player->player->SetLogNumber (log); } + +//============================================================================ +// +// AAlienSpetre3 :: TakeSpecialDamage +// +// The third spectre type (the Oracle's) is invulnerable to the first stage +// Sigil, just like the Oracle. +// +//============================================================================ + +int AAlienSpectre3::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype) +{ + if (inflictor != NULL) + { + FName name = inflictor->GetClass()->TypeName; + if (name == NAME_SpectralLightningV1 || name == NAME_SpectralLightningV2) + return -1; + } + return Super::TakeSpecialDamage(inflictor, source, damage, damagetype); +} diff --git a/src/g_strife/a_macil.cpp b/src/g_strife/a_macil.cpp index 6557ef7cf..a5b3190ab 100644 --- a/src/g_strife/a_macil.cpp +++ b/src/g_strife/a_macil.cpp @@ -7,29 +7,41 @@ #include "a_strifeglobal.h" */ -// Macil (version 2) --------------------------------------------------------- +// Macil (version 1) --------------------------------------------------------- class AMacil1 : public AActor { DECLARE_CLASS (AMacil1, AActor) +}; + +IMPLEMENT_CLASS (AMacil1) + +// Macil (version 2) --------------------------------------------------------- + +class AMacil2 : public AMacil1 +{ + DECLARE_CLASS (AMacil2, AMacil1) public: int TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype); }; -IMPLEMENT_CLASS (AMacil1) +IMPLEMENT_CLASS (AMacil2) //============================================================================ // // AMacil2 :: TakeSpecialDamage // -// Macil is invulnerable to the first stage Sigil. +// Macil2 is invulnerable to the first stage Sigil. // //============================================================================ -int AMacil1::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype) +int AMacil2::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype) { - if (inflictor != NULL && inflictor->GetClass()->TypeName == NAME_SpectralLightningV1) - return -1; - + if (inflictor != NULL) + { + FName name = inflictor->GetClass()->TypeName; + if (name == NAME_SpectralLightningV1 || name == NAME_SpectralLightningV2) + return -1; + } return Super::TakeSpecialDamage(inflictor, source, damage, damagetype); } diff --git a/src/g_strife/a_oracle.cpp b/src/g_strife/a_oracle.cpp index 11a9a52e4..d5d119e38 100644 --- a/src/g_strife/a_oracle.cpp +++ b/src/g_strife/a_oracle.cpp @@ -42,7 +42,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_WakeOracleSpectre) int AOracle::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype) { - if (inflictor != NULL && inflictor->GetClass()->TypeName == NAME_SpectralLightningV1) - return -1; + if (inflictor != NULL) + { + FName name = inflictor->GetClass()->TypeName; + if (name == NAME_SpectralLightningV1 || name == NAME_SpectralLightningV2) + return -1; + } return Super::TakeSpecialDamage(inflictor, source, damage, damagetype); } diff --git a/src/g_strife/a_spectral.cpp b/src/g_strife/a_spectral.cpp index 9506b3412..1272d35f8 100644 --- a/src/g_strife/a_spectral.cpp +++ b/src/g_strife/a_spectral.cpp @@ -64,14 +64,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightning) x = self->x + pr_zap5.Random2(3) * FRACUNIT * 50; y = self->y + pr_zap5.Random2(3) * FRACUNIT * 50; - flash = Spawn (self->threshold > 25 ? PClass::FindClass("SpectralLightningV2") : - PClass::FindClass("SpectralLightningV1"), x, y, ONCEILINGZ, ALLOW_REPLACE); + flash = Spawn (self->threshold > 25 ? PClass::FindClass(NAME_SpectralLightningV2) : + PClass::FindClass(NAME_SpectralLightningV1), x, y, ONCEILINGZ, ALLOW_REPLACE); flash->target = self->target; flash->velz = -18*FRACUNIT; flash->health = self->health; - flash = Spawn("SpectralLightningV2", self->x, self->y, ONCEILINGZ, ALLOW_REPLACE); + flash = Spawn(NAME_SpectralLightningV2, self->x, self->y, ONCEILINGZ, ALLOW_REPLACE); flash->target = self->target; flash->velz = -18*FRACUNIT; diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index 2764a2c0b..aba8228c1 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -21,6 +21,7 @@ // 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" #include "a_crusader.cpp" @@ -33,7 +34,6 @@ #include "a_reaver.cpp" #include "a_rebels.cpp" #include "a_sentinel.cpp" -#include "a_spectral.cpp" #include "a_stalker.cpp" #include "a_strifeitems.cpp" #include "a_strifeweapons.cpp" diff --git a/src/namedef.h b/src/namedef.h index 0eb9ce108..a95b4b5a0 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -153,6 +153,7 @@ xx(Mauler) xx(AcolyteBlue) xx(SpectralLightningV1) +xx(SpectralLightningV2) xx(TeleportDest) xx(TeleportDest2) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 57ba84030..599f78772 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3674,11 +3674,21 @@ AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t AActor *Spawn (const char *type, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement) { - const PClass *cls = PClass::FindClass(type); - if (cls == NULL) + FName classname(type, true); + if (classname == NAME_None) { I_Error("Attempt to spawn actor of unknown type '%s'\n", type); } + return Spawn(classname, x, y, z, allowreplacement); +} + +AActor *Spawn (FName classname, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement) +{ + const PClass *cls = PClass::FindClass(classname); + if (cls == NULL) + { + I_Error("Attempt to spawn actor of unknown type '%s'\n", classname.GetChars()); + } return AActor::StaticSpawn (cls, x, y, z, allowreplacement); } diff --git a/wadsrc/static/actors/strife/alienspectres.txt b/wadsrc/static/actors/strife/alienspectres.txt index f0da99f28..2e3273c32 100644 --- a/wadsrc/static/actors/strife/alienspectres.txt +++ b/wadsrc/static/actors/strife/alienspectres.txt @@ -1,7 +1,7 @@ // Alien Spectre 1 ----------------------------------------------------------- -ACTOR AlienSpectre1 : SpectralMonster 129 +ACTOR AlienSpectre1 : SpectralMonster 129 native { Game Strife ConversationID 67,-1,-1 @@ -100,7 +100,7 @@ ACTOR AlienSpectre2 : AlienSpectre1 75 // Alien Spectre 3 ---------------------------------------------------------- // This is the Oracle's personal spectre, so it's a little different. -ACTOR AlienSpectre3 : AlienSpectre1 76 +ACTOR AlienSpectre3 : AlienSpectre1 76 native { Game Strife ConversationID 71,-1,-1 diff --git a/wadsrc/static/actors/strife/macil.txt b/wadsrc/static/actors/strife/macil.txt index fbd52ecad..38cba53c0 100644 --- a/wadsrc/static/actors/strife/macil.txt +++ b/wadsrc/static/actors/strife/macil.txt @@ -56,7 +56,7 @@ ACTOR Macil1 64 native // Macil (version 2) --------------------------------------------------------- -ACTOR Macil2 : Macil1 200 +ACTOR Macil2 : Macil1 200 native { Game Strife ConversationID 50, 49, 50