From 3ac2e74f1cff150b9178e975ae53acf08c076828 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Mon, 3 Dec 2018 21:56:06 +0100 Subject: [PATCH] - GetInventoryIcon must return an integer for it to work for VM native calls --- src/g_statusbar/sbar.h | 3 ++- src/g_statusbar/sbarinfo_commands.cpp | 2 +- src/g_statusbar/shared_sbar.cpp | 7 ++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/g_statusbar/sbar.h b/src/g_statusbar/sbar.h index ca3b683ab..a7a1e0960 100644 --- a/src/g_statusbar/sbar.h +++ b/src/g_statusbar/sbar.h @@ -522,7 +522,8 @@ void ST_Clear(); void ST_CreateStatusBar(bool bTitleLevel); 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 diff --git a/src/g_statusbar/sbarinfo_commands.cpp b/src/g_statusbar/sbarinfo_commands.cpp index 99ba7b41d..e07c04f2e 100644 --- a/src/g_statusbar/sbarinfo_commands.cpp +++ b/src/g_statusbar/sbarinfo_commands.cpp @@ -307,7 +307,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl void GetIcon(AInventory *item) { int apply; - FTextureID icon = GetInventoryIcon(item, flags, &apply); + FTextureID icon = FSetTextureID(GetInventoryIcon(item, flags, &apply)); applyscale = !!apply; if (applyscale) diff --git a/src/g_statusbar/shared_sbar.cpp b/src/g_statusbar/shared_sbar.cpp index bb1709594..b1bd87b43 100644 --- a/src/g_statusbar/shared_sbar.cpp +++ b/src/g_statusbar/shared_sbar.cpp @@ -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) { *applyscale = false; } - if (item == nullptr) return FNullTextureID(); + if (item == nullptr) return FNullTextureID().GetIndex(); FTextureID picnum, Icon = item->Icon, AltIcon = item->AltHUDIcon; FState * state = NULL, *ReadyState; @@ -1809,6 +1810,6 @@ FTextureID GetInventoryIcon(AInventory *item, uint32_t flags, int *applyscale) picnum = sprframe->Texture[0]; } } - return picnum; + return picnum.GetIndex(); }