port Inv_RemoveAllItems

This commit is contained in:
Marcin Kurczewski 2024-09-05 23:35:05 +02:00
parent bbb7135563
commit 75266108cc
No known key found for this signature in database
GPG Key ID: CC65E6FD28CAE42A
7 changed files with 24 additions and 14 deletions

View File

@ -69,10 +69,10 @@
</g>
<g transform="translate(0 116)">
<text x="0" y="7.50">Tomb2.exe progress according to the physical function order:</text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">60.43% (736)</tspan> · <tspan class="known">37.11% (452)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">60.51% (737)</tspan> · <tspan class="known">37.03% (451)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="451.39" height="6" x="0" y="0" class="decompiled"/>
<rect width="277.21" height="6" x="451.39" y="0" class="known"/>
<rect width="452" height="6" x="0" y="0" class="decompiled"/>
<rect width="276.60" height="6" x="452" y="0" class="known"/>
<rect width="18.40" height="6" x="728.60" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -418,7 +418,7 @@
<rect width="12" height="12" x="585" y="90" class="decompiled"><title>int32_t __cdecl Inv_AddItem(GAME_OBJECT_ID object_num);</title></rect>
<rect width="12" height="12" x="600" y="90" class="decompiled"><title>void __cdecl Inv_InsertItem(INVENTORY_ITEM *inv_item);</title></rect>
<rect width="12" height="12" x="615" y="90" class="decompiled"><title>int32_t __cdecl Inv_RequestItem(GAME_OBJECT_ID object_num);</title></rect>
<rect width="12" height="12" x="630" y="90" class="known"><title>void __cdecl Inv_RemoveAllItems(void);</title></rect>
<rect width="12" height="12" x="630" y="90" class="decompiled"><title>void __cdecl Inv_RemoveAllItems(void);</title></rect>
<rect width="12" height="12" x="645" y="90" class="known"><title>int32_t __cdecl Inv_RemoveItem(GAME_OBJECT_ID object_num);</title></rect>
<rect width="12" height="12" x="660" y="90" class="decompiled"><title>int32_t __cdecl Inv_GetItemOption(GAME_OBJECT_ID object_num);</title></rect>
<rect width="12" height="12" x="675" y="90" class="known"><title>void __cdecl RemoveInventoryText(void);</title></rect>
@ -1298,10 +1298,10 @@
</g>
<g transform="translate(0 546)">
<text x="0" y="7.50">Tomb2.exe progress according to the function sizes:</text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">64.28%</tspan> · <tspan class="known">35.39%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">64.29%</tspan> · <tspan class="known">35.38%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="480.18" height="6" x="0" y="0" class="decompiled"/>
<rect width="264.38" height="6" x="480.18" y="0" class="known"/>
<rect width="480.24" height="6" x="0" y="0" class="decompiled"/>
<rect width="264.32" height="6" x="480.24" y="0" class="known"/>
<rect width="2.44" height="6" x="744.56" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -2409,7 +2409,7 @@
<rect width="1.57" height="2.09" x="736.30" y="336.88" class="known"><title>int32_t __cdecl GetFreePaletteIndex(void);</title></rect>
<rect width="1.57" height="2.09" x="740.86" y="336.88" class="known"><title>int32_t __cdecl GetFreeTexturePageIndex(void);</title></rect>
<rect width="1.57" height="2.09" x="745.43" y="336.88" class="known"><title>void __thiscall SE_UpdateBitmapPalette(BITMAP_RESOURCE *bmpRsrc, HWND hWnd, HWND hSender);</title></rect>
<rect width="1.91" height="1.57" x="708.89" y="341.96" class="known"><title>void __cdecl Inv_RemoveAllItems(void);</title></rect>
<rect width="1.91" height="1.57" x="708.89" y="341.96" class="decompiled"><title>void __cdecl Inv_RemoveAllItems(void);</title></rect>
<rect width="1.91" height="1.57" x="708.89" y="346.53" class="decompiled"><title>void __cdecl Requester_Item_CenterAlign(REQUEST_INFO *req, TEXTSTRING *txt);</title></rect>
<rect width="1.91" height="1.57" x="708.89" y="351.10" class="decompiled"><title>void __cdecl Lara_ControlExtra(int16_t item_num);</title></rect>
<rect width="1.91" height="1.57" x="708.89" y="355.67" class="known"><title>void __cdecl BridgeFlatCeiling(ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int32_t *height);</title></rect>

Before

Width:  |  Height:  |  Size: 364 KiB

After

Width:  |  Height:  |  Size: 364 KiB

View File

@ -3216,7 +3216,7 @@ typedef enum {
0x004242F0 0x06BE + int32_t __cdecl Inv_AddItem(GAME_OBJECT_ID object_num);
0x00424B00 0x0129 + void __cdecl Inv_InsertItem(INVENTORY_ITEM *inv_item);
0x00424C30 0x0077 + int32_t __cdecl Inv_RequestItem(GAME_OBJECT_ID object_num);
0x00424CB0 0x001B - void __cdecl Inv_RemoveAllItems(void);
0x00424CB0 0x001B + void __cdecl Inv_RemoveAllItems(void);
0x00424CD0 0x0110 - int32_t __cdecl Inv_RemoveItem(GAME_OBJECT_ID object_num);
0x00424DE0 0x00C1 + int32_t __cdecl Inv_GetItemOption(GAME_OBJECT_ID object_num);
0x00424FD0 0x0024 -R void __cdecl RemoveInventoryText(void);

View File

@ -9,6 +9,7 @@
#include "game/gameflow/gameflow_new.h"
#include "game/hwr.h"
#include "game/input.h"
#include "game/inventory/backpack.h"
#include "game/inventory/common.h"
#include "game/items.h"
#include "game/lara/lara_control.h"

View File

@ -30,7 +30,7 @@ void __cdecl Inv_InsertItem(INVENTORY_ITEM *const inv_item)
}
}
for (int i = g_Inv_KeyObjectsCount; i > n - 1; i--) {
for (int32_t i = g_Inv_KeyObjectsCount; i > n - 1; i--) {
g_Inv_KeysList[i + 1] = g_Inv_KeysList[i];
g_Inv_KeysQtys[i + 1] = g_Inv_KeysQtys[i];
}
@ -302,19 +302,27 @@ void Inv_AddItemNTimes(GAME_OBJECT_ID object_num, int32_t qty)
int32_t __cdecl Inv_RequestItem(const GAME_OBJECT_ID object_num)
{
const GAME_OBJECT_ID option_object_id = Inv_GetItemOption(object_num);
const GAME_OBJECT_ID inv_object_id = Inv_GetItemOption(object_num);
for (int32_t i = 0; i < g_Inv_MainObjectsCount; i++) {
if (g_Inv_MainList[i]->obj_num == option_object_id) {
if (g_Inv_MainList[i]->obj_num == inv_object_id) {
return g_Inv_MainQtys[i];
}
}
for (int32_t i = 0; i < g_Inv_KeyObjectsCount; i++) {
if (g_Inv_KeysList[i]->obj_num == option_object_id) {
if (g_Inv_KeysList[i]->obj_num == inv_object_id) {
return g_Inv_KeysQtys[i];
}
}
return 0;
}
void __cdecl Inv_RemoveAllItems(void)
{
g_Inv_MainObjectsCount = 0;
g_Inv_MainCurrent = 0;
g_Inv_KeyObjectsCount = 0;
g_Inv_KeysCurrent = 0;
}

View File

@ -6,3 +6,4 @@ void __cdecl Inv_InsertItem(INVENTORY_ITEM *inv_item);
int32_t __cdecl Inv_AddItem(GAME_OBJECT_ID object_id);
void Inv_AddItemNTimes(GAME_OBJECT_ID object_num, int32_t qty);
int32_t __cdecl Inv_RequestItem(GAME_OBJECT_ID object_num);
void __cdecl Inv_RemoveAllItems(void);

View File

@ -100,7 +100,6 @@
#define RingIsNotOpen ((void __cdecl (*)(RING_INFO *ring))0x00423DB0)
#define RingNotActive ((void __cdecl (*)(INVENTORY_ITEM *inv_item))0x00423E40)
#define RingActive ((void __cdecl (*)(void))0x004242B0)
#define Inv_RemoveAllItems ((void __cdecl (*)(void))0x00424CB0)
#define Inv_RemoveItem ((int32_t __cdecl (*)(GAME_OBJECT_ID object_num))0x00424CD0)
#define RemoveInventoryText ((void __cdecl (*)(void))0x00424FD0)
#define HarpoonBolt_Control ((void __cdecl (*)(int16_t item_num))0x0042C0F0)

View File

@ -624,6 +624,7 @@ static void Inject_Inventory(const bool enable)
INJECT(enable, 0x004242F0, Inv_AddItem);
INJECT(enable, 0x00424B00, Inv_InsertItem);
INJECT(enable, 0x00424C30, Inv_RequestItem);
INJECT(enable, 0x00424CB0, Inv_RemoveAllItems);
INJECT(enable, 0x00424DE0, Inv_GetItemOption);
INJECT(enable, 0x00425000, Inv_Ring_Init);
INJECT(enable, 0x00425110, Inv_Ring_GetView);