From c305ff43f36ff0e95f03074bdbbaef148f3aba50 Mon Sep 17 00:00:00 2001 From: rr- Date: Mon, 1 Mar 2021 23:44:50 +0100 Subject: [PATCH] port RemoveInventoryText --- docs/progress.svg | 12 ++++++------ docs/progress.txt | 2 +- src/game/inv.h | 2 +- src/game/invfunc.c | 14 +++++++++++--- src/game/types.h | 6 ++++++ 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/docs/progress.svg b/docs/progress.svg index 3e0fecade..42be13691 100644 --- a/docs/progress.svg +++ b/docs/progress.svg @@ -300,7 +300,7 @@ - + @@ -1337,7 +1337,7 @@ - + @@ -1463,10 +1463,10 @@ -Functions decompiled (count): 43.37% -Functions decompiled (bytesize): 43.33% -Functions not decompiled, but with known names (count): 42.54% -Functions not decompiled, but with known names (bytesize): 40.84% +Functions decompiled (count): 43.50% +Functions decompiled (bytesize): 43.35% +Functions not decompiled, but with known names (count): 42.41% +Functions not decompiled, but with known names (bytesize): 40.82% Functions not decompiled, with unknown names (count): 14.09% Functions not decompiled, with unknown names (bytesize): 15.83% diff --git a/docs/progress.txt b/docs/progress.txt index c1bb4f841..789ecfe9d 100644 --- a/docs/progress.txt +++ b/docs/progress.txt @@ -414,7 +414,7 @@ Inv_RequestItem 0x00421200 0x00000077 + Inv_RemoveAllItems 0x00421280 0x0000001E + Inv_RemoveItem 0x004212A0 0x00000110 + Inv_GetItemOption 0x004213B0 0x000000A7 + -RemoveInventoryText 0x00421550 0x00000028 * +RemoveInventoryText 0x00421550 0x00000028 + Inv_RingInit 0x00421580 0x0000017E * Inv_RingGetView 0x00421700 0x00000060 * Inv_RingLight 0x00421760 0x00000040 * diff --git a/src/game/inv.h b/src/game/inv.h index f6d2e869d..5997672f3 100644 --- a/src/game/inv.h +++ b/src/game/inv.h @@ -5,7 +5,6 @@ #include // clang-format off -#define RemoveInventoryText ((void (*)())0x00421550) #define Inv_RingInit ((void (*)(RING_INFO* ring, int16_t type, INVENTORY_ITEM** list, int16_t qty, int16_t current, IMOTION_INFO* imo))0x00421580) #define Inv_RingGetView ((void (*)(RING_INFO* ring, PHD_3DPOS* viewer))0x00421700) #define Inv_RingLight ((void (*)(RING_INFO* ring))0x00421760) @@ -41,6 +40,7 @@ int32_t Inv_RequestItem(int item_num); void Inv_RemoveAllItems(); int32_t Inv_RemoveItem(int32_t item_num); int32_t Inv_GetItemOption(int32_t item_num); +void RemoveInventoryText(); void T1MInjectGameInvEntry(); void T1MInjectGameInvFunc(); diff --git a/src/game/invfunc.c b/src/game/invfunc.c index 978a73b82..93d3053eb 100644 --- a/src/game/invfunc.c +++ b/src/game/invfunc.c @@ -6,9 +6,6 @@ #include "specific/shed.h" #include "util.h" -#define IT_NAME 0 -#define IT_QTY 1 - void InitColours() { InvColours[IC_BLACK] = S_Colour(0, 0, 0); @@ -659,6 +656,16 @@ int32_t Inv_GetItemOption(int32_t item_num) return -1; } +void RemoveInventoryText() +{ + for (int i = 0; i < IT_NUMBER_OF; i++) { + if (InvItemText[i]) { + T_RemovePrint(InvItemText[i]); + InvItemText[i] = NULL; + } + } +} + void T1MInjectGameInvFunc() { INJECT(0x0041FEF0, InitColours); @@ -672,4 +679,5 @@ void T1MInjectGameInvFunc() INJECT(0x00421280, Inv_RemoveAllItems); INJECT(0x004212A0, Inv_RemoveItem); INJECT(0x004213B0, Inv_GetItemOption); + INJECT(0x00421550, RemoveInventoryText); } diff --git a/src/game/types.h b/src/game/types.h index 167d5e8c4..c88e11ca7 100644 --- a/src/game/types.h +++ b/src/game/types.h @@ -745,6 +745,12 @@ typedef enum { IC_NUMBER_OF = 17, } INV_COLOUR; +typedef enum { + IT_NAME = 0, + IT_QTY = 1, + IT_NUMBER_OF = 2, +} INV_TEXT; + #pragma pack(push, 1) typedef struct {