mirror of
https://github.com/LostArtefacts/TR2X.git
synced 2024-11-30 09:30:50 +00:00
port Inv_RemoveItem
This commit is contained in:
parent
75266108cc
commit
9514562501
@ -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.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>
|
||||
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">60.59% (738)</tspan> · <tspan class="known">36.95% (450)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
|
||||
<g transform="translate(0 20)">
|
||||
<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="452.62" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="275.99" height="6" x="452.62" y="0" class="known"/>
|
||||
<rect width="18.40" height="6" x="728.60" y="0" class="unused"/>
|
||||
</g>
|
||||
<g transform="translate(0 31)">
|
||||
@ -419,7 +419,7 @@
|
||||
<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="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="645" y="90" class="decompiled"><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>
|
||||
<rect width="12" height="12" x="690" y="90" class="decompiled"><title>void __cdecl Inv_Ring_Init(RING_INFO *ring, int16_t type, INVENTORY_ITEM **list, int16_t qty, int16_t current, IMOTION_INFO *imo);</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.29%</tspan> · <tspan class="known">35.38%</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.37%</tspan> · <tspan class="known">35.30%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
|
||||
<g transform="translate(0 20)">
|
||||
<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="480.83" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="263.73" height="6" x="480.83" y="0" class="known"/>
|
||||
<rect width="2.44" height="6" x="744.56" y="0" class="unused"/>
|
||||
</g>
|
||||
<g transform="translate(0 31)">
|
||||
@ -1641,7 +1641,7 @@
|
||||
<rect width="12.25" height="12.02" x="465.10" y="230.12" class="known"><title>int32_t __cdecl S_SaveGame(const void *save_data, uint32_t save_size, int32_t slot_num);</title></rect>
|
||||
<rect width="12.25" height="11.97" x="465.10" y="245.14" class="decompiled"><title>int32_t __cdecl GameStats(int32_t level_num);</title></rect>
|
||||
<rect width="12.25" height="11.91" x="465.10" y="260.11" class="decompiled"><title>int32_t __cdecl Game_Cutscene_Start(int32_t level_num);</title></rect>
|
||||
<rect width="12.25" height="11.80" x="465.10" y="275.02" class="known"><title>int32_t __cdecl Inv_RemoveItem(GAME_OBJECT_ID object_num);</title></rect>
|
||||
<rect width="12.25" height="11.80" x="465.10" y="275.02" class="decompiled"><title>int32_t __cdecl Inv_RemoveItem(GAME_OBJECT_ID object_num);</title></rect>
|
||||
<rect width="12.25" height="11.80" x="465.10" y="289.83" class="decompiled"><title>int16_t __cdecl TitleSequence(void);</title></rect>
|
||||
<rect width="12.25" height="11.75" x="465.10" y="304.63" class="decompiled"><title>void __cdecl Inv_Ring_Init(RING_INFO *ring, int16_t type, INVENTORY_ITEM **list, int16_t qty, int16_t current, IMOTION_INFO *imo);</title></rect>
|
||||
<rect width="12.25" height="11.75" x="465.10" y="319.38" class="decompiled"><title>void __cdecl ScreenshotPCX(void);</title></rect>
|
||||
|
Before Width: | Height: | Size: 364 KiB After Width: | Height: | Size: 364 KiB |
@ -3217,7 +3217,7 @@ typedef enum {
|
||||
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);
|
||||
0x00424CD0 0x0110 - int32_t __cdecl Inv_RemoveItem(GAME_OBJECT_ID object_num);
|
||||
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);
|
||||
0x00425000 0x010F + void __cdecl Inv_Ring_Init(RING_INFO *ring, int16_t type, INVENTORY_ITEM **list, int16_t qty, int16_t current, IMOTION_INFO *imo);
|
||||
|
@ -326,3 +326,39 @@ void __cdecl Inv_RemoveAllItems(void)
|
||||
g_Inv_KeyObjectsCount = 0;
|
||||
g_Inv_KeysCurrent = 0;
|
||||
}
|
||||
|
||||
int32_t Inv_RemoveItem(const GAME_OBJECT_ID object_id)
|
||||
{
|
||||
const GAME_OBJECT_ID inv_object_id = Inv_GetItemOption(object_id);
|
||||
|
||||
for (int32_t i = 0; i < g_Inv_MainObjectsCount; i++) {
|
||||
if (g_Inv_MainList[i]->obj_num == inv_object_id) {
|
||||
g_Inv_MainQtys[i]--;
|
||||
if (g_Inv_MainQtys[i] > 0) {
|
||||
return true;
|
||||
}
|
||||
g_Inv_MainObjectsCount--;
|
||||
for (int32_t j = i; j < g_Inv_MainObjectsCount; j++) {
|
||||
g_Inv_MainList[j] = g_Inv_MainList[j + 1];
|
||||
g_Inv_MainQtys[j] = g_Inv_MainQtys[j + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < g_Inv_KeyObjectsCount; i++) {
|
||||
if (g_Inv_KeysList[i]->obj_num == inv_object_id) {
|
||||
g_Inv_KeysQtys[i]--;
|
||||
if (g_Inv_KeysQtys[i] > 0) {
|
||||
return true;
|
||||
}
|
||||
g_Inv_KeyObjectsCount--;
|
||||
for (int32_t j = i; j < g_Inv_KeyObjectsCount; j++) {
|
||||
g_Inv_KeysList[j] = g_Inv_KeysList[j + 1];
|
||||
g_Inv_KeysQtys[j] = g_Inv_KeysQtys[j + 1];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -7,3 +7,4 @@ 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);
|
||||
int32_t __cdecl Inv_RemoveItem(GAME_OBJECT_ID object_num);
|
||||
|
@ -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_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)
|
||||
#define Rocket_Control ((void __cdecl (*)(int16_t item_num))0x0042C530)
|
||||
|
@ -625,6 +625,7 @@ static void Inject_Inventory(const bool enable)
|
||||
INJECT(enable, 0x00424B00, Inv_InsertItem);
|
||||
INJECT(enable, 0x00424C30, Inv_RequestItem);
|
||||
INJECT(enable, 0x00424CB0, Inv_RemoveAllItems);
|
||||
INJECT(enable, 0x00424CD0, Inv_RemoveItem);
|
||||
INJECT(enable, 0x00424DE0, Inv_GetItemOption);
|
||||
INJECT(enable, 0x00425000, Inv_Ring_Init);
|
||||
INJECT(enable, 0x00425110, Inv_Ring_GetView);
|
||||
|
Loading…
Reference in New Issue
Block a user