- GetInventoryIcon must return an integer for it to work for VM native calls

This commit is contained in:
Magnus Norddahl 2018-12-03 21:56:06 +01:00
parent 7df8245102
commit 3ac2e74f1c
3 changed files with 7 additions and 5 deletions

View file

@ -522,7 +522,8 @@ 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); //FTextureID GetInventoryIcon(AInventory *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

@ -307,7 +307,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
void GetIcon(AInventory *item) void GetIcon(AInventory *item)
{ {
int apply; int apply;
FTextureID icon = GetInventoryIcon(item, flags, &apply); FTextureID icon = FSetTextureID(GetInventoryIcon(item, flags, &apply));
applyscale = !!apply; applyscale = !!apply;
if (applyscale) if (applyscale)

View file

@ -1757,14 +1757,15 @@ void FormatNumber(int number, int minsize, int maxsize, int flags, const FString
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
FTextureID GetInventoryIcon(AInventory *item, uint32_t flags, int *applyscale) //FTextureID GetInventoryIcon(AInventory *item, uint32_t flags, int *applyscale)
int GetInventoryIcon(AInventory *item, uint32_t flags, int *applyscale)
{ {
if (applyscale != NULL) if (applyscale != NULL)
{ {
*applyscale = false; *applyscale = false;
} }
if (item == nullptr) return FNullTextureID(); if (item == nullptr) return FNullTextureID().GetIndex();
FTextureID picnum, Icon = item->Icon, AltIcon = item->AltHUDIcon; FTextureID picnum, Icon = item->Icon, AltIcon = item->AltHUDIcon;
FState * state = NULL, *ReadyState; FState * state = NULL, *ReadyState;
@ -1809,6 +1810,6 @@ FTextureID GetInventoryIcon(AInventory *item, uint32_t flags, int *applyscale)
picnum = sprframe->Texture[0]; picnum = sprframe->Texture[0];
} }
} }
return picnum; return picnum.GetIndex();
} }