- 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.
This commit is contained in:
Christoph Oelckers 2018-12-02 21:35:04 +01:00
parent 6fd3bea38c
commit bfcd714186
14 changed files with 19 additions and 19 deletions

View file

@ -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

View file

@ -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());

View file

@ -3658,7 +3658,7 @@ void FParser::SF_ThingCount(void)
again:
TThinkerIterator<AActor> 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()))
{

View file

@ -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);

View file

@ -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<AInventory*>(spawned)->SpawnPointClass = self->GetClass();
}

View file

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

View file

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

View file

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

View file

@ -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))
{

View file

@ -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))
{

View file

@ -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

View file

@ -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<AInventory *>(this)->Owner == nullptr);
return (!IsKindOf(NAME_Inventory) || static_cast<AInventory *>(this)->Owner == nullptr);
}
//==========================================================================

View file

@ -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;
}
//===========================================================================

View file

@ -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)
{