diff --git a/src/actor.h b/src/actor.h index 5fd0619b93..d870e8df27 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 6506cdb1cc..b09c1b098e 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 6557ef7cf3..a5b3190abc 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 11a9a52e48..d5d119e38e 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 9506b3412a..1272d35f87 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 2764a2c0bd..aba8228c12 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 0eb9ce1083..a95b4b5a00 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 57ba840300..599f78772d 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 f0da99f281..2e3273c328 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 fbd52ecad5..38cba53c0a 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