From bfcd714186c44d87e86cab73f52ed6f74c201d5a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 2 Dec 2018 21:35:04 +0100 Subject: [PATCH] - started replacing direct references to class AInventory. The easiest part was the type checks which could be changed to the name variant with a global search and replace. --- src/c_cmds.cpp | 4 ++-- src/d_dehacked.cpp | 2 +- src/fragglescript/t_func.cpp | 2 +- src/g_inventory/a_keys.cpp | 2 +- src/g_shared/a_specialspot.cpp | 2 +- src/hwrenderer/scene/hw_sprites.cpp | 4 ++-- src/info.cpp | 2 +- src/p_acs.cpp | 4 ++-- src/p_actionfunctions.cpp | 2 +- src/p_conversation.cpp | 6 +++--- src/p_map.cpp | 2 +- src/p_mobj.cpp | 2 +- src/p_usdf.cpp | 2 +- src/polyrenderer/scene/poly_sprite.cpp | 2 +- 14 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index 57c4c20ea..f43e77473 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -903,12 +903,12 @@ static bool IsActorAMonster(AActor *mo) static bool IsActorAnItem(AActor *mo) { - return mo->IsKindOf(RUNTIME_CLASS(AInventory)) && mo->flags&MF_SPECIAL; + return mo->IsKindOf(NAME_Inventory) && mo->flags&MF_SPECIAL; } static bool IsActorACountItem(AActor *mo) { - return mo->IsKindOf(RUNTIME_CLASS(AInventory)) && mo->flags&MF_SPECIAL && mo->flags&MF_COUNTITEM; + return mo->IsKindOf(NAME_Inventory) && mo->flags&MF_SPECIAL && mo->flags&MF_COUNTITEM; } // [SP] for all actors diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index de6e37815..f33cd2129 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -3054,7 +3054,7 @@ void FinishDehPatch () FStateDefinitions statedef; statedef.MakeStateDefines(type); - if (!type->IsDescendantOf(RUNTIME_CLASS(AInventory))) + if (!type->IsDescendantOf(NAME_Inventory)) { // If this is a hacked non-inventory item we must also copy AInventory's special states statedef.AddStateDefines(RUNTIME_CLASS(AInventory)->GetStateLabels()); diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index 13f42b4fe..8194a371b 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -3658,7 +3658,7 @@ void FParser::SF_ThingCount(void) again: TThinkerIterator it; - if (t_argc<2 || intvalue(t_argv[1])==0 || pClass->IsDescendantOf(RUNTIME_CLASS(AInventory))) + if (t_argc<2 || intvalue(t_argv[1])==0 || pClass->IsDescendantOf(NAME_Inventory)) { while ((mo=it.Next())) { diff --git a/src/g_inventory/a_keys.cpp b/src/g_inventory/a_keys.cpp index 0be3100c2..568c7b386 100644 --- a/src/g_inventory/a_keys.cpp +++ b/src/g_inventory/a_keys.cpp @@ -178,7 +178,7 @@ static void AddOneKey(Keygroup *keygroup, PClassActor *mi, FScanner &sc) if (mi) { // Any inventory item can be used to unlock a door - if (mi->IsDescendantOf(RUNTIME_CLASS(AInventory))) + if (mi->IsDescendantOf(NAME_Inventory)) { OneKey k = {mi,1}; keygroup->anykeylist.Push (k); diff --git a/src/g_shared/a_specialspot.cpp b/src/g_shared/a_specialspot.cpp index 511833ff9..dd65014f4 100644 --- a/src/g_shared/a_specialspot.cpp +++ b/src/g_shared/a_specialspot.cpp @@ -452,7 +452,7 @@ DEFINE_ACTION_FUNCTION(ASpecialSpot, A_SpawnSingleItem) { spawned->flags &= ~MF_DROPPED; } - if (spawned->IsKindOf(RUNTIME_CLASS(AInventory))) + if (spawned->IsKindOf(NAME_Inventory)) { static_cast(spawned)->SpawnPointClass = self->GetClass(); } diff --git a/src/hwrenderer/scene/hw_sprites.cpp b/src/hwrenderer/scene/hw_sprites.cpp index fe7a0aa36..6ea4a1b1f 100644 --- a/src/hwrenderer/scene/hw_sprites.cpp +++ b/src/hwrenderer/scene/hw_sprites.cpp @@ -555,7 +555,7 @@ void GLSprite::SplitSprite(HWDrawInfo *di, sector_t * frontsector, bool transluc void GLSprite::PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingpos, float spriteheight) { const float NO_VAL = 100000000.0f; - bool clipthing = (thing->player || thing->flags3&MF3_ISMONSTER || thing->IsKindOf(RUNTIME_CLASS(AInventory))) && (thing->flags&MF_ICECORPSE || !(thing->flags&MF_CORPSE)); + bool clipthing = (thing->player || thing->flags3&MF3_ISMONSTER || thing->IsKindOf(NAME_Inventory)) && (thing->flags&MF_ICECORPSE || !(thing->flags&MF_CORPSE)); bool smarterclip = !clipthing && gl_spriteclip == 3; if (clipthing || gl_spriteclip > 1) { @@ -932,7 +932,7 @@ void GLSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t if (di->isNightvision()) { - if ((thing->IsKindOf(RUNTIME_CLASS(AInventory)) || thing->flags3&MF3_ISMONSTER || thing->flags&MF_MISSILE || thing->flags&MF_CORPSE)) + if ((thing->IsKindOf(NAME_Inventory) || thing->flags3&MF3_ISMONSTER || thing->flags&MF_MISSILE || thing->flags&MF_CORPSE)) { RenderStyle.Flags |= STYLEF_InvertSource; } diff --git a/src/info.cpp b/src/info.cpp index ff598d4ea..a513f67af 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -339,7 +339,7 @@ static void LoadAltHudStuff() { Printf("Unknown item class '%s' in ALTHUDCF\n", sc.String); } - else if (!ti->IsDescendantOf(RUNTIME_CLASS(AInventory))) + else if (!ti->IsDescendantOf(NAME_Inventory)) { Printf("Invalid item class '%s' in ALTHUDCF\n", sc.String); ti = NULL; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 287db7cde..1901b946e 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -1831,7 +1831,7 @@ static int CheckInventory (AActor *activator, const char *type, bool max) DPrintf (DMSG_ERROR, "ACS: '%s': Unknown actor class.\n", type); return 0; } - else if (!info->IsDescendantOf(RUNTIME_CLASS(AInventory))) + else if (!info->IsDescendantOf(NAME_Inventory)) { DPrintf(DMSG_ERROR, "ACS: '%s' is not an inventory item.\n", type); return 0; @@ -1845,7 +1845,7 @@ static int CheckInventory (AActor *activator, const char *type, bool max) { return item->MaxAmount; } - else if (info != nullptr && info->IsDescendantOf(RUNTIME_CLASS(AInventory))) + else if (info != nullptr && info->IsDescendantOf(NAME_Inventory)) { return ((AInventory *)GetDefaultByType(info))->MaxAmount; } diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index f11a33591..24b66f013 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -4047,7 +4047,7 @@ static bool DoRadiusGive(AActor *self, AActor *thing, PClassActor *item, int amo return false; doPass = true; } - else if (((flags & RGF_ITEMS) && thing->IsKindOf(RUNTIME_CLASS(AInventory))) || + else if (((flags & RGF_ITEMS) && thing->IsKindOf(NAME_Inventory)) || ((flags & RGF_CORPSES) && thing->flags & MF_CORPSE) || ((flags & RGF_KILLED) && thing->flags6 & MF6_KILLED)) { diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index 69e726dc3..5bc270442 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -373,7 +373,7 @@ static FStrifeDialogueNode *ReadRetailNode (FileReader &lump, uint32_t &prevSpea for (j = 0; j < 3; ++j) { auto inv = GetStrifeType(speech.ItemCheck[j]); - if (!inv->IsDescendantOf(RUNTIME_CLASS(AInventory))) inv = nullptr; + if (!inv->IsDescendantOf(NAME_Inventory)) inv = nullptr; node->ItemCheck[j].Item = inv; node->ItemCheck[j].Amount = -1; } @@ -519,7 +519,7 @@ static void ParseReplies (FStrifeDialogueReply **replyptr, Response *responses) for (k = 0; k < 3; ++k) { auto inv = GetStrifeType(rsp->Item[k]); - if (!inv->IsDescendantOf(RUNTIME_CLASS(AInventory))) inv = nullptr; + if (!inv->IsDescendantOf(NAME_Inventory)) inv = nullptr; reply->ItemCheck[k].Item = inv; reply->ItemCheck[k].Amount = rsp->Count[k]; } @@ -951,7 +951,7 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply takestuff = true; if (reply->GiveType != NULL) { - if (reply->GiveType->IsDescendantOf(RUNTIME_CLASS(AInventory))) + if (reply->GiveType->IsDescendantOf(NAME_Inventory)) { if (reply->GiveType->IsDescendantOf(NAME_Weapon)) { diff --git a/src/p_map.cpp b/src/p_map.cpp index 113a3821b..e8cae5f9d 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -543,7 +543,7 @@ bool P_TeleportMove(AActor* thing, const DVector3 &pos, bool telefrag, bool modi continue; // Don't let players and monsters block item teleports (all other actor types will still block.) - if (thing->IsKindOf(RUNTIME_CLASS(AInventory)) && !(thing->flags & MF_SOLID) && ((th->flags3 & MF3_ISMONSTER) || th->player != nullptr)) + if (thing->IsKindOf(NAME_Inventory) && !(thing->flags & MF_SOLID) && ((th->flags3 & MF3_ISMONSTER) || th->player != nullptr)) continue; // monsters don't stomp things except on boss level diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 40c416bc7..ab89d9f4a 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -625,7 +625,7 @@ DEFINE_ACTION_FUNCTION(AActor, InStateSequence) bool AActor::IsMapActor() { // [SP] Don't remove owned inventory objects. - return (!IsKindOf(RUNTIME_CLASS(AInventory)) || static_cast(this)->Owner == nullptr); + return (!IsKindOf(NAME_Inventory) || static_cast(this)->Owner == nullptr); } //========================================================================== diff --git a/src/p_usdf.cpp b/src/p_usdf.cpp index f24cd5d7b..9520c869c 100644 --- a/src/p_usdf.cpp +++ b/src/p_usdf.cpp @@ -75,7 +75,7 @@ class USDFParser : public UDMFParserBase PClassActor *CheckInventoryActorType(const char *key) { PClassActor* const type = CheckActorType(key); - return nullptr != type && type->IsDescendantOf(RUNTIME_CLASS(AInventory)) ? type : nullptr; + return nullptr != type && type->IsDescendantOf(NAME_Inventory) ? type : nullptr; } //=========================================================================== diff --git a/src/polyrenderer/scene/poly_sprite.cpp b/src/polyrenderer/scene/poly_sprite.cpp index 122f518c6..086d9485f 100644 --- a/src/polyrenderer/scene/poly_sprite.cpp +++ b/src/polyrenderer/scene/poly_sprite.cpp @@ -225,7 +225,7 @@ double RenderPolySprite::PerformSpriteClipAdjustment(AActor *thing, const DVecto if (!(spriteheight > 0 && spriteclip > 0 && spritetype == RF_FACESPRITE)) return z2; - bool clipthing = (thing->player || thing->flags3&MF3_ISMONSTER || thing->IsKindOf(RUNTIME_CLASS(AInventory))) && (thing->flags&MF_ICECORPSE || !(thing->flags&MF_CORPSE)); + bool clipthing = (thing->player || thing->flags3&MF3_ISMONSTER || thing->IsKindOf(NAME_Inventory)) && (thing->flags&MF_ICECORPSE || !(thing->flags&MF_CORPSE)); bool smarterclip = !clipthing && spriteclip == 3; if (clipthing || spriteclip > 1) {