From 06995e26d9d6a2184a7d16187ffda4b9d7b76b70 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 3 Apr 2010 04:07:17 +0000 Subject: [PATCH] - Be stricter about types accepted by spawning functions. SVN r2265 (scripting) --- src/actor.h | 18 ++++++------------ src/d_dehacked.cpp | 6 +++--- src/d_dehacked.h | 2 +- src/d_player.h | 4 ++-- src/farchive.cpp | 20 ++++++++++---------- src/farchive.h | 24 ++++++++++++------------ src/g_doom/a_arachnotron.cpp | 2 +- src/g_doom/a_bossbrain.cpp | 6 +++--- src/g_doom/a_bruiser.cpp | 2 +- src/g_doom/a_cacodemon.cpp | 2 +- src/g_doom/a_cyberdemon.cpp | 2 +- src/g_doom/a_doomimp.cpp | 2 +- src/g_doom/a_fatso.cpp | 2 -- src/g_doom/a_painelemental.cpp | 16 ++++++++-------- src/g_doom/a_revenant.cpp | 2 +- src/g_doom/a_scriptedmarine.cpp | 6 +++--- src/g_game.cpp | 2 +- src/g_heretic/a_ironlich.cpp | 4 ++-- src/g_heretic/a_knight.cpp | 4 ++-- src/g_hexen/a_bishop.cpp | 2 +- src/g_hexen/a_blastradius.cpp | 2 +- src/g_hexen/a_clericholy.cpp | 2 +- src/g_hexen/a_dragon.cpp | 4 ++-- src/g_hexen/a_fighterquietus.cpp | 2 +- src/g_hexen/a_firedemon.cpp | 14 +++++++------- src/g_hexen/a_flechette.cpp | 2 +- src/g_hexen/a_healingradius.cpp | 4 ++-- src/g_hexen/a_hexenspecialdecs.cpp | 2 +- src/g_hexen/a_iceguy.cpp | 4 ++-- src/g_hexen/a_korax.cpp | 12 ++++++------ src/g_raven/a_minotaur.cpp | 8 ++++---- src/g_shared/a_action.cpp | 7 +++++-- src/g_shared/a_artifacts.cpp | 4 ++-- src/g_shared/a_debris.cpp | 4 ++-- src/g_shared/a_fastprojectile.cpp | 2 +- src/g_shared/a_morph.cpp | 14 +++++++------- src/g_shared/a_morph.h | 6 +++--- src/g_shared/a_pickups.cpp | 2 +- src/g_shared/a_randomspawner.cpp | 20 +++++++++++++++----- src/g_shared/a_sharedglobal.h | 2 +- src/g_strife/a_alienspectres.cpp | 4 +--- src/g_strife/a_entityboss.cpp | 2 +- src/g_strife/a_spectral.cpp | 8 +++----- src/g_strife/a_strifeitems.cpp | 2 +- src/g_strife/a_strifestuff.cpp | 2 +- src/g_strife/a_strifeweapons.cpp | 8 +++----- src/info.h | 4 ++-- src/m_cheat.cpp | 21 +++++++++++---------- src/p_acs.cpp | 16 ++++++++-------- src/p_enemy.cpp | 14 ++++++++------ src/p_enemy.h | 2 +- src/p_lnspec.cpp | 2 +- src/p_local.h | 10 +++++++--- src/p_mobj.cpp | 12 ++++++------ src/p_states.cpp | 8 ++++---- src/p_teleport.cpp | 2 +- src/p_terrain.h | 6 +++--- src/p_user.cpp | 2 +- src/thingdef/thingdef_codeptr.cpp | 8 ++++---- 59 files changed, 192 insertions(+), 186 deletions(-) diff --git a/src/actor.h b/src/actor.h index 1dcf22c9b..d1d7f4a0f 100644 --- a/src/actor.h +++ b/src/actor.h @@ -40,6 +40,8 @@ #include "r_blend.h" #include "s_sound.h" +class PClassAmmo; + // // NOTES: AActor // @@ -625,13 +627,13 @@ public: } // Adds one item of a particular type. Returns NULL if it could not be added. - AInventory *GiveInventoryType (const PClass *type); + AInventory *GiveInventoryType (PClassActor *type); // Returns the first item held with IF_INVBAR set. AInventory *FirstInv (); // Tries to give the actor some ammo. - bool GiveAmmo (const PClass *type, int amount); + bool GiveAmmo (PClassAmmo *type, int amount); // Destroys all the inventory the actor is holding. void DestroyAllInventory (); @@ -948,18 +950,10 @@ public: } }; -inline AActor *Spawn (PClass *type, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement) +inline AActor *Spawn (PClassActor *type, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement) { - return AActor::StaticSpawn (dyn_cast(type), x, y, z, allowreplacement); + return AActor::StaticSpawn (type, x, y, z, allowreplacement); } - -inline AActor *Spawn (const PClass *type, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement) -{ - // Thanks to some fiddling while determining replacements, type is modified, but only - // temporarily. - return AActor::StaticSpawn (const_cast(dyn_cast(type)), x, y, z, allowreplacement); -} - 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); diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index 24b4c0b78..9d7c54f7a 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -2896,7 +2896,7 @@ void ModifyDropAmount(AInventory *inv, int dropamount); bool ADehackedPickup::TryPickup (AActor *&toucher) { - const PClass *type = DetermineType (); + PClassActor *type = DetermineType (); if (type == NULL) { return false; @@ -2968,7 +2968,7 @@ void ADehackedPickup::Destroy () Super::Destroy (); } -const PClass *ADehackedPickup::DetermineType () +PClassActor *ADehackedPickup::DetermineType () { // Look at the actor's current sprite to determine what kind of // item to pretend to me. @@ -2981,7 +2981,7 @@ const PClass *ADehackedPickup::DetermineType () int lex = memcmp (DehSpriteMappings[mid].Sprite, sprites[sprite].name, 4); if (lex == 0) { - return PClass::FindClass (DehSpriteMappings[mid].ClassName); + return PClass::FindActor(DehSpriteMappings[mid].ClassName); } else if (lex < 0) { diff --git a/src/d_dehacked.h b/src/d_dehacked.h index 67473f071..71716bdcf 100644 --- a/src/d_dehacked.h +++ b/src/d_dehacked.h @@ -50,7 +50,7 @@ public: void DoPickupSpecial (AActor *toucher); void Serialize(FArchive &arc); private: - const PClass *DetermineType (); + PClassActor *DetermineType (); AInventory *RealPickup; public: bool droppedbymonster; diff --git a/src/d_player.h b/src/d_player.h index 75f0fbfa1..9f9942c86 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -250,7 +250,7 @@ public: userinfo_t userinfo; // [RH] who is this? - const PClass *cls; // class of associated PlayerPawn + PClassPlayerPawn *cls; // class of associated PlayerPawn float DesiredFOV; // desired field of vision float FOV; // current field of vision @@ -302,7 +302,7 @@ public: int morphTics; // player is a chicken/pig if > 0 BYTE MorphedPlayerClass; // [MH] (for SBARINFO) class # for this player instance when morphed int MorphStyle; // which effects to apply for this player instance when morphed - const PClass *MorphExitFlash; // flash to apply when demorphing (cache of value given to P_MorphPlayer) + PClassActor *MorphExitFlash; // flash to apply when demorphing (cache of value given to P_MorphPlayer) TObjPtr PremorphWeapon; // ready weapon before morphing int chickenPeck; // chicken peck countdown int jumpTics; // delay the next jump for a moment diff --git a/src/farchive.cpp b/src/farchive.cpp index 6b9ba2790..f2aff5a45 100644 --- a/src/farchive.cpp +++ b/src/farchive.cpp @@ -1043,7 +1043,7 @@ FArchive &FArchive::WriteObject (DObject *obj) } else { - const PClass *type = RUNTIME_TYPE(obj); + PClass *type = RUNTIME_TYPE(obj); if (type == RUNTIME_CLASS(DObject)) { @@ -1361,7 +1361,7 @@ DWORD FArchive::FindName (const char *name, unsigned int bucket) const return (DWORD)map; } -DWORD FArchive::WriteClass (const PClass *info) +DWORD FArchive::WriteClass (PClass *info) { if (m_ClassCount >= PClass::m_Types.Size()) { @@ -1378,7 +1378,7 @@ DWORD FArchive::WriteClass (const PClass *info) return m_ClassCount++; } -const PClass *FArchive::ReadClass () +PClass *FArchive::ReadClass () { struct String { String() { val = NULL; } @@ -1410,9 +1410,9 @@ const PClass *FArchive::ReadClass () return NULL; } -const PClass *FArchive::ReadClass (const PClass *wanttype) +PClass *FArchive::ReadClass (const PClass *wanttype) { - const PClass *type = ReadClass (); + PClass *type = ReadClass (); if (!type->IsDescendantOf (wanttype)) { I_Error ("Expected to extract an object of type '%s'.\n" @@ -1422,14 +1422,14 @@ const PClass *FArchive::ReadClass (const PClass *wanttype) return type; } -const PClass *FArchive::ReadStoredClass (const PClass *wanttype) +PClass *FArchive::ReadStoredClass (const PClass *wanttype) { DWORD index = ReadCount (); if (index >= m_ClassCount) { I_Error ("Class reference too high (%u; max is %u)\n", index, m_ClassCount); } - const PClass *type = m_TypeMap[index].toCurrent; + PClass *type = m_TypeMap[index].toCurrent; if (!type->IsDescendantOf (wanttype)) { I_Error ("Expected to extract an object of type '%s'.\n" @@ -1479,7 +1479,7 @@ DWORD FArchive::FindObjectIndex (const DObject *obj) const return index; } -void FArchive::UserWriteClass (const PClass *type) +void FArchive::UserWriteClass (PClass *type) { BYTE id; @@ -1505,7 +1505,7 @@ void FArchive::UserWriteClass (const PClass *type) } } -void FArchive::UserReadClass (const PClass *&type) +void FArchive::UserReadClass (PClass *&type) { BYTE newclass; @@ -1527,7 +1527,7 @@ void FArchive::UserReadClass (const PClass *&type) } } -FArchive &operator<< (FArchive &arc, const PClass * &info) +FArchive &operator<< (FArchive &arc, PClass *&info) { if (arc.IsStoring ()) { diff --git a/src/farchive.h b/src/farchive.h index 31a0358e8..e994e6d56 100644 --- a/src/farchive.h +++ b/src/farchive.h @@ -167,13 +167,13 @@ virtual void Read (void *mem, unsigned int len); void WriteCount (DWORD count); DWORD ReadCount (); - void UserWriteClass (const PClass *info); - void UserReadClass (const PClass *&info); - template void UserReadClass(const T *&info) + void UserWriteClass (PClass *info); + void UserReadClass (PClass *&info); + template void UserReadClass(T *&info) { - const PClass *myclass; + PClass *myclass; UserReadClass(myclass); - info = dyn_cast(const_cast(myclass)); + info = dyn_cast(myclass); } FArchive& operator<< (BYTE &c); @@ -211,10 +211,10 @@ protected: DWORD FindObjectIndex (const DObject *obj) const; DWORD MapObject (const DObject *obj); - DWORD WriteClass (const PClass *info); - const PClass *ReadClass (); - const PClass *ReadClass (const PClass *wanttype); - const PClass *ReadStoredClass (const PClass *wanttype); + DWORD WriteClass (PClass *info); + PClass *ReadClass (); + PClass *ReadClass (const PClass *wanttype); + PClass *ReadStoredClass (const PClass *wanttype); DWORD HashObject (const DObject *obj) const; DWORD AddName (const char *name); DWORD AddName (unsigned int start); // Name has already been added to storage @@ -232,8 +232,8 @@ protected: struct TypeMap { - const PClass *toCurrent; // maps archive type index to execution type index - DWORD toArchive; // maps execution type index to archive type index + PClass *toCurrent; // maps archive type index to execution type index + DWORD toArchive; // maps execution type index to archive type index enum { NO_INDEX = 0xffffffff }; } *m_TypeMap; @@ -287,7 +287,7 @@ inline FArchive &operator<< (FArchive &arc, T* &object) return arc.SerializeObject ((DObject*&)object, RUNTIME_CLASS(T)); } -FArchive &operator<< (FArchive &arc, const PClass * &info); +FArchive &operator<< (FArchive &arc, PClass * &info); class FFont; FArchive &SerializeFFontPtr (FArchive &arc, FFont* &font); diff --git a/src/g_doom/a_arachnotron.cpp b/src/g_doom/a_arachnotron.cpp index 65e258720..0f42431c3 100644 --- a/src/g_doom/a_arachnotron.cpp +++ b/src/g_doom/a_arachnotron.cpp @@ -17,7 +17,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BspiAttack) A_FaceTarget (self); // launch a missile - P_SpawnMissile (self, self->target, PClass::FindClass("ArachnotronPlasma")); + P_SpawnMissile (self, self->target, PClass::FindActor("ArachnotronPlasma")); return 0; } diff --git a/src/g_doom/a_bossbrain.cpp b/src/g_doom/a_bossbrain.cpp index a91d5f0e9..ef8d23b8f 100644 --- a/src/g_doom/a_bossbrain.cpp +++ b/src/g_doom/a_bossbrain.cpp @@ -152,7 +152,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BrainSpit) return 0; } -static void SpawnFly(AActor *self, const PClass *spawntype, FSoundID sound) +static void SpawnFly(AActor *self, PClassActor *spawntype, FSoundID sound) { AActor *newmobj; AActor *fog; @@ -242,7 +242,7 @@ static void SpawnFly(AActor *self, const PClass *spawntype, FSoundID sound) else if (r < 246) SpawnName = "HellKnight"; else SpawnName = "BaronOfHell"; } - spawntype = PClass::FindClass(SpawnName); + spawntype = PClass::FindActor(SpawnName); if (spawntype != NULL) { newmobj = Spawn (spawntype, targ->x, targ->y, targ->z, ALLOW_REPLACE); @@ -293,6 +293,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnSound) { PARAM_ACTION_PROLOGUE; S_Sound (self, CHAN_BODY, "brain/cube", 1, ATTN_IDLE); - SpawnFly(self, PClass::FindClass("SpawnFire"), "brain/spawn"); + SpawnFly(self, PClass::FindActor("SpawnFire"), "brain/spawn"); return 0; } diff --git a/src/g_doom/a_bruiser.cpp b/src/g_doom/a_bruiser.cpp index c4adec04f..97dc64775 100644 --- a/src/g_doom/a_bruiser.cpp +++ b/src/g_doom/a_bruiser.cpp @@ -18,6 +18,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_BruisAttack) } // launch a missile - P_SpawnMissile (self, self->target, PClass::FindClass("BaronBall")); + P_SpawnMissile (self, self->target, PClass::FindActor("BaronBall")); return 0; } diff --git a/src/g_doom/a_cacodemon.cpp b/src/g_doom/a_cacodemon.cpp index 1fd9b3ce4..d405ea425 100644 --- a/src/g_doom/a_cacodemon.cpp +++ b/src/g_doom/a_cacodemon.cpp @@ -30,6 +30,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_HeadAttack) } // launch a missile - P_SpawnMissile (self, self->target, PClass::FindClass("CacodemonBall")); + P_SpawnMissile (self, self->target, PClass::FindActor("CacodemonBall")); return 0; } diff --git a/src/g_doom/a_cyberdemon.cpp b/src/g_doom/a_cyberdemon.cpp index a7d7409ea..5b436f2f3 100644 --- a/src/g_doom/a_cyberdemon.cpp +++ b/src/g_doom/a_cyberdemon.cpp @@ -15,7 +15,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CyberAttack) return 0; A_FaceTarget (self); - P_SpawnMissile (self, self->target, PClass::FindClass("Rocket")); + P_SpawnMissile (self, self->target, PClass::FindActor("Rocket")); return 0; } diff --git a/src/g_doom/a_doomimp.cpp b/src/g_doom/a_doomimp.cpp index 025fb7d27..681d1c79d 100644 --- a/src/g_doom/a_doomimp.cpp +++ b/src/g_doom/a_doomimp.cpp @@ -33,6 +33,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_TroopAttack) } // launch a missile - P_SpawnMissile (self, self->target, PClass::FindClass("DoomImpBall")); + P_SpawnMissile (self, self->target, PClass::FindActor("DoomImpBall")); return 0; } diff --git a/src/g_doom/a_fatso.cpp b/src/g_doom/a_fatso.cpp index 2d55b49c7..46aa076ab 100644 --- a/src/g_doom/a_fatso.cpp +++ b/src/g_doom/a_fatso.cpp @@ -124,8 +124,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FatAttack3) // Original idea: Linguica // -AActor * P_OldSpawnMissile(AActor * source, AActor * owner, AActor * dest, const PClass *type); - enum { MSF_Standard = 0, diff --git a/src/g_doom/a_painelemental.cpp b/src/g_doom/a_painelemental.cpp index b8be64f59..142c23a92 100644 --- a/src/g_doom/a_painelemental.cpp +++ b/src/g_doom/a_painelemental.cpp @@ -12,9 +12,9 @@ DECLARE_ACTION(A_SkullAttack) -static const PClass *GetSpawnType(VMValue *param) +static PClassActor *GetSpawnType(VMValue *param) { - const PClass *spawntype; + PClassActor *spawntype; if (param == NULL || param->Type == REGT_NIL) { @@ -24,10 +24,10 @@ static const PClass *GetSpawnType(VMValue *param) { assert(param->Type == REGT_POINTER); assert(param->atag == ATAG_OBJECT || param->a == NULL); - spawntype = (const PClass *)param->a; + spawntype = (PClassActor *)param->a; } - return (spawntype != NULL) ? spawntype : PClass::FindClass("LostSoul"); + return (spawntype != NULL) ? spawntype : PClass::FindActor("LostSoul"); } @@ -35,7 +35,7 @@ static const PClass *GetSpawnType(VMValue *param) // A_PainShootSkull // Spawn a lost soul and launch it at the target // -void A_PainShootSkull (AActor *self, angle_t angle, const PClass *spawntype) +void A_PainShootSkull (AActor *self, angle_t angle, PClassActor *spawntype) { fixed_t x, y, z; @@ -150,7 +150,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PainAttack) if (!self->target) return 0; - const PClass *spawntype = GetSpawnType(numparam > NAP ? ¶m[NAP] : NULL); + PClassActor *spawntype = GetSpawnType(numparam > NAP ? ¶m[NAP] : NULL); A_FaceTarget (self); A_PainShootSkull (self, self->angle, spawntype); return 0; @@ -163,7 +163,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DualPainAttack) if (!self->target) return 0; - const PClass *spawntype = GetSpawnType(numparam > NAP ? ¶m[NAP] : NULL); + PClassActor *spawntype = GetSpawnType(numparam > NAP ? ¶m[NAP] : NULL); A_FaceTarget (self); A_PainShootSkull (self, self->angle + ANG45, spawntype); A_PainShootSkull (self, self->angle - ANG45, spawntype); @@ -178,7 +178,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PainDie) { // And I thought you were my friend! self->flags &= ~MF_FRIENDLY; } - const PClass *spawntype = GetSpawnType(numparam > NAP ? ¶m[NAP] : NULL); + PClassActor *spawntype = GetSpawnType(numparam > NAP ? ¶m[NAP] : NULL); CALL_ACTION(A_NoBlocking, self); A_PainShootSkull (self, self->angle + ANG90, spawntype); A_PainShootSkull (self, self->angle + ANG180, spawntype); diff --git a/src/g_doom/a_revenant.cpp b/src/g_doom/a_revenant.cpp index 4d78f359f..59aa83fe2 100644 --- a/src/g_doom/a_revenant.cpp +++ b/src/g_doom/a_revenant.cpp @@ -29,7 +29,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkelMissile) A_FaceTarget (self); missile = P_SpawnMissileZ (self, self->z + 48*FRACUNIT, - self->target, PClass::FindClass("RevenantTracer")); + self->target, PClass::FindActor("RevenantTracer")); if (missile != NULL) { diff --git a/src/g_doom/a_scriptedmarine.cpp b/src/g_doom/a_scriptedmarine.cpp index ffaae7eec..4260bbcd5 100644 --- a/src/g_doom/a_scriptedmarine.cpp +++ b/src/g_doom/a_scriptedmarine.cpp @@ -523,7 +523,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_FireMissile) else { A_FaceTarget (self); - P_SpawnMissile (self, self->target, PClass::FindClass("Rocket")); + P_SpawnMissile (self, self->target, PClass::FindActor("Rocket")); } return 0; } @@ -560,7 +560,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_FirePlasma) return 0; A_FaceTarget (self); - P_SpawnMissile (self, self->target, PClass::FindClass("PlasmaBall")); + P_SpawnMissile (self, self->target, PClass::FindActor("PlasmaBall")); self->special1 = level.maptime + 20; return 0; } @@ -606,7 +606,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_FireBFG) return 0; A_FaceTarget (self); - P_SpawnMissile (self, self->target, PClass::FindClass("BFGBall")); + P_SpawnMissile (self, self->target, PClass::FindActor("BFGBall")); self->special1 = level.maptime + 30; self->PainChance = MARINE_PAIN_CHANCE; return 0; diff --git a/src/g_game.cpp b/src/g_game.cpp index 77554bb26..52f07ad9c 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1283,7 +1283,7 @@ void G_PlayerReborn (int player) userinfo_t userinfo; // [RH] Save userinfo botskill_t b_skill;//Added by MC: APlayerPawn *actor; - const PClass *cls; + PClassPlayerPawn *cls; FString log; p = &players[player]; diff --git a/src/g_heretic/a_ironlich.cpp b/src/g_heretic/a_ironlich.cpp index f21dc5208..7b30e77e3 100644 --- a/src/g_heretic/a_ironlich.cpp +++ b/src/g_heretic/a_ironlich.cpp @@ -94,12 +94,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichAttack) randAttack = pr_atk (); if (randAttack < atkResolve1[dist]) { // Ice ball - P_SpawnMissile (self, target, PClass::FindClass("HeadFX1")); + P_SpawnMissile (self, target, PClass::FindActor("HeadFX1")); S_Sound (self, CHAN_BODY, "ironlich/attack2", 1, ATTN_NORM); } else if (randAttack < atkResolve2[dist]) { // Fire column - baseFire = P_SpawnMissile (self, target, PClass::FindClass("HeadFX3")); + baseFire = P_SpawnMissile (self, target, PClass::FindActor("HeadFX3")); if (baseFire != NULL) { baseFire->SetState (baseFire->FindState("NoGrow")); diff --git a/src/g_heretic/a_knight.cpp b/src/g_heretic/a_knight.cpp index d6a3d2760..36e83488b 100644 --- a/src/g_heretic/a_knight.cpp +++ b/src/g_heretic/a_knight.cpp @@ -61,11 +61,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_KnightAttack) S_Sound (self, CHAN_BODY, self->AttackSound, 1, ATTN_NORM); if (self->flags & MF_SHADOW || pr_knightatk () < 40) { // Red axe - P_SpawnMissileZ (self, self->z + 36*FRACUNIT, self->target, PClass::FindClass("RedAxe")); + P_SpawnMissileZ (self, self->z + 36*FRACUNIT, self->target, PClass::FindActor("RedAxe")); return 0; } // Green axe - P_SpawnMissileZ (self, self->z + 36*FRACUNIT, self->target, PClass::FindClass("KnightAxe")); + P_SpawnMissileZ (self, self->z + 36*FRACUNIT, self->target, PClass::FindActor("KnightAxe")); return 0; } diff --git a/src/g_hexen/a_bishop.cpp b/src/g_hexen/a_bishop.cpp index 23b4de431..e1d6e1d76 100644 --- a/src/g_hexen/a_bishop.cpp +++ b/src/g_hexen/a_bishop.cpp @@ -61,7 +61,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopAttack2) self->SetState (self->SeeState); return 0; } - mo = P_SpawnMissile (self, self->target, PClass::FindClass("BishopFX")); + mo = P_SpawnMissile (self, self->target, PClass::FindActor("BishopFX")); if (mo != NULL) { mo->tracer = self->target; diff --git a/src/g_hexen/a_blastradius.cpp b/src/g_hexen/a_blastradius.cpp index 3ab01f4a5..d08dd6673 100644 --- a/src/g_hexen/a_blastradius.cpp +++ b/src/g_hexen/a_blastradius.cpp @@ -22,7 +22,7 @@ // //========================================================================== -void BlastActor (AActor *victim, fixed_t strength, fixed_t speed, AActor * Owner, const PClass * blasteffect) +void BlastActor (AActor *victim, fixed_t strength, fixed_t speed, AActor *Owner, PClassActor *blasteffect) { angle_t angle,ang; AActor *mo; diff --git a/src/g_hexen/a_clericholy.cpp b/src/g_hexen/a_clericholy.cpp index d9171dc8b..a38b99e12 100644 --- a/src/g_hexen/a_clericholy.cpp +++ b/src/g_hexen/a_clericholy.cpp @@ -574,7 +574,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ClericAttack) if (!self->target) return 0; - AActor * missile = P_SpawnMissileZ (self, self->z + 40*FRACUNIT, self->target, PClass::FindClass ("HolyMissile")); + AActor * missile = P_SpawnMissileZ (self, self->z + 40*FRACUNIT, self->target, PClass::FindActor("HolyMissile")); if (missile != NULL) missile->tracer = NULL; // No initial target S_Sound (self, CHAN_WEAPON, "HolySymbolFire", 1, ATTN_NORM); return 0; diff --git a/src/g_hexen/a_dragon.cpp b/src/g_hexen/a_dragon.cpp index 87f58f196..7b0467dc8 100644 --- a/src/g_hexen/a_dragon.cpp +++ b/src/g_hexen/a_dragon.cpp @@ -93,7 +93,7 @@ static void DragonSeek (AActor *actor, angle_t thresh, angle_t turnMax) } else if (pr_dragonseek() < 128 && P_CheckMissileRange(actor)) { - P_SpawnMissile(actor, target, PClass::FindClass ("DragonFireball")); + P_SpawnMissile(actor, target, PClass::FindActor("DragonFireball")); S_Sound (actor, CHAN_WEAPON, actor->AttackSound, 1, ATTN_NORM); } actor->target = oldTarget; @@ -255,7 +255,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DragonAttack) { PARAM_ACTION_PROLOGUE; - P_SpawnMissile (self, self->target, PClass::FindClass ("DragonFireball")); + P_SpawnMissile (self, self->target, PClass::FindActor("DragonFireball")); return 0; } diff --git a/src/g_hexen/a_fighterquietus.cpp b/src/g_hexen/a_fighterquietus.cpp index 6a73b7eca..3b6b7542c 100644 --- a/src/g_hexen/a_fighterquietus.cpp +++ b/src/g_hexen/a_fighterquietus.cpp @@ -70,7 +70,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropWeaponPieces) for (int i = 0, j = 0, fineang = 0; i < 3; ++i) { - const PClass *cls = j==0? p1 : j==1? p2 : p3; + PClassActor *cls = j == 0 ? p1 : j == 1 ? p2 : p3; if (cls) { AActor *piece = Spawn (cls, self->x, self->y, self->z, ALLOW_REPLACE); diff --git a/src/g_hexen/a_firedemon.cpp b/src/g_hexen/a_firedemon.cpp index d13b6600e..ae93715e3 100644 --- a/src/g_hexen/a_firedemon.cpp +++ b/src/g_hexen/a_firedemon.cpp @@ -33,25 +33,25 @@ void A_FiredSpawnRock (AActor *actor) { AActor *mo; int x,y,z; - const PClass *rtype; + PClassActor *rtype; switch (pr_firedemonrock() % 5) { case 0: - rtype = PClass::FindClass ("FireDemonRock1"); + rtype = PClass::FindActor("FireDemonRock1"); break; case 1: - rtype = PClass::FindClass ("FireDemonRock2"); + rtype = PClass::FindActor("FireDemonRock2"); break; case 2: - rtype = PClass::FindClass ("FireDemonRock3"); + rtype = PClass::FindActor("FireDemonRock3"); break; case 3: - rtype = PClass::FindClass ("FireDemonRock4"); + rtype = PClass::FindActor("FireDemonRock4"); break; case 4: default: - rtype = PClass::FindClass ("FireDemonRock5"); + rtype = PClass::FindActor("FireDemonRock5"); break; } @@ -121,7 +121,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FiredAttack) if (self->target == NULL) return 0; - AActor *mo = P_SpawnMissile (self, self->target, PClass::FindClass ("FireDemonMissile")); + AActor *mo = P_SpawnMissile (self, self->target, PClass::FindActor("FireDemonMissile")); if (mo) S_Sound (self, CHAN_BODY, "FireDemonAttack", 1, ATTN_NORM); return 0; } diff --git a/src/g_hexen/a_flechette.cpp b/src/g_hexen/a_flechette.cpp index 7e60ec0a3..092203050 100644 --- a/src/g_hexen/a_flechette.cpp +++ b/src/g_hexen/a_flechette.cpp @@ -204,7 +204,7 @@ AInventory *AArtiPoisonBag::CreateCopy (AActor *other) } AInventory *copy; - const PClass *spawntype; + PClassActor *spawntype; if (other->IsKindOf (PClass::FindClass(NAME_ClericPlayer))) { diff --git a/src/g_hexen/a_healingradius.cpp b/src/g_hexen/a_healingradius.cpp index a18116dac..a4e66eb10 100644 --- a/src/g_hexen/a_healingradius.cpp +++ b/src/g_hexen/a_healingradius.cpp @@ -70,8 +70,8 @@ bool AArtiHealingRadius::Use (bool pickup) { int amount = 50 + (pr_healradius() % 50); - if (players[i].mo->GiveAmmo (PClass::FindClass(NAME_Mana1), amount) || - players[i].mo->GiveAmmo (PClass::FindClass(NAME_Mana2), amount)) + if (players[i].mo->GiveAmmo (dyn_cast(PClass::FindClass(NAME_Mana1)), amount) || + players[i].mo->GiveAmmo (dyn_cast(PClass::FindClass(NAME_Mana2)), amount)) { gotsome = true; } diff --git a/src/g_hexen/a_hexenspecialdecs.cpp b/src/g_hexen/a_hexenspecialdecs.cpp index 4f513cfe0..9012c3885 100644 --- a/src/g_hexen/a_hexenspecialdecs.cpp +++ b/src/g_hexen/a_hexenspecialdecs.cpp @@ -214,7 +214,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LeafSpawn) for (i = (pr_leaf()&3)+1; i; i--) { - mo = Spawn (pr_leaf()&1 ? PClass::FindClass ("Leaf1") : PClass::FindClass ("Leaf2"), + mo = Spawn (pr_leaf()&1 ? PClass::FindActor("Leaf1") : PClass::FindActor("Leaf2"), self->x + (pr_leaf.Random2()<<14), self->y + (pr_leaf.Random2()<<14), self->z + (pr_leaf()<<14), ALLOW_REPLACE); diff --git a/src/g_hexen/a_iceguy.cpp b/src/g_hexen/a_iceguy.cpp index e4a501443..c5f43ba30 100644 --- a/src/g_hexen/a_iceguy.cpp +++ b/src/g_hexen/a_iceguy.cpp @@ -100,12 +100,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyAttack) P_SpawnMissileXYZ(self->x+FixedMul(self->radius>>1, finecosine[an]), self->y+FixedMul(self->radius>>1, finesine[an]), self->z+40*FRACUNIT, self, self->target, - PClass::FindClass ("IceGuyFX")); + PClass::FindActor("IceGuyFX")); an = (self->angle-ANG90)>>ANGLETOFINESHIFT; P_SpawnMissileXYZ(self->x+FixedMul(self->radius>>1, finecosine[an]), self->y+FixedMul(self->radius>>1, finesine[an]), self->z+40*FRACUNIT, self, self->target, - PClass::FindClass ("IceGuyFX")); + PClass::FindActor("IceGuyFX")); S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM); return 0; } diff --git a/src/g_hexen/a_korax.cpp b/src/g_hexen/a_korax.cpp index d0509c408..74f346fb6 100644 --- a/src/g_hexen/a_korax.cpp +++ b/src/g_hexen/a_korax.cpp @@ -74,10 +74,10 @@ void A_KSpiritRoam (AActor *); void A_KBolt (AActor *); void A_KBoltRaise (AActor *); -void KoraxFire (AActor *actor, const PClass *type, int arm); +void KoraxFire (AActor *actor, PClassActor *type, int arm); void KSpiritInit (AActor *spirit, AActor *korax); AActor *P_SpawnKoraxMissile (fixed_t x, fixed_t y, fixed_t z, - AActor *source, AActor *dest, const PClass *type); + AActor *source, AActor *dest, PClassActor *type); extern void SpawnSpiritTail (AActor *spirit); @@ -237,11 +237,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxMissile) int type = pr_koraxmissile()%6; int i; - const PClass *info; + PClassActor *info; S_Sound (self, CHAN_VOICE, "KoraxAttack", 1, ATTN_NORM); - info = PClass::FindClass (choices[type].type); + info = PClass::FindActor(choices[type].type); if (info == NULL) { I_Error ("Unknown Korax missile: %s\n", choices[type].type); @@ -310,7 +310,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxCommand) // //============================================================================ -void KoraxFire (AActor *actor, const PClass *type, int arm) +void KoraxFire (AActor *actor, PClassActor *type, int arm) { static const int extension[6] = { @@ -533,7 +533,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KBoltRaise) //============================================================================ AActor *P_SpawnKoraxMissile (fixed_t x, fixed_t y, fixed_t z, - AActor *source, AActor *dest, const PClass *type) + AActor *source, AActor *dest, PClassActor *type) { AActor *th; angle_t an; diff --git a/src/g_raven/a_minotaur.cpp b/src/g_raven/a_minotaur.cpp index 138ef59f6..f2bd43ebc 100644 --- a/src/g_raven/a_minotaur.cpp +++ b/src/g_raven/a_minotaur.cpp @@ -246,15 +246,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurCharge) } if (self->special1 > 0) { - const PClass *type; + PClassActor *type; if (gameinfo.gametype == GAME_Heretic) { - type = PClass::FindClass ("PhoenixPuff"); + type = PClass::FindActor("PhoenixPuff"); } else { - type = PClass::FindClass ("PunchPuff"); + type = PClass::FindActor("PunchPuff"); } puff = Spawn (type, self->x, self->y, self->z, ALLOW_REPLACE); puff->velz = 2*FRACUNIT; @@ -362,7 +362,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk3) } else { - mo = P_SpawnMissile (self, self->target, PClass::FindClass("MinotaurFX2")); + mo = P_SpawnMissile (self, self->target, PClass::FindActor("MinotaurFX2")); if (mo != NULL) { S_Sound (mo, CHAN_WEAPON, "minotaur/attack1", 1, ATTN_NORM); diff --git a/src/g_shared/a_action.cpp b/src/g_shared/a_action.cpp index abaaa4e3e..6261591d9 100644 --- a/src/g_shared/a_action.cpp +++ b/src/g_shared/a_action.cpp @@ -91,8 +91,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_NoBlocking) { if (di->Name != NAME_None) { - const PClass *ti = PClass::FindClass(di->Name); - if (ti) P_DropItem (self, ti, di->Amount, di->Probability); + PClassActor *ti = PClass::FindActor(di->Name); + if (ti != NULL) + { + P_DropItem (self, ti, di->Amount, di->Probability); + } } di = di->Next; } diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index 0dcfac57c..48cd26370 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -1727,8 +1727,8 @@ void APowerMorph::InitEffect( ) if (Owner != NULL && Owner->player != NULL && PlayerClass != NAME_None) { player_t *realplayer = Owner->player; // Remember the identity of the player - const PClass *morph_flash = PClass::FindClass (MorphFlash); - const PClass *unmorph_flash = PClass::FindClass (UnMorphFlash); + PClassActor *morph_flash = PClass::FindActor(MorphFlash); + PClassActor *unmorph_flash = PClass::FindActor(UnMorphFlash); PClassPlayerPawn *player_class = dyn_cast(PClass::FindClass (PlayerClass)); if (P_MorphPlayer(realplayer, realplayer, player_class, -1/*INDEFINITELY*/, MorphStyle, morph_flash, unmorph_flash)) { diff --git a/src/g_shared/a_debris.cpp b/src/g_shared/a_debris.cpp index e6fc79b0a..807f8e3ef 100644 --- a/src/g_shared/a_debris.cpp +++ b/src/g_shared/a_debris.cpp @@ -32,7 +32,7 @@ IMPLEMENT_CLASS(AGlassShard) void P_SpawnDirt (AActor *actor, fixed_t radius) { fixed_t x,y,z; - const PClass *dtype = NULL; + PClassActor *dtype = NULL; AActor *mo; angle_t angle; @@ -43,7 +43,7 @@ void P_SpawnDirt (AActor *actor, fixed_t radius) char fmt[8]; mysnprintf(fmt, countof(fmt), "Dirt%d", 1 + pr_dirt()%6); - dtype = PClass::FindClass(fmt); + dtype = PClass::FindActor(fmt); if (dtype) { mo = Spawn (dtype, x, y, z, ALLOW_REPLACE); diff --git a/src/g_shared/a_fastprojectile.cpp b/src/g_shared/a_fastprojectile.cpp index 614985234..e319ca1b3 100644 --- a/src/g_shared/a_fastprojectile.cpp +++ b/src/g_shared/a_fastprojectile.cpp @@ -163,7 +163,7 @@ void AFastProjectile::Effect() hitz = floorz; } - const PClass *trail = PClass::FindClass(name); + PClassActor *trail = PClass::FindActor(name); if (trail != NULL) { AActor *act = Spawn (trail, x, y, hitz, ALLOW_REPLACE); diff --git a/src/g_shared/a_morph.cpp b/src/g_shared/a_morph.cpp index 70f79b3a0..0cdd48768 100644 --- a/src/g_shared/a_morph.cpp +++ b/src/g_shared/a_morph.cpp @@ -25,7 +25,7 @@ static FRandom pr_morphmonst ("MorphMonster"); // //--------------------------------------------------------------------------- -bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntype, int duration, int style, const PClass *enter_flash, const PClass *exit_flash) +bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntype, int duration, int style, PClassActor *enter_flash, PClassActor *exit_flash) { AInventory *item; APlayerPawn *morphed; @@ -246,7 +246,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag, mo->flags2 = (mo->flags2 & ~MF2_FLY) | (pmo->flags2 & MF2_FLY); mo->flags3 = (mo->flags3 & ~MF3_GHOST) | (pmo->flags3 & MF3_GHOST); - const PClass *exit_flash = player->MorphExitFlash; + PClassActor *exit_flash = player->MorphExitFlash; bool correctweapon = !!(player->MorphStyle & MORPH_LOSEACTUALWEAPON); bool undobydeathsaves = !!(player->MorphStyle & MORPH_UNDOBYDEATHSAVES); @@ -372,7 +372,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag, // //--------------------------------------------------------------------------- -bool P_MorphMonster (AActor *actor, const PClass *spawntype, int duration, int style, const PClass *enter_flash, const PClass *exit_flash) +bool P_MorphMonster (AActor *actor, PClassActor *spawntype, int duration, int style, PClassActor *enter_flash, PClassActor *exit_flash) { AMorphedMonster *morphed; @@ -464,7 +464,7 @@ bool P_UndoMonsterMorph (AMorphedMonster *beast, bool force) actor->AddToHash (); beast->UnmorphedMe = NULL; DObject::StaticPointerSubstitution (beast, actor); - const PClass *exit_flash = beast->MorphExitFlash; + PClassActor *exit_flash = beast->MorphExitFlash; beast->Destroy (); Spawn(exit_flash, beast->x, beast->y, beast->z + TELEFOGHEIGHT, ALLOW_REPLACE); return true; @@ -552,8 +552,8 @@ IMPLEMENT_CLASS(AMorphProjectile) int AMorphProjectile::DoSpecialDamage (AActor *target, int damage) { - const PClass *morph_flash = PClass::FindClass (MorphFlash); - const PClass *unmorph_flash = PClass::FindClass (UnMorphFlash); + PClassActor *morph_flash = PClass::FindActor(MorphFlash); + PClassActor *unmorph_flash = PClass::FindActor(UnMorphFlash); if (target->player) { PClassPlayerPawn *player_class = dyn_cast(PClass::FindClass(PlayerClass)); @@ -561,7 +561,7 @@ int AMorphProjectile::DoSpecialDamage (AActor *target, int damage) } else { - const PClass *monster_class = PClass::FindClass (MonsterClass); + PClassActor *monster_class = PClass::FindActor(MonsterClass); P_MorphMonster (target, monster_class, Duration, MorphStyle, morph_flash, unmorph_flash); } return -1; diff --git a/src/g_shared/a_morph.h b/src/g_shared/a_morph.h index 8ea90bf5d..fb0e4c65d 100644 --- a/src/g_shared/a_morph.h +++ b/src/g_shared/a_morph.h @@ -34,10 +34,10 @@ class player_t; class AMorphedMonster; bool P_MorphPlayer (player_t *activator, player_t *player, PClassPlayerPawn *morphclass, int duration = 0, int style = 0, - const PClass *enter_flash = NULL, const PClass *exit_flash = NULL); + PClassActor *enter_flash = NULL, PClassActor *exit_flash = NULL); bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag = 0, bool force = false); -bool P_MorphMonster (AActor *actor, const PClass *morphclass, int duration = 0, int style = 0, - const PClass *enter_flash = NULL, const PClass *exit_flash = NULL); +bool P_MorphMonster (AActor *actor, PClassActor *morphclass, int duration = 0, int style = 0, + PClassActor *enter_flash = NULL, PClassActor *exit_flash = NULL); bool P_UndoMonsterMorph (AMorphedMonster *beast, bool force = false); bool P_UpdateMorphedMonster (AActor *actor); bool P_MorphedDeath(AActor *actor, AActor **morphed, int *morphedstyle, int *morphedhealth); diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index 8d895bb68..f877de77b 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -1660,7 +1660,7 @@ AInventory *ABackpackItem::CreateCopy (AActor *other) if (amount < 0) amount = 0; if (ammo == NULL) { // The player did not have the ammo. Add it. - ammo = static_cast(Spawn (type, 0, 0, 0, NO_REPLACE)); + ammo = static_cast(Spawn(atype, 0, 0, 0, NO_REPLACE)); ammo->Amount = bDepleted ? 0 : amount; if (ammo->BackpackMaxAmount > ammo->MaxAmount) { diff --git a/src/g_shared/a_randomspawner.cpp b/src/g_shared/a_randomspawner.cpp index 48e21e791..60c8372f9 100644 --- a/src/g_shared/a_randomspawner.cpp +++ b/src/g_shared/a_randomspawner.cpp @@ -100,16 +100,26 @@ class ARandomSpawner : public AActor // necessary to them -- such as their source and destination. void PostBeginPlay() { - AActor * newmobj = NULL; + AActor *newmobj = NULL; bool boss = false; - if (Species == NAME_None) { Destroy(); return; } - const PClass * cls = PClass::FindClass(Species); + if (Species == NAME_None) + { + Destroy(); + return; + } + PClassActor *cls = PClass::FindActor(Species); if (this->flags & MF_MISSILE && target && target->target) // Attempting to spawn a missile. { - if ((tracer == NULL) && (flags2 & MF2_SEEKERMISSILE)) tracer = target->target; + if ((tracer == NULL) && (flags2 & MF2_SEEKERMISSILE)) + { + tracer = target->target; + } newmobj = P_SpawnMissileXYZ(x, y, z, target, target->target, cls, false); } - else newmobj = Spawn(cls, x, y, z, NO_REPLACE); + else + { + newmobj = Spawn(cls, x, y, z, NO_REPLACE); + } if (newmobj != NULL) { // copy everything relevant diff --git a/src/g_shared/a_sharedglobal.h b/src/g_shared/a_sharedglobal.h index c152bf44d..46073253f 100644 --- a/src/g_shared/a_sharedglobal.h +++ b/src/g_shared/a_sharedglobal.h @@ -176,7 +176,7 @@ public: TObjPtr UnmorphedMe; int UnmorphTime, MorphStyle; - const PClass *MorphExitFlash; + PClassActor *MorphExitFlash; DWORD FlagsSave; }; diff --git a/src/g_strife/a_alienspectres.cpp b/src/g_strife/a_alienspectres.cpp index 1c58805b9..0e79642ad 100644 --- a/src/g_strife/a_alienspectres.cpp +++ b/src/g_strife/a_alienspectres.cpp @@ -16,8 +16,6 @@ static FRandom pr_spectrespawn ("AlienSpectreSpawn"); static FRandom pr_spectrechunk ("212e4"); -AActor *P_SpawnSubMissile (AActor *source, const PClass *type, AActor *target); - //============================================================================ DEFINE_ACTION_FUNCTION(AActor, A_SpectreChunkSmall) @@ -80,7 +78,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Spectre3Attack) for (int i = 0; i < 20; ++i) { self->angle += ANGLE_180 / 20; - P_SpawnSubMissile (self, PClass::FindClass("SpectralLightningBall2"), self); + P_SpawnSubMissile (self, PClass::FindActor("SpectralLightningBall2"), self); } self->angle -= ANGLE_180 / 20 * 10; return 0; diff --git a/src/g_strife/a_entityboss.cpp b/src/g_strife/a_entityboss.cpp index 3df9a786a..d9b4db285 100644 --- a/src/g_strife/a_entityboss.cpp +++ b/src/g_strife/a_entityboss.cpp @@ -28,7 +28,7 @@ void A_SpectralMissile (AActor *self, const char *missilename) if (self->target != NULL) { AActor *missile = P_SpawnMissileXYZ (self->x, self->y, self->z + 32*FRACUNIT, - self, self->target, PClass::FindClass(missilename), false); + self, self->target, PClass::FindActor(missilename), false); if (missile != NULL) { missile->tracer = self->target; diff --git a/src/g_strife/a_spectral.cpp b/src/g_strife/a_spectral.cpp index 75757500a..5e1ea9a63 100644 --- a/src/g_strife/a_spectral.cpp +++ b/src/g_strife/a_spectral.cpp @@ -9,8 +9,6 @@ #include "thingdef/thingdef.h" */ -AActor *P_SpawnSubMissile (AActor *source, const PClass *type, AActor *target); - class ASpectralMonster : public AActor { DECLARE_CLASS (ASpectralMonster, AActor) @@ -41,7 +39,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectralBigBallLightning) { PARAM_ACTION_PROLOGUE; - const PClass *cls = PClass::FindClass("SpectralLightningH3"); + PClassActor *cls = PClass::FindActor("SpectralLightningH3"); if (cls) { self->angle += ANGLE_90; @@ -72,8 +70,8 @@ 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(NAME_SpectralLightningV2) : - PClass::FindClass(NAME_SpectralLightningV1), x, y, ONCEILINGZ, ALLOW_REPLACE); + flash = Spawn (self->threshold > 25 ? PClass::FindActor(NAME_SpectralLightningV2) : + PClass::FindActor(NAME_SpectralLightningV1), x, y, ONCEILINGZ, ALLOW_REPLACE); flash->target = self->target; flash->velz = -18*FRACUNIT; diff --git a/src/g_strife/a_strifeitems.cpp b/src/g_strife/a_strifeitems.cpp index e5cc4136e..38aa2e758 100644 --- a/src/g_strife/a_strifeitems.cpp +++ b/src/g_strife/a_strifeitems.cpp @@ -81,7 +81,7 @@ bool AHealthTraining::TryPickup (AActor *&toucher) { if (Super::TryPickup (toucher)) { - toucher->GiveInventoryType (PClass::FindClass("GunTraining")); + toucher->GiveInventoryType (PClass::FindActor("GunTraining")); AInventory *coin = Spawn (0,0,0, NO_REPLACE); if (coin != NULL) { diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index d747872a8..822e5c596 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -566,7 +566,7 @@ void APowerCoupling::Die (AActor *source, AActor *inflictor) players[i].mo->GiveInventoryType (QuestItemClasses[5]); S_Sound (CHAN_VOICE, "svox/voc13", 1, ATTN_NORM); players[i].SetLogNumber (13); - P_DropItem (this, PClass::FindClass("BrokenPowerCoupling"), -1, 256); + P_DropItem (this, PClass::FindActor("BrokenPowerCoupling"), -1, 256); Destroy (); } diff --git a/src/g_strife/a_strifeweapons.cpp b/src/g_strife/a_strifeweapons.cpp index 4e3db52ae..da345f692 100644 --- a/src/g_strife/a_strifeweapons.cpp +++ b/src/g_strife/a_strifeweapons.cpp @@ -522,8 +522,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMauler2) // //============================================================================ -AActor *P_SpawnSubMissile (AActor *source, const PClass *type, AActor *target); - DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave) { PARAM_ACTION_PROLOGUE; @@ -542,13 +540,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave) for (int i = 0; i < 80; ++i) { self->angle += ANGLE_45/10; - P_SpawnSubMissile (self, PClass::FindClass("MaulerTorpedoWave"), self->target); + P_SpawnSubMissile (self, PClass::FindActor("MaulerTorpedoWave"), self->target); } self->z = savedz; return 0; } -AActor *P_SpawnSubMissile (AActor *source, const PClass *type, AActor *target) +AActor *P_SpawnSubMissile (AActor *source, PClassActor *type, AActor *target) { AActor *other = Spawn (type, source->x, source->y, source->z, ALLOW_REPLACE); @@ -1040,7 +1038,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil3) for (i = 0; i < 20; ++i) { self->angle += ANGLE_180/20; - spot = P_SpawnSubMissile (self, PClass::FindClass("SpectralLightningBall1"), self); + spot = P_SpawnSubMissile (self, PClass::FindActor("SpectralLightningBall1"), self); if (spot != NULL) { spot->z = self->z + 32*FRACUNIT; diff --git a/src/info.h b/src/info.h index bf7a38fbc..3af996b44 100644 --- a/src/info.h +++ b/src/info.h @@ -95,8 +95,8 @@ struct FState } void SetAction(VMFunction *func) { ActionFunc = func; } bool CallAction(AActor *self, AActor *stateowner, StateCallData *statecall = NULL); - static const PClassActor *StaticFindStateOwner (const FState *state); - static const PClassActor *StaticFindStateOwner (const FState *state, const PClassActor *info); + static PClassActor *StaticFindStateOwner (const FState *state); + static PClassActor *StaticFindStateOwner (const FState *state, PClassActor *info); }; struct FStateLabels; diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index ad948264e..bb59780bd 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -250,7 +250,7 @@ void cht_DoCheat (player_t *player, int cheat) { if (i != 0) { - player->mo->GiveInventoryType (*BeholdPowers[i]); + player->mo->GiveInventoryType(static_cast(*BeholdPowers[i])); if (cheat == CHT_BEHOLDS) { P_GiveBody (player->mo, -100); @@ -551,7 +551,7 @@ const char *cht_Morph (player_t *player, PClassPlayerPawn *morphclass, bool quic return ""; } -void GiveSpawner (player_t *player, const PClass *type, int amount) +void GiveSpawner (player_t *player, PClassInventory *type, int amount) { if (player->mo == NULL || player->health <= 0) { @@ -648,7 +648,7 @@ void cht_Give (player_t *player, const char *name, int amount) type = PClass::FindClass(gameinfo.backpacktype); if (type != NULL) { - GiveSpawner (player, type, 1); + GiveSpawner (player, static_cast(type), 1); } if (!giveall) @@ -665,10 +665,11 @@ void cht_Give (player_t *player, const char *name, int amount) if (type->ParentClass == RUNTIME_CLASS(AAmmo)) { - AInventory *ammo = player->mo->FindInventory(static_cast(type)); + PClassAmmo *atype = static_cast(type); + AInventory *ammo = player->mo->FindInventory(atype); if (ammo == NULL) { - ammo = static_cast(Spawn (type, 0, 0, 0, NO_REPLACE)); + ammo = static_cast(Spawn (atype, 0, 0, 0, NO_REPLACE)); ammo->AttachToOwner (player->mo); ammo->Amount = ammo->MaxAmount; } @@ -722,7 +723,7 @@ void cht_Give (player_t *player, const char *name, int amount) AKey *key = (AKey *)GetDefaultByType (PClass::m_Types[i]); if (key->KeyNumber != 0) { - key = static_cast(Spawn (PClass::m_Types[i], 0,0,0, NO_REPLACE)); + key = static_cast(Spawn(static_cast(PClass::m_Types[i]), 0,0,0, NO_REPLACE)); if (!key->CallTryPickup (player->mo)) { key->Destroy (); @@ -755,7 +756,7 @@ void cht_Give (player_t *player, const char *name, int amount) AWeapon *def = (AWeapon*)GetDefaultByType (type); if (!(def->WeaponFlags & WIF_CHEATNOTWEAPON)) { - GiveSpawner (player, type, 1); + GiveSpawner (player, static_cast(type), 1); } } } @@ -779,7 +780,7 @@ void cht_Give (player_t *player, const char *name, int amount) !type->IsDescendantOf (RUNTIME_CLASS(APowerup)) && !type->IsDescendantOf (RUNTIME_CLASS(AArmor))) { - GiveSpawner (player, type, 1); + GiveSpawner (player, static_cast(type), 1); } } } @@ -797,7 +798,7 @@ void cht_Give (player_t *player, const char *name, int amount) AInventory *def = (AInventory*)GetDefaultByType (type); if (def->Icon.isValid()) { - GiveSpawner (player, type, 1); + GiveSpawner (player, static_cast(type), 1); } } } @@ -816,7 +817,7 @@ void cht_Give (player_t *player, const char *name, int amount) } else { - GiveSpawner (player, type, amount); + GiveSpawner (player, static_cast(type), amount); } return; } diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 32b28db3e..202eb24ab 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -424,7 +424,7 @@ static void ClearInventory (AActor *activator) // //============================================================================ -static void DoGiveInv (AActor *actor, const PClass *info, int amount) +static void DoGiveInv (AActor *actor, PClassActor *info, int amount) { AWeapon *savedPendingWeap = actor->player != NULL ? actor->player->PendingWeapon : NULL; @@ -479,7 +479,7 @@ static void DoGiveInv (AActor *actor, const PClass *info, int amount) static void GiveInventory (AActor *activator, const char *type, int amount) { - const PClass *info; + PClassActor *info; if (amount <= 0 || type == NULL) { @@ -489,7 +489,7 @@ static void GiveInventory (AActor *activator, const char *type, int amount) { type = "BasicArmorPickup"; } - info = PClass::FindClass (type); + info = PClass::FindActor(type); if (info == NULL) { Printf ("ACS: I don't know what %s is.\n", type); @@ -2259,7 +2259,7 @@ void DLevelScript::ReplaceTextures (int fromnamei, int tonamei, int flags) int DLevelScript::DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, int angle, bool force) { - const PClass *info = PClass::FindClass (FBehavior::StaticLookupString (type)); + PClassActor *info = PClass::FindActor(FBehavior::StaticLookupString (type)); AActor *actor = NULL; int spawncount = 0; @@ -5536,7 +5536,7 @@ int DLevelScript::RunScript () } else { - item = activator->GiveInventoryType (type); + item = activator->GiveInventoryType (static_cast(type)); item->MaxAmount = STACK(1); item->Amount = 0; } @@ -6356,13 +6356,13 @@ int DLevelScript::RunScript () FName playerclass_name = FBehavior::StaticLookupString(STACK(6)); PClassPlayerPawn *playerclass = dyn_cast(PClass::FindClass (playerclass_name)); FName monsterclass_name = FBehavior::StaticLookupString(STACK(5)); - const PClass *monsterclass = PClass::FindClass (monsterclass_name); + PClassActor *monsterclass = PClass::FindActor(monsterclass_name); int duration = STACK(4); int style = STACK(3); FName morphflash_name = FBehavior::StaticLookupString(STACK(2)); - const PClass *morphflash = PClass::FindClass (morphflash_name); + PClassActor *morphflash = PClass::FindActor(morphflash_name); FName unmorphflash_name = FBehavior::StaticLookupString(STACK(1)); - const PClass *unmorphflash = PClass::FindClass (unmorphflash_name); + PClassActor *unmorphflash = PClass::FindActor(unmorphflash_name); int changes = 0; if (tag == 0) diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index c08e9ff7f..69146fd99 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -2907,7 +2907,7 @@ void ModifyDropAmount(AInventory *inv, int dropamount) CVAR(Int, sv_dropstyle, 0, CVAR_SERVERINFO | CVAR_ARCHIVE); -AInventory *P_DropItem (AActor *source, const PClass *type, int dropamount, int chance) +AInventory *P_DropItem (AActor *source, PClassActor *type, int dropamount, int chance) { if (type != NULL && pr_dropitem() <= chance) { @@ -2918,9 +2918,11 @@ AInventory *P_DropItem (AActor *source, const PClass *type, int dropamount, int if (!(i_compatflags & COMPATF_NOTOSSDROPS)) { int style = sv_dropstyle; - if (style==0) style= (gameinfo.gametype == GAME_Strife)? 2:1; - - if (style==2) + if (style == 0) + { + style = (gameinfo.gametype == GAME_Strife) ? 2 : 1; + } + if (style == 2) { spawnz += 24*FRACUNIT; } @@ -2929,7 +2931,7 @@ AInventory *P_DropItem (AActor *source, const PClass *type, int dropamount, int spawnz += source->height / 2; } } - mo = Spawn (type, source->x, source->y, spawnz, ALLOW_REPLACE); + mo = Spawn(type, source->x, source->y, spawnz, ALLOW_REPLACE); if (mo != NULL) { mo->flags |= MF_DROPPED; @@ -2940,7 +2942,7 @@ AInventory *P_DropItem (AActor *source, const PClass *type, int dropamount, int } if (mo->IsKindOf (RUNTIME_CLASS(AInventory))) { - AInventory * inv = static_cast(mo); + AInventory *inv = static_cast(mo); ModifyDropAmount(inv, dropamount); if (inv->SpecialDropAction (source)) { diff --git a/src/p_enemy.h b/src/p_enemy.h index 4b66f9d20..9c1aee156 100644 --- a/src/p_enemy.h +++ b/src/p_enemy.h @@ -51,7 +51,7 @@ bool P_CheckMeleeRange2 (AActor *actor); bool P_Move (AActor *actor); bool P_TryWalk (AActor *actor); void P_NewChaseDir (AActor *actor); -AInventory *P_DropItem (AActor *source, const PClass *type, int special, int chance); +AInventory *P_DropItem (AActor *source, PClassActor *type, int special, int chance); void P_TossItem (AActor *item); bool P_LookForPlayers (AActor *actor, INTBOOL allaround, FLookExParams *params); void A_Weave(AActor *self, int xyspeed, int zspeed, fixed_t xydist, fixed_t zdist); diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 4dda3cc24..82fa2efa7 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -2556,7 +2556,7 @@ FUNC(LS_SetPlayerProperty) { // Give power to activator if (power != 4) { - APowerup *item = static_cast(it->GiveInventoryType (*powers[power])); + APowerup *item = static_cast(it->GiveInventoryType(static_cast(*powers[power]))); if (item != NULL && power == 0 && arg1 == 1) { item->BlendColor = MakeSpecialColormap(INVERSECOLORMAP); diff --git a/src/p_local.h b/src/p_local.h index 822d6f787..4139f314e 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -111,9 +111,10 @@ void P_RipperBlood (AActor *mo, AActor *bleeder); int P_GetThingFloorType (AActor *thing); void P_ExplodeMissile (AActor *missile, line_t *explodeline, AActor *target); -AActor *P_SpawnMissile (AActor* source, AActor* dest, const PClass *type, AActor* owner = NULL); -AActor *P_SpawnMissileZ (AActor* source, fixed_t z, AActor* dest, const PClass *type); -AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z, AActor *source, AActor *dest, const PClass *type, bool checkspawn = true, AActor *owner = NULL); +AActor * P_OldSpawnMissile(AActor *source, AActor *owner, AActor *dest, PClassActor *type); +AActor *P_SpawnMissile (AActor* source, AActor* dest, PClassActor *type, AActor* owner = NULL); +AActor *P_SpawnMissileZ (AActor* source, fixed_t z, AActor* dest, PClassActor *type); +AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z, AActor *source, AActor *dest, PClassActor *type, bool checkspawn = true, AActor *owner = NULL); AActor *P_SpawnMissileAngle (AActor *source, PClassActor *type, angle_t angle, fixed_t velz); AActor *P_SpawnMissileAngleSpeed (AActor *source, PClassActor *type, angle_t angle, fixed_t velz, fixed_t speed); AActor *P_SpawnMissileAngleZ (AActor *source, fixed_t z, PClassActor *type, angle_t angle, fixed_t velz); @@ -127,6 +128,9 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, P void P_CheckFakeFloorTriggers (AActor *mo, fixed_t oldz, bool oldz_has_viewheight=false); +AActor *P_SpawnSubMissile (AActor *source, PClassActor *type, AActor *target); // Strife uses it + + // // [RH] P_THINGS // diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index caed7d7b9..4b38cb93a 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -849,7 +849,7 @@ AInventory *AActor::FindInventory (FName type) // //============================================================================ -AInventory *AActor::GiveInventoryType (const PClass *type) +AInventory *AActor::GiveInventoryType (PClassActor *type) { AInventory *item = NULL; @@ -873,7 +873,7 @@ AInventory *AActor::GiveInventoryType (const PClass *type) // //============================================================================ -bool AActor::GiveAmmo (const PClass *type, int amount) +bool AActor::GiveAmmo (PClassAmmo *type, int amount) { if (type != NULL) { @@ -5049,19 +5049,19 @@ static fixed_t GetDefaultSpeed(PClassActor *type) // //--------------------------------------------------------------------------- -AActor *P_SpawnMissile (AActor *source, AActor *dest, const PClass *type, AActor *owner) +AActor *P_SpawnMissile (AActor *source, AActor *dest, PClassActor *type, AActor *owner) { return P_SpawnMissileXYZ (source->x, source->y, source->z + 32*FRACUNIT, source, dest, type, true, owner); } -AActor *P_SpawnMissileZ (AActor *source, fixed_t z, AActor *dest, const PClass *type) +AActor *P_SpawnMissileZ (AActor *source, fixed_t z, AActor *dest, PClassActor *type) { return P_SpawnMissileXYZ (source->x, source->y, z, source, dest, type); } AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z, - AActor *source, AActor *dest, const PClass *type, bool checkspawn, AActor *owner) + AActor *source, AActor *dest, PClassActor *type, bool checkspawn, AActor *owner) { if (dest == NULL) { @@ -5124,7 +5124,7 @@ AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z, return (!checkspawn || P_CheckMissileSpawn (th)) ? th : NULL; } -AActor * P_OldSpawnMissile(AActor * source, AActor * owner, AActor * dest, const PClass *type) +AActor *P_OldSpawnMissile(AActor *source, AActor *owner, AActor *dest, PClassActor *type) { angle_t an; fixed_t dist; diff --git a/src/p_states.cpp b/src/p_states.cpp index cd5543a74..25fd73f70 100644 --- a/src/p_states.cpp +++ b/src/p_states.cpp @@ -60,7 +60,7 @@ FArchive &operator<< (FArchive &arc, FState *&state) { - const PClassActor *info; + PClassActor *info; if (arc.IsStoring ()) { @@ -94,7 +94,7 @@ FArchive &operator<< (FArchive &arc, FState *&state) } else { - const PClassActor *info; + PClassActor *info; DWORD ofs; arc.UserReadClass(info); @@ -117,7 +117,7 @@ FArchive &operator<< (FArchive &arc, FState *&state) // //========================================================================== -const PClassActor *FState::StaticFindStateOwner (const FState *state) +PClassActor *FState::StaticFindStateOwner (const FState *state) { for (unsigned int i = 0; i < PClass::m_RuntimeActors.Size(); ++i) { @@ -139,7 +139,7 @@ const PClassActor *FState::StaticFindStateOwner (const FState *state) // //========================================================================== -const PClassActor *FState::StaticFindStateOwner (const FState *state, const PClassActor *info) +PClassActor *FState::StaticFindStateOwner (const FState *state, PClassActor *info) { while (info != NULL) { diff --git a/src/p_teleport.cpp b/src/p_teleport.cpp index 8fe870e82..50da26824 100644 --- a/src/p_teleport.cpp +++ b/src/p_teleport.cpp @@ -74,7 +74,7 @@ void ATeleportFog::PostBeginPlay () void P_SpawnTeleportFog(fixed_t x, fixed_t y, fixed_t z, int spawnid) { - const PClass *fog=NULL; + PClassActor *fog = NULL; if (spawnid > 0 && spawnid < MAX_SPAWNABLES && SpawnableThings[spawnid] != NULL) { diff --git a/src/p_terrain.h b/src/p_terrain.h index 9c28b3e90..01cbab80b 100644 --- a/src/p_terrain.h +++ b/src/p_terrain.h @@ -81,9 +81,9 @@ struct FSplashDef FName Name; FSoundID SmallSplashSound; FSoundID NormalSplashSound; - const PClass *SmallSplash; - const PClass *SplashBase; - const PClass *SplashChunk; + PClassActor *SmallSplash; + PClassActor *SplashBase; + PClassActor *SplashChunk; BYTE ChunkXVelShift; BYTE ChunkYVelShift; BYTE ChunkZVelShift; diff --git a/src/p_user.cpp b/src/p_user.cpp index e76d706b8..5c7c3f632 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -798,7 +798,7 @@ void APlayerPawn::GiveDeathmatchInventory() AKey *key = (AKey *)GetDefaultByType (PClass::m_Types[i]); if (key->KeyNumber != 0) { - key = static_cast(Spawn (PClass::m_Types[i], 0,0,0, NO_REPLACE)); + key = static_cast(Spawn(static_cast(PClass::m_Types[i]), 0,0,0, NO_REPLACE)); if (!key->CallTryPickup (this)) { key->Destroy (); diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 72bfb4d1f..e76597728 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -174,7 +174,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_UnsetFloat) // //========================================================================== static void DoAttack (AActor *self, bool domelee, bool domissile, - int MeleeDamage, FSoundID MeleeSound, const PClass *MissileType,fixed_t MissileHeight) + int MeleeDamage, FSoundID MeleeSound, PClassActor *MissileType,fixed_t MissileHeight) { if (self->target == NULL) return; @@ -189,9 +189,9 @@ static void DoAttack (AActor *self, bool domelee, bool domissile, else if (domissile && MissileType != NULL) { // This seemingly senseless code is needed for proper aiming. - self->z+=MissileHeight-32*FRACUNIT; - AActor * missile = P_SpawnMissileXYZ (self->x, self->y, self->z + 32*FRACUNIT, self, self->target, MissileType, false); - self->z-=MissileHeight-32*FRACUNIT; + self->z += MissileHeight - 32*FRACUNIT; + AActor *missile = P_SpawnMissileXYZ (self->x, self->y, self->z + 32*FRACUNIT, self, self->target, MissileType, false); + self->z -= MissileHeight - 32*FRACUNIT; if (missile) {