Removed more literal references to AInventory.

# Conflicts:
#	src/hwrenderer/scene/hw_drawinfo.cpp
#	src/v_draw.cpp
This commit is contained in:
Christoph Oelckers 2018-12-04 17:00:48 +01:00 committed by drfrag
parent d173ad753f
commit b762c0f49c
28 changed files with 80 additions and 93 deletions

View file

@ -2948,7 +2948,6 @@ void AM_drawKeys ()
// Find the key's own color. // Find the key's own color.
// Only works correctly if single-key locks have lower numbers than any-key locks. // Only works correctly if single-key locks have lower numbers than any-key locks.
// That is the case for all default keys, however. // That is the case for all default keys, however.
int P_GetMapColorForKey (AInventory * key);
int c = P_GetMapColorForKey(key); int c = P_GetMapColorForKey(key);
if (c >= 0) color.FromRGB(RPART(c), GPART(c), BPART(c)); if (c >= 0) color.FromRGB(RPART(c), GPART(c), BPART(c));
@ -3048,8 +3047,7 @@ void AM_drawThings ()
} }
else if (am_showkeys) else if (am_showkeys)
{ {
int P_GetMapColorForKey (AInventory * key); int c = P_GetMapColorForKey(t);
int c = P_GetMapColorForKey(static_cast<AInventory *>(t));
if (c >= 0) color.FromRGB(RPART(c), GPART(c), BPART(c)); if (c >= 0) color.FromRGB(RPART(c), GPART(c), BPART(c));
else color = AMColors[AMColors.ThingColor_CountItem]; else color = AMColors[AMColors.ThingColor_CountItem];

View file

@ -99,7 +99,7 @@ using BotInfoMap = TMap<FName, BotInfoData>;
extern BotInfoMap BotInfo; extern BotInfoMap BotInfo;
inline BotInfoData GetBotInfo(AInventory *weap) inline BotInfoData GetBotInfo(AActor *weap)
{ {
if (weap == nullptr) return BotInfoData(); if (weap == nullptr) return BotInfoData();
auto k = BotInfo.CheckKey(weap->GetClass()->TypeName); auto k = BotInfo.CheckKey(weap->GetClass()->TypeName);
@ -145,7 +145,7 @@ public:
botinfo_t *botinfo; botinfo_t *botinfo;
int spawn_tries; int spawn_tries;
int wanted_botnum; int wanted_botnum;
TObjPtr<AInventory*> firstthing; TObjPtr<AActor*> firstthing;
TObjPtr<AActor*> body1; TObjPtr<AActor*> body1;
TObjPtr<AActor*> body2; TObjPtr<AActor*> body2;

View file

@ -2258,11 +2258,11 @@ void Net_DoCommand (int type, uint8_t **stream, int player)
case DEM_INVUSEALL: case DEM_INVUSEALL:
if (gamestate == GS_LEVEL && !paused) if (gamestate == GS_LEVEL && !paused)
{ {
auto item = players[player].mo->Inventory; AActor *item = players[player].mo->Inventory;
auto pitype = PClass::FindActor(NAME_PuzzleItem); auto pitype = PClass::FindActor(NAME_PuzzleItem);
while (item != NULL) while (item != nullptr)
{ {
auto next = item->Inventory; AActor *next = item->Inventory;
IFVIRTUALPTR(item, AInventory, UseAll) IFVIRTUALPTR(item, AInventory, UseAll)
{ {
VMValue param[] = { item, players[player].mo }; VMValue param[] = { item, players[player].mo };

View file

@ -94,8 +94,7 @@ public:
bool ResetAirSupply (bool playgasp = true); bool ResetAirSupply (bool playgasp = true);
int GetMaxHealth(bool withupgrades = false) const; int GetMaxHealth(bool withupgrades = false) const;
AInventory *PickNewWeapon (PClassActor *ammotype); AActor *PickNewWeapon (PClassActor *ammotype);
AInventory *BestWeapon (PClassActor *ammotype);
void GiveDeathmatchInventory (); void GiveDeathmatchInventory ();
void GiveDefaultInventory (); void GiveDefaultInventory ();
@ -124,8 +123,8 @@ public:
int RunHealth; int RunHealth;
int PlayerFlags; int PlayerFlags;
double FullHeight; double FullHeight;
TObjPtr<AInventory*> InvFirst; // first inventory item displayed on inventory bar TObjPtr<AActor*> InvFirst; // first inventory item displayed on inventory bar
TObjPtr<AInventory*> InvSel; // selected inventory item TObjPtr<AActor*> InvSel; // selected inventory item
// [GRB] Player class properties // [GRB] Player class properties
double JumpZ; double JumpZ;

View file

@ -377,8 +377,6 @@ T* Create(Args&&... args)
} }
class AInventory;//
// When you write to a pointer to an Object, you must call this for // When you write to a pointer to an Object, you must call this for
// proper bookkeeping in case the Object holding this pointer has // proper bookkeeping in case the Object holding this pointer has
// already been processed by the GC. // already been processed by the GC.

View file

@ -239,7 +239,7 @@ FString savename;
FString BackupSaveName; FString BackupSaveName;
bool SendLand; bool SendLand;
const AInventory *SendItemUse, *SendItemDrop; const AActor *SendItemUse, *SendItemDrop;
int SendItemDropAmount; int SendItemDropAmount;
EXTERN_CVAR (Int, team) EXTERN_CVAR (Int, team)
@ -437,7 +437,7 @@ CCMD(invprev)
CCMD (invuseall) CCMD (invuseall)
{ {
SendItemUse = (const AInventory *)1; SendItemUse = (const AActor *)1;
} }
CCMD (invuse) CCMD (invuse)
@ -451,7 +451,7 @@ CCMD (invuse)
CCMD(invquery) CCMD(invquery)
{ {
AInventory *inv = players[consoleplayer].mo->InvSel; AActor *inv = players[consoleplayer].mo->InvSel;
if (inv != NULL) if (inv != NULL)
{ {
Printf(PRINT_HIGH, "%s (%dx)\n", inv->GetTag(), inv->IntVar(NAME_Amount)); Printf(PRINT_HIGH, "%s (%dx)\n", inv->GetTag(), inv->IntVar(NAME_Amount));
@ -758,7 +758,7 @@ void G_BuildTiccmd (ticcmd_t *cmd)
Net_WriteString (savedescription); Net_WriteString (savedescription);
savegamefile = ""; savegamefile = "";
} }
if (SendItemUse == (const AInventory *)1) if (SendItemUse == (const AActor *)1)
{ {
Net_WriteByte (DEM_INVUSEALL); Net_WriteByte (DEM_INVUSEALL);
SendItemUse = NULL; SendItemUse = NULL;
@ -2921,4 +2921,4 @@ DEFINE_GLOBAL(gametic)
DEFINE_GLOBAL(demoplayback) DEFINE_GLOBAL(demoplayback)
DEFINE_GLOBAL(automapactive); DEFINE_GLOBAL(automapactive);
DEFINE_GLOBAL(Net_Arbitrator); DEFINE_GLOBAL(Net_Arbitrator);
DEFINE_GLOBAL(netgame); DEFINE_GLOBAL(netgame);

View file

@ -32,6 +32,9 @@ struct event_t;
#include "dobjgc.h" #include "dobjgc.h"
class AActor;
// //
// GAME // GAME
// //
@ -96,7 +99,7 @@ void G_AddViewPitch (int look, bool mouse = false);
void G_AddViewAngle (int yaw, bool mouse = false); void G_AddViewAngle (int yaw, bool mouse = false);
class AInventory; class AInventory;
extern const AInventory *SendItemUse, *SendItemDrop; extern const AActor *SendItemUse, *SendItemDrop;
extern int SendItemDropAmount; extern int SendItemDropAmount;

View file

@ -67,9 +67,7 @@ struct OneKey
if (owner->IsA(key) || owner->GetSpecies() == key->TypeName) return true; if (owner->IsA(key) || owner->GetSpecies() == key->TypeName) return true;
// Other calls check an actor that may have a key in its inventory. // Other calls check an actor that may have a key in its inventory.
AInventory *item; for (AActor *item = owner->Inventory; item != NULL; item = item->Inventory)
for (item = owner->Inventory; item != NULL; item = item->Inventory)
{ {
if (item->IsA(key)) if (item->IsA(key))
{ {
@ -133,7 +131,7 @@ struct Lock
if (!keylist.Size()) if (!keylist.Size())
{ {
auto kt = PClass::FindActor(NAME_Key); auto kt = PClass::FindActor(NAME_Key);
for (AInventory * item = owner->Inventory; item != NULL; item = item->Inventory) for (AActor *item = owner->Inventory; item != NULL; item = item->Inventory)
{ {
if (item->IsKindOf (kt)) if (item->IsKindOf (kt))
{ {
@ -434,9 +432,9 @@ static void CreateSortedKeyList()
if (ti->IsDescendantOf(kt)) if (ti->IsDescendantOf(kt))
{ {
AInventory *key = (AInventory*)(GetDefaultByType(ti)); auto key = GetDefaultByType(ti);
if (key->Icon.isValid() && key->special1 > 0) if (key->special1 > 0)
{ {
KeyTypes.Push(ti); KeyTypes.Push(ti);
} }
@ -591,7 +589,7 @@ int P_GetMapColorForLock (int lock)
// //
//========================================================================== //==========================================================================
int P_GetMapColorForKey (AInventory * key) int P_GetMapColorForKey (AActor * key)
{ {
int i; int i;

View file

@ -2,14 +2,13 @@
#define A_KEYS_H #define A_KEYS_H
class AActor; class AActor;
class AInventory;
class PClassActor; class PClassActor;
int P_CheckKeys (AActor *owner, int keynum, bool remote, bool quiet = false); int P_CheckKeys (AActor *owner, int keynum, bool remote, bool quiet = false);
void P_InitKeyMessages (); void P_InitKeyMessages ();
void P_DeinitKeyMessages (); void P_DeinitKeyMessages ();
int P_GetMapColorForLock (int lock); int P_GetMapColorForLock (int lock);
int P_GetMapColorForKey (AInventory *key); int P_GetMapColorForKey (AActor *key);
int P_GetKeyTypeCount(); int P_GetKeyTypeCount();
PClassActor *P_GetKeyType(int num); PClassActor *P_GetKeyType(int num);

View file

@ -139,9 +139,9 @@ DEFINE_ACTION_FUNCTION(AInventory, PrintPickupMessage)
// //
//=========================================================================== //===========================================================================
void DepleteOrDestroy (AInventory *item) void DepleteOrDestroy (AActor *item)
{ {
IFVIRTUALPTR(item, AInventory, DepleteOrDestroy) IFVIRTUALPTRNAME(item, NAME_Inventory, DepleteOrDestroy)
{ {
VMValue params[1] = { item }; VMValue params[1] = { item };
VMCall(func, params, 1, nullptr, 0); VMCall(func, params, 1, nullptr, 0);
@ -154,7 +154,7 @@ void DepleteOrDestroy (AInventory *item)
// //
//=========================================================================== //===========================================================================
bool CallTryPickup(AInventory *item, AActor *toucher, AActor **toucher_return) bool CallTryPickup(AActor *item, AActor *toucher, AActor **toucher_return)
{ {
static VMFunction *func = nullptr; static VMFunction *func = nullptr;
if (func == nullptr) PClass::FindFunction(&func, NAME_Inventory, NAME_CallTryPickup); if (func == nullptr) PClass::FindFunction(&func, NAME_Inventory, NAME_CallTryPickup);

View file

@ -89,7 +89,7 @@ public:
FSoundIDNoInit PickupSound; FSoundIDNoInit PickupSound;
}; };
bool CallTryPickup(AInventory *item, AActor *toucher, AActor **toucher_return = nullptr); bool CallTryPickup(AActor *item, AActor *toucher, AActor **toucher_return = nullptr);
void DepleteOrDestroy(AInventory *item); // virtual on the script side. void DepleteOrDestroy(AActor *item); // virtual on the script side.
#endif //__A_PICKUPS_H__ #endif //__A_PICKUPS_H__

View file

@ -358,7 +358,7 @@ void FWeaponSlots::AddExtraWeapons()
{ {
continue; continue;
} }
auto weapdef = ((AInventory*)GetDefaultByType(cls)); auto weapdef = GetDefaultByType(cls);
// Let the weapon decide for itself if it wants to get added to a slot. // Let the weapon decide for itself if it wants to get added to a slot.
IFVIRTUALPTRNAME(weapdef, NAME_Weapon, CheckAddToSlots) IFVIRTUALPTRNAME(weapdef, NAME_Weapon, CheckAddToSlots)

View file

@ -1271,7 +1271,7 @@ void G_StartTravel ()
if (playeringame[i]) if (playeringame[i])
{ {
AActor *pawn = players[i].mo; AActor *pawn = players[i].mo;
AInventory *inv; AActor *inv;
players[i].camera = NULL; players[i].camera = NULL;
// Only living players travel. Dead ones get a new body on the new level. // Only living players travel. Dead ones get a new body on the new level.
@ -1310,7 +1310,7 @@ int G_FinishTravel ()
{ {
TThinkerIterator<APlayerPawn> it (STAT_TRAVELLING); TThinkerIterator<APlayerPawn> it (STAT_TRAVELLING);
APlayerPawn *pawn, *pawndup, *oldpawn, *next; APlayerPawn *pawn, *pawndup, *oldpawn, *next;
AInventory *inv; AActor *inv;
FPlayerStart *start; FPlayerStart *start;
int pnum; int pnum;
int failnum = 0; int failnum = 0;
@ -1398,7 +1398,7 @@ int G_FinishTravel ()
inv->ChangeStatNum (STAT_INVENTORY); inv->ChangeStatNum (STAT_INVENTORY);
inv->LinkToWorld (nullptr); inv->LinkToWorld (nullptr);
IFVIRTUALPTR(inv, AInventory, Travelled) IFVIRTUALPTRNAME(inv, NAME_Inventory, Travelled)
{ {
VMValue params[1] = { inv }; VMValue params[1] = { inv };
VMCall(func, params, 1, nullptr, 0); VMCall(func, params, 1, nullptr, 0);

View file

@ -461,7 +461,7 @@ private:
public: public:
AInventory *ValidateInvFirst (int numVisible) const; AActor *ValidateInvFirst (int numVisible) const;
void DrawCrosshair (); void DrawCrosshair ();
// Sizing info for ths status bar. // Sizing info for ths status bar.
@ -523,8 +523,7 @@ void ST_Clear();
void ST_CreateStatusBar(bool bTitleLevel); void ST_CreateStatusBar(bool bTitleLevel);
extern FTexture *CrosshairImage; extern FTexture *CrosshairImage;
//FTextureID GetInventoryIcon(AInventory *item, uint32_t flags, int *applyscale = nullptr); int GetInventoryIcon(AActor *item, uint32_t flags, int *applyscale = nullptr);
int GetInventoryIcon(AInventory *item, uint32_t flags, int *applyscale = nullptr);
enum DI_Flags enum DI_Flags

View file

@ -619,7 +619,7 @@ class CommandDrawSwitchableImage : public CommandDrawImage
} }
else //check the inventory items and draw selected sprite else //check the inventory items and draw selected sprite
{ {
AInventory* item = statusBar->CPlayer->mo->FindInventory(inventoryItem[0]); auto item = statusBar->CPlayer->mo->FindInventory(inventoryItem[0]);
if(item == NULL || !EvaluateOperation(conditionalOperator[0], conditionalValue[0], item->IntVar(NAME_Amount))) if(item == NULL || !EvaluateOperation(conditionalOperator[0], conditionalValue[0], item->IntVar(NAME_Amount)))
drawAlt = 1; drawAlt = 1;
if(conditionAnd) if(conditionAnd)
@ -1351,7 +1351,7 @@ class CommandDrawNumber : public CommandDrawString
break; break;
case AMMO: case AMMO:
{ {
AInventory* item = statusBar->CPlayer->mo->FindInventory(inventoryItem); auto item = statusBar->CPlayer->mo->FindInventory(inventoryItem);
if(item != NULL) if(item != NULL)
num = item->IntVar(NAME_Amount); num = item->IntVar(NAME_Amount);
else else
@ -1378,11 +1378,11 @@ class CommandDrawNumber : public CommandDrawString
break; break;
case AMMOCAPACITY: case AMMOCAPACITY:
{ {
AInventory* item = statusBar->CPlayer->mo->FindInventory(inventoryItem); auto item = statusBar->CPlayer->mo->FindInventory(inventoryItem);
if(item != NULL) if(item != NULL)
num = item->IntVar(NAME_MaxAmount); num = item->IntVar(NAME_MaxAmount);
else else
num = ((AInventory *)GetDefaultByType(inventoryItem))->IntVar(NAME_MaxAmount); num = GetDefaultByType(inventoryItem)->IntVar(NAME_MaxAmount);
break; break;
} }
case FRAGS: case FRAGS:
@ -1449,7 +1449,7 @@ class CommandDrawNumber : public CommandDrawString
} }
case INVENTORY: case INVENTORY:
{ {
AInventory* item = statusBar->CPlayer->mo->FindInventory(inventoryItem); auto item = statusBar->CPlayer->mo->FindInventory(inventoryItem);
if(item != NULL) if(item != NULL)
num = item->IntVar(NAME_Amount); num = item->IntVar(NAME_Amount);
else else
@ -2085,9 +2085,9 @@ class CommandDrawInventoryBar : public SBarInfoCommand
} }
} }
AInventory *PrevInv(AInventory *item) AActor *PrevInv(AActor *item)
{ {
AInventory *retval = nullptr; AActor *retval = nullptr;
IFVM(Inventory, PrevInv) IFVM(Inventory, PrevInv)
{ {
VMValue param = item; VMValue param = item;
@ -2097,9 +2097,9 @@ class CommandDrawInventoryBar : public SBarInfoCommand
return retval; return retval;
} }
AInventory *NextInv(AInventory *item) AActor *NextInv(AActor *item)
{ {
AInventory *retval = nullptr; AActor *retval = nullptr;
IFVM(Inventory, NextInv) IFVM(Inventory, NextInv)
{ {
VMValue param = item; VMValue param = item;
@ -2117,7 +2117,7 @@ class CommandDrawInventoryBar : public SBarInfoCommand
if(translucent) if(translucent)
bgalpha *= HX_SHADOW; bgalpha *= HX_SHADOW;
AInventory *item; AActor *item;
unsigned int i = 0; unsigned int i = 0;
// If the player has no artifacts, don't draw the bar // If the player has no artifacts, don't draw the bar
statusBar->CPlayer->mo->InvFirst = statusBar->wrapper->ValidateInvFirst(size); statusBar->CPlayer->mo->InvFirst = statusBar->wrapper->ValidateInvFirst(size);
@ -3074,7 +3074,7 @@ class CommandHasWeaponPiece : public SBarInfoCommandFlowControl
{ {
SBarInfoCommandFlowControl::Tick(block, statusBar, hudChanged); SBarInfoCommandFlowControl::Tick(block, statusBar, hudChanged);
for(AInventory *inv = statusBar->CPlayer->mo->Inventory;inv != NULL;inv=inv->Inventory) for(auto inv = statusBar->CPlayer->mo->Inventory;inv != NULL;inv=inv->Inventory)
{ {
auto hc = PClass::FindActor("WeaponHolder"); auto hc = PClass::FindActor("WeaponHolder");
if(inv->IsKindOf(hc)) if(inv->IsKindOf(hc))
@ -3360,7 +3360,7 @@ class CommandInInventory : public SBarInfoNegatableFlowControl
{ {
SBarInfoNegatableFlowControl::Tick(block, statusBar, hudChanged); SBarInfoNegatableFlowControl::Tick(block, statusBar, hudChanged);
AInventory *invItem[2] = { statusBar->CPlayer->mo->FindInventory(item[0]), statusBar->CPlayer->mo->FindInventory(item[1]) }; AActor *invItem[2] = { statusBar->CPlayer->mo->FindInventory(item[0]), statusBar->CPlayer->mo->FindInventory(item[1]) };
if (invItem[0] != NULL && Amount[0] > 0 && invItem[0]->IntVar(NAME_Amount) < Amount[0]) invItem[0] = NULL; if (invItem[0] != NULL && Amount[0] > 0 && invItem[0]->IntVar(NAME_Amount) < Amount[0]) invItem[0] = NULL;
if (invItem[1] != NULL && Amount[1] > 0 && invItem[1]->IntVar(NAME_Amount) < Amount[1]) invItem[1] = NULL; if (invItem[1] != NULL && Amount[1] > 0 && invItem[1]->IntVar(NAME_Amount) < Amount[1]) invItem[1] = NULL;

View file

@ -1307,12 +1307,12 @@ void DBaseStatusBar::CallScreenSizeChanged()
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
AInventory *DBaseStatusBar::ValidateInvFirst (int numVisible) const AActor *DBaseStatusBar::ValidateInvFirst (int numVisible) const
{ {
IFVM(BaseStatusBar, ValidateInvFirst) IFVM(BaseStatusBar, ValidateInvFirst)
{ {
VMValue params[] = { (AInventory*)this, numVisible }; VMValue params[] = { const_cast<DBaseStatusBar*>(this), numVisible };
AInventory *item; AActor *item;
VMReturn ret((void**)&item); VMReturn ret((void**)&item);
VMCall(func, params, 2, &ret, 1); VMCall(func, params, 2, &ret, 1);
return item; return item;
@ -1798,8 +1798,7 @@ void FormatNumber(int number, int minsize, int maxsize, int flags, const FString
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
//FTextureID GetInventoryIcon(AInventory *item, uint32_t flags, int *applyscale) int GetInventoryIcon(AActor *item, uint32_t flags, int *applyscale)
int GetInventoryIcon(AInventory *item, uint32_t flags, int *applyscale)
{ {
if (applyscale != NULL) if (applyscale != NULL)
{ {

View file

@ -775,11 +775,11 @@ void GLSceneDrawer::SetFixedColormap (player_t *player)
{ {
auto torchtype = PClass::FindActor(NAME_PowerTorch); auto torchtype = PClass::FindActor(NAME_PowerTorch);
auto litetype = PClass::FindActor(NAME_PowerLightAmp); auto litetype = PClass::FindActor(NAME_PowerLightAmp);
for(AInventory * in = cplayer->mo->Inventory; in; in = in->Inventory) for(AActor *in = cplayer->mo->Inventory; in; in = in->Inventory)
{ {
PalEntry color = 0; PalEntry color = 0;
IFVIRTUALPTR(in, AInventory, GetBlend) IFVIRTUALPTRNAME(in, NAME_Inventory, GetBlend)
{ {
VMValue params[1] = { in }; VMValue params[1] = { in };
VMReturn ret((int*)&color.d); VMReturn ret((int*)&color.d);

View file

@ -1017,6 +1017,7 @@ xx(YAdjust)
xx(Crosshair) xx(Crosshair)
xx(WeaponFlags) xx(WeaponFlags)
xx(DropTime) xx(DropTime)
xx(PickupSound)
xx(BlueCard) xx(BlueCard)
xx(YellowCard) xx(YellowCard)

View file

@ -9344,7 +9344,7 @@ scriptwait:
case PCD_GETSIGILPIECES: case PCD_GETSIGILPIECES:
{ {
AInventory *sigil; AActor *sigil;
if (activator == NULL || (sigil = activator->FindInventory(NAME_Sigil)) == NULL) if (activator == NULL || (sigil = activator->FindInventory(NAME_Sigil)) == NULL)
{ {
@ -9361,11 +9361,10 @@ scriptwait:
if (activator != NULL) if (activator != NULL)
{ {
PClass *type = PClass::FindClass (FBehavior::StaticLookupString (STACK(1))); PClass *type = PClass::FindClass (FBehavior::StaticLookupString (STACK(1)));
AInventory *item;
if (type != NULL && type->ParentClass == PClass::FindActor(NAME_Ammo)) if (type != NULL && type->ParentClass == PClass::FindActor(NAME_Ammo))
{ {
item = activator->FindInventory (static_cast<PClassActor *>(type)); auto item = activator->FindInventory (static_cast<PClassActor *>(type));
if (item != NULL) if (item != NULL)
{ {
STACK(1) = item->IntVar(NAME_MaxAmount); STACK(1) = item->IntVar(NAME_MaxAmount);
@ -9390,11 +9389,10 @@ scriptwait:
if (activator != NULL) if (activator != NULL)
{ {
PClassActor *type = PClass::FindActor (FBehavior::StaticLookupString (STACK(2))); PClassActor *type = PClass::FindActor (FBehavior::StaticLookupString (STACK(2)));
AInventory *item;
if (type != NULL && type->ParentClass == PClass::FindActor(NAME_Ammo)) if (type != NULL && type->ParentClass == PClass::FindActor(NAME_Ammo))
{ {
item = activator->FindInventory (type); auto item = activator->FindInventory (type);
if (item != NULL) if (item != NULL)
{ {
item->IntVar(NAME_MaxAmount) = STACK(1); item->IntVar(NAME_MaxAmount) = STACK(1);

View file

@ -1556,7 +1556,7 @@ enum SW_Flags
DEFINE_ACTION_FUNCTION(AActor, A_SelectWeapon) DEFINE_ACTION_FUNCTION(AActor, A_SelectWeapon)
{ {
PARAM_SELF_PROLOGUE(AActor); PARAM_SELF_PROLOGUE(AActor);
PARAM_CLASS(cls, AInventory); PARAM_CLASS(cls, AActor);
PARAM_INT(flags); PARAM_INT(flags);
bool selectPriority = !!(flags & SWF_SELECTPRIORITY); bool selectPriority = !!(flags & SWF_SELECTPRIORITY);
@ -2124,7 +2124,7 @@ DEFINE_ACTION_FUNCTION(AActor, CheckRange)
DEFINE_ACTION_FUNCTION(AActor, A_DropInventory) DEFINE_ACTION_FUNCTION(AActor, A_DropInventory)
{ {
PARAM_SELF_PROLOGUE(AActor); PARAM_SELF_PROLOGUE(AActor);
PARAM_CLASS(drop, AInventory); PARAM_CLASS(drop, AActor);
PARAM_INT(amount); PARAM_INT(amount);
if (drop) if (drop)

View file

@ -610,12 +610,10 @@ static int FindNode (const FStrifeDialogueNode *node)
static bool CheckStrifeItem (player_t *player, PClassActor *itemtype, int amount=-1) static bool CheckStrifeItem (player_t *player, PClassActor *itemtype, int amount=-1)
{ {
AInventory *item;
if (itemtype == NULL || amount == 0) if (itemtype == NULL || amount == 0)
return true; return true;
item = player->ConversationPC->FindInventory (itemtype); auto item = player->ConversationPC->FindInventory (itemtype);
if (item == NULL) if (item == NULL)
return false; return false;

View file

@ -6,7 +6,6 @@
struct sector_t; struct sector_t;
class AActor; class AActor;
class AInventory;
class PClass; class PClass;

View file

@ -329,9 +329,9 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags, FName MeansOf
//flags &= ~MF_INVINCIBLE; //flags &= ~MF_INVINCIBLE;
// [RH] Notify this actor's items. // [RH] Notify this actor's items.
for (auto item = Inventory; item != NULL; ) for (AActor *item = Inventory; item != NULL; )
{ {
AInventory *next = item->Inventory; AActor *next = item->Inventory;
IFVIRTUALPTR(item, AInventory, OwnerDied) IFVIRTUALPTR(item, AInventory, OwnerDied)
{ {
VMValue params[1] = { item }; VMValue params[1] = { item };

View file

@ -3464,9 +3464,9 @@ bool AActor::AdjustReflectionAngle (AActor *thing, DAngle &angle)
int AActor::AbsorbDamage(int damage, FName dmgtype) int AActor::AbsorbDamage(int damage, FName dmgtype)
{ {
for (auto item = Inventory; item != nullptr; item = item->Inventory) for (AActor *item = Inventory; item != nullptr; item = item->Inventory)
{ {
IFVIRTUALPTR(item, AInventory, AbsorbDamage) IFVIRTUALPTRNAME(item, NAME_Inventory, AbsorbDamage)
{ {
VMValue params[4] = { item, damage, dmgtype.GetIndex(), &damage }; VMValue params[4] = { item, damage, dmgtype.GetIndex(), &damage };
VMCall(func, params, 4, nullptr, 0); VMCall(func, params, 4, nullptr, 0);
@ -3478,15 +3478,15 @@ int AActor::AbsorbDamage(int damage, FName dmgtype)
void AActor::AlterWeaponSprite(visstyle_t *vis) void AActor::AlterWeaponSprite(visstyle_t *vis)
{ {
int changed = 0; int changed = 0;
TArray<AInventory *> items; TArray<AActor *> items;
// This needs to go backwards through the items but the list has no backlinks. // This needs to go backwards through the items but the list has no backlinks.
for (auto item = Inventory; item != nullptr; item = item->Inventory) for (AActor *item = Inventory; item != nullptr; item = item->Inventory)
{ {
items.Push(item); items.Push(item);
} }
for(int i=items.Size()-1;i>=0;i--) for(int i=items.Size()-1;i>=0;i--)
{ {
IFVIRTUALPTR(items[i], AInventory, AlterWeaponSprite) IFVIRTUALPTRNAME(items[i], NAME_Inventory, AlterWeaponSprite)
{ {
VMValue params[3] = { items[i], vis, &changed }; VMValue params[3] = { items[i], vis, &changed };
VMCall(func, params, 3, nullptr, 0); VMCall(func, params, 3, nullptr, 0);
@ -3799,11 +3799,11 @@ void AActor::Tick ()
{ {
// Handle powerup effects here so that the order is controlled // Handle powerup effects here so that the order is controlled
// by the order in the inventory, not the order in the thinker table // by the order in the inventory, not the order in the thinker table
auto item = Inventory; AActor *item = Inventory;
while (item != NULL) while (item != NULL)
{ {
IFVIRTUALPTR(item, AInventory, DoEffect) IFVIRTUALPTRNAME(item, NAME_Inventory, DoEffect)
{ {
VMValue params[1] = { item }; VMValue params[1] = { item };
VMCall(func, params, 1, nullptr, 0); VMCall(func, params, 1, nullptr, 0);
@ -8143,7 +8143,7 @@ void PrintMiscActorInfo(AActor *query)
/*for (flagi = 0; flagi < 31; flagi++) /*for (flagi = 0; flagi < 31; flagi++)
if (query->BounceFlags & 1<<flagi) Printf(" %s", flagnamesb[flagi]);*/ if (query->BounceFlags & 1<<flagi) Printf(" %s", flagnamesb[flagi]);*/
Printf("\nRender style = %i:%s, alpha %f\nRender flags: %x", Printf("\nRender style = %i:%s, alpha %f\nRender flags: %x",
querystyle, (querystyle < countof(renderstyles) ? renderstyles[querystyle] : "Custom"), querystyle, ((unsigned)querystyle < countof(renderstyles) ? renderstyles[querystyle] : "Custom"),
query->Alpha, query->renderflags.GetValue()); query->Alpha, query->renderflags.GetValue());
/*for (flagi = 0; flagi < 31; flagi++) /*for (flagi = 0; flagi < 31; flagi++)
if (query->renderflags & 1<<flagi) Printf(" %s", flagnamesr[flagi]);*/ if (query->renderflags & 1<<flagi) Printf(" %s", flagnamesr[flagi]);*/

View file

@ -39,7 +39,6 @@
#define WEAPONTOP 32. #define WEAPONTOP 32.
#define WEAPON_FUDGE_Y 0.375 #define WEAPON_FUDGE_Y 0.375
class AInventory;
struct FTranslatedLineTarget; struct FTranslatedLineTarget;
// //

View file

@ -935,9 +935,9 @@ void APlayerPawn::PostBeginPlay()
// //
//=========================================================================== //===========================================================================
AInventory *APlayerPawn::PickNewWeapon(PClassActor *ammotype) AActor *APlayerPawn::PickNewWeapon(PClassActor *ammotype)
{ {
AInventory *best = nullptr; AActor *best = nullptr;
IFVM(PlayerPawn, PickNewWeapon) IFVM(PlayerPawn, PickNewWeapon)
{ {
VMValue param[] = { player->mo, ammotype }; VMValue param[] = { player->mo, ammotype };
@ -963,10 +963,10 @@ void APlayerPawn::GiveDeathmatchInventory()
{ {
if (PClassActor::AllActorClasses[i]->IsDescendantOf (PClass::FindActor(NAME_Key))) if (PClassActor::AllActorClasses[i]->IsDescendantOf (PClass::FindActor(NAME_Key)))
{ {
AInventory *key = (AInventory*)GetDefaultByType (PClassActor::AllActorClasses[i]); auto key = GetDefaultByType (PClassActor::AllActorClasses[i]);
if (key->special1 != 0) if (key->special1 != 0)
{ {
key = (AInventory*)Spawn(PClassActor::AllActorClasses[i]); key = Spawn(PClassActor::AllActorClasses[i]);
if (!CallTryPickup (key, this)) if (!CallTryPickup (key, this))
{ {
key->Destroy (); key->Destroy ();
@ -1968,7 +1968,7 @@ void P_UnPredictPlayer ()
APlayerPawn *act = player->mo; APlayerPawn *act = player->mo;
AActor *savedcamera = player->camera; AActor *savedcamera = player->camera;
TObjPtr<AInventory*> InvSel = act->InvSel; TObjPtr<AActor*> InvSel = act->InvSel;
int inventorytics = player->inventorytics; int inventorytics = player->inventorytics;
*player = PredictionPlayerBackup; *player = PredictionPlayerBackup;

View file

@ -320,7 +320,6 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def, PNamespace *ns)
static void ParseInsideDecoration (Baggage &bag, AActor *defaults, static void ParseInsideDecoration (Baggage &bag, AActor *defaults,
FExtraInfo &extra, EDefinitionType def, FScanner &sc, TArray<FState> &StateArray, TArray<FScriptPosition> &SourceLines) FExtraInfo &extra, EDefinitionType def, FScanner &sc, TArray<FState> &StateArray, TArray<FScriptPosition> &SourceLines)
{ {
AInventory *const inv = static_cast<AInventory *>(defaults);
char sprite[5] = "TNT1"; char sprite[5] = "TNT1";
sc.MustGetString (); sc.MustGetString ();
@ -539,16 +538,16 @@ static void ParseInsideDecoration (Baggage &bag, AActor *defaults,
else if (def == DEF_Pickup && sc.Compare ("PickupSound")) else if (def == DEF_Pickup && sc.Compare ("PickupSound"))
{ {
sc.MustGetString (); sc.MustGetString ();
inv->PickupSound = sc.String; defaults->IntVar(NAME_PickupSound) = FSoundID(sc.String);
} }
else if (def == DEF_Pickup && sc.Compare ("PickupMessage")) else if (def == DEF_Pickup && sc.Compare ("PickupMessage"))
{ {
sc.MustGetString (); sc.MustGetString ();
inv->StringVar(NAME_PickupMsg) = sc.String; defaults->StringVar(NAME_PickupMsg) = sc.String;
} }
else if (def == DEF_Pickup && sc.Compare ("Respawns")) else if (def == DEF_Pickup && sc.Compare ("Respawns"))
{ {
inv->BoolVar(NAME_Respawnable) = true; defaults->BoolVar(NAME_Respawnable) = true;
} }
else if (def == DEF_BreakableDecoration && sc.Compare ("SolidOnDeath")) else if (def == DEF_BreakableDecoration && sc.Compare ("SolidOnDeath"))
{ {

View file

@ -104,11 +104,11 @@ void V_AddPlayerBlend (player_t *CPlayer, float blend[4], float maxinvalpha, int
int cnt; int cnt;
// [RH] All powerups can affect the screen blending now // [RH] All powerups can affect the screen blending now
for (auto item = CPlayer->mo->Inventory; item != NULL; item = item->Inventory) for (AActor *item = CPlayer->mo->Inventory; item != NULL; item = item->Inventory)
{ {
PalEntry color = 0; PalEntry color = 0;
IFVIRTUALPTR(item, AInventory, GetBlend) IFVIRTUALPTRNAME(item, NAME_Inventory, GetBlend)
{ {
VMValue params[1] = { item }; VMValue params[1] = { item };
VMReturn ret((int*)&color.d); VMReturn ret((int*)&color.d);