port Inv_RingNotActive

This commit is contained in:
Marcin Kurczewski 2024-09-06 00:20:11 +02:00
parent 125af1f223
commit 3304a66b18
No known key found for this signature in database
GPG Key ID: CC65E6FD28CAE42A
6 changed files with 158 additions and 11 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.92% (742)</tspan> · <tspan class="known">36.62% (446)</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">61% (743)</tspan> · <tspan class="known">36.54% (445)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="455.07" height="6" x="0" y="0" class="decompiled"/>
<rect width="273.53" height="6" x="455.07" y="0" class="known"/>
<rect width="455.68" height="6" x="0" y="0" class="decompiled"/>
<rect width="272.92" height="6" x="455.68" y="0" class="known"/>
<rect width="18.40" height="6" x="728.60" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -413,7 +413,7 @@
<rect width="12" height="12" x="510" y="90" class="known"><title>void __cdecl InitColours(void);</title></rect>
<rect width="12" height="12" x="525" y="90" class="decompiled"><title>void __cdecl Inv_RingIsOpen(RING_INFO *ring);</title></rect>
<rect width="12" height="12" x="540" y="90" class="decompiled"><title>void __cdecl Inv_RingIsNotOpen(RING_INFO *ring);</title></rect>
<rect width="12" height="12" x="555" y="90" class="known"><title>void __cdecl RingNotActive(INVENTORY_ITEM *inv_item);</title></rect>
<rect width="12" height="12" x="555" y="90" class="decompiled"><title>void __cdecl Inv_RingNotActive(INVENTORY_ITEM *inv_item);</title></rect>
<rect width="12" height="12" x="570" y="90" class="known"><title>void __cdecl RingActive(void);</title></rect>
<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>
@ -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.60%</tspan> · <tspan class="known">35.07%</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.86%</tspan> · <tspan class="known">34.82%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="482.58" height="6" x="0" y="0" class="decompiled"/>
<rect width="261.98" height="6" x="482.58" y="0" class="known"/>
<rect width="484.49" height="6" x="0" y="0" class="decompiled"/>
<rect width="260.07" height="6" x="484.49" y="0" class="known"/>
<rect width="2.44" height="6" x="744.56" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -1391,7 +1391,7 @@
<rect width="24.49" height="23.69" x="267.09" y="245.79" class="decompiled"><title>void __cdecl WinVidStart(void);</title></rect>
<rect width="24.49" height="23.63" x="267.09" y="272.48" class="decompiled"><title>void __cdecl Camera_Move(const GAME_VECTOR *target, int32_t speed);</title></rect>
<rect width="24.49" height="23.45" x="267.09" y="299.11" class="decompiled"><title>void __cdecl Lara_InitialiseInventory(int32_t level_num);</title></rect>
<rect width="24.49" height="23.36" x="267.09" y="325.56" class="known"><title>void __cdecl RingNotActive(INVENTORY_ITEM *inv_item);</title></rect>
<rect width="24.49" height="23.36" x="267.09" y="325.56" class="decompiled"><title>void __cdecl Inv_RingNotActive(INVENTORY_ITEM *inv_item);</title></rect>
<rect width="24.49" height="23.09" x="267.09" y="351.91" class="decompiled"><title>int32_t __cdecl Gun_FireWeapon(LARA_GUN_TYPE weapon_type, ITEM_INFO *target, const ITEM_INFO *src, const PHD_ANGLE *angles);</title></rect>
<rect width="22.47" height="24.84" x="294.58" y="0" class="decompiled"><title>int32_t __cdecl Game_Control(int32_t nframes, int32_t demo_mode);</title></rect>
<rect width="22.47" height="24.67" x="294.58" y="27.84" class="known"><title>INT_PTR __stdcall SE_GraphicsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);</title></rect>

Before

Width:  |  Height:  |  Size: 364 KiB

After

Width:  |  Height:  |  Size: 364 KiB

View File

@ -3211,7 +3211,7 @@ typedef enum {
0x00423B30 0x010A -R void __cdecl InitColours(void);
0x00423C40 0x0167 + void __cdecl Inv_RingIsOpen(RING_INFO *ring);
0x00423DB0 0x0081 + void __cdecl Inv_RingIsNotOpen(RING_INFO *ring);
0x00423E40 0x0369 -R void __cdecl RingNotActive(INVENTORY_ITEM *inv_item);
0x00423E40 0x0369 + void __cdecl Inv_RingNotActive(INVENTORY_ITEM *inv_item);
0x004242B0 0x0032 -R void __cdecl RingActive(void);
0x004242F0 0x06BE + int32_t __cdecl Inv_AddItem(GAME_OBJECT_ID object_num);
0x00424B00 0x0129 + void __cdecl Inv_InsertItem(INVENTORY_ITEM *inv_item);

View File

@ -2,6 +2,7 @@
#include "game/demo.h"
#include "game/input.h"
#include "game/inventory/backpack.h"
#include "game/inventory/ring.h"
#include "game/inventory/vars.h"
#include "game/lara/lara_control.h"
@ -20,11 +21,35 @@
#include "global/types.h"
#include "global/vars.h"
#include <stdio.h>
#define TITLE_RING_OBJECTS 3
#define OPTION_RING_OBJECTS 3
static TEXTSTRING *m_VersionText = NULL;
static void Inv_ShowItemQuantity(const char *fmt, int32_t qty);
static void Inv_ShowAmmoQuantity(const char *fmt, int32_t qty);
static void Inv_ShowItemQuantity(const char *const fmt, const int32_t qty)
{
if (g_Inv_ItemText[1] == NULL && !g_SaveGame.bonus_flag) {
char string[64];
sprintf(string, fmt, qty);
Overlay_MakeAmmoString(string);
g_Inv_ItemText[1] = Text_Create(64, -56, 0, string);
Text_AlignBottom(g_Inv_ItemText[1], true);
Text_CentreH(g_Inv_ItemText[1], true);
}
}
static void Inv_ShowAmmoQuantity(const char *const fmt, const int32_t qty)
{
if (!g_SaveGame.bonus_flag) {
Inv_ShowItemQuantity(fmt, qty);
}
}
void __cdecl Inv_Construct(void)
{
S_SetupAboveWater(0);
@ -297,7 +322,7 @@ int32_t __cdecl Inv_Display(int32_t inventory_mode)
|| imo.status == RNG_CLOSING_ITEM)
&& !ring.rotating && !(g_Input & IN_LEFT)
&& !(g_Input & IN_RIGHT)) {
RingNotActive(inv_item);
Inv_RingNotActive(inv_item);
}
}
@ -1052,3 +1077,124 @@ void __cdecl Inv_RingIsNotOpen(RING_INFO *const ring)
Text_Remove(g_Inv_DownArrow2);
g_Inv_DownArrow2 = NULL;
}
void __cdecl Inv_RingNotActive(const INVENTORY_ITEM *const inv_item)
{
if (g_Inv_ItemText[0] == NULL) {
switch (inv_item->obj_num) {
case O_PASSPORT_OPTION:
break;
case O_PUZZLE_OPTION_1:
g_Inv_ItemText[0] =
Text_Create(0, -16, 0, g_GF_Puzzle1Strings[g_CurrentLevel]);
break;
case O_PUZZLE_OPTION_2:
g_Inv_ItemText[0] =
Text_Create(0, -16, 0, g_GF_Puzzle2Strings[g_CurrentLevel]);
break;
case O_PUZZLE_OPTION_3:
g_Inv_ItemText[0] =
Text_Create(0, -16, 0, g_GF_Puzzle3Strings[g_CurrentLevel]);
break;
case O_PUZZLE_OPTION_4:
g_Inv_ItemText[0] =
Text_Create(0, -16, 0, g_GF_Puzzle4Strings[g_CurrentLevel]);
break;
case O_KEY_OPTION_1:
g_Inv_ItemText[0] =
Text_Create(0, -16, 0, g_GF_Key1Strings[g_CurrentLevel]);
break;
case O_KEY_OPTION_2:
g_Inv_ItemText[0] =
Text_Create(0, -16, 0, g_GF_Key2Strings[g_CurrentLevel]);
break;
case O_KEY_OPTION_3:
g_Inv_ItemText[0] =
Text_Create(0, -16, 0, g_GF_Key3Strings[g_CurrentLevel]);
break;
case O_KEY_OPTION_4:
g_Inv_ItemText[0] =
Text_Create(0, -16, 0, g_GF_Key4Strings[g_CurrentLevel]);
break;
case O_PICKUP_OPTION_1:
g_Inv_ItemText[0] =
Text_Create(0, -16, 0, g_GF_Pickup1Strings[g_CurrentLevel]);
break;
case O_PICKUP_OPTION_2:
g_Inv_ItemText[0] =
Text_Create(0, -16, 0, g_GF_Pickup2Strings[g_CurrentLevel]);
break;
default:
g_Inv_ItemText[0] = Text_Create(0, -16, 0, inv_item->string);
break;
}
if (g_Inv_ItemText[0]) {
Text_AlignBottom(g_Inv_ItemText[0], true);
Text_CentreH(g_Inv_ItemText[0], true);
}
}
const int32_t qty = Inv_RequestItem(inv_item->obj_num);
switch (inv_item->obj_num) {
case O_SHOTGUN_OPTION:
Inv_ShowAmmoQuantity(
"%5d", g_Lara.shotgun_ammo.ammo / SHOTGUN_AMMO_CLIP);
break;
case O_MAGNUM_OPTION:
Inv_ShowAmmoQuantity("%5d", g_Lara.magnum_ammo.ammo);
break;
case O_UZI_OPTION:
Inv_ShowAmmoQuantity("%5d", g_Lara.uzi_ammo.ammo);
break;
case O_HARPOON_OPTION:
Inv_ShowAmmoQuantity("%5d", g_Lara.harpoon_ammo.ammo);
break;
case O_M16_OPTION:
Inv_ShowAmmoQuantity("%5d", g_Lara.m16_ammo.ammo);
break;
case O_GRENADE_OPTION:
Inv_ShowAmmoQuantity("%5d", g_Lara.grenade_ammo.ammo);
break;
case O_SHOTGUN_AMMO_OPTION:
Inv_ShowAmmoQuantity("%d", SHOTGUN_SHELL_COUNT * qty);
break;
case O_MAGNUM_AMMO_OPTION:
case O_UZI_AMMO_OPTION:
case O_HARPOON_AMMO_OPTION:
case O_M16_AMMO_OPTION:
Inv_ShowAmmoQuantity("%d", 2 * qty);
break;
case O_GRENADE_AMMO_OPTION:
case O_FLARES_OPTION:
Inv_ShowAmmoQuantity("%d", qty);
break;
case O_SMALL_MEDIPACK_OPTION:
case O_LARGE_MEDIPACK_OPTION:
g_HealthBarTimer = 40;
Overlay_DrawHealthBar(Overlay_FlashCounter());
Inv_ShowItemQuantity("%d", qty);
break;
case O_PUZZLE_OPTION_1:
case O_PUZZLE_OPTION_2:
case O_PUZZLE_OPTION_3:
case O_PUZZLE_OPTION_4:
case O_KEY_OPTION_1:
case O_KEY_OPTION_2:
case O_KEY_OPTION_3:
case O_KEY_OPTION_4:
case O_PICKUP_OPTION_1:
case O_PICKUP_OPTION_2:
if (qty > 1) {
Inv_ShowItemQuantity("%d", qty);
}
break;
default:
break;
}
}

View File

@ -12,3 +12,4 @@ void __cdecl Inv_DoInventoryPicture(void);
void __cdecl Inv_DoInventoryBackground(void);
void __cdecl Inv_RingIsOpen(RING_INFO *ring);
void __cdecl Inv_RingIsNotOpen(RING_INFO *ring);
void __cdecl Inv_RingNotActive(const INVENTORY_ITEM *inv_item);

View File

@ -94,7 +94,6 @@
#define DrawHair ((void __cdecl (*)(void))0x00421920)
#define GetDebouncedInput ((int32_t __cdecl (*)(int32_t input))0x004239C0)
#define InitColours ((void __cdecl (*)(void))0x00423B30)
#define RingNotActive ((void __cdecl (*)(INVENTORY_ITEM *inv_item))0x00423E40)
#define RingActive ((void __cdecl (*)(void))0x004242B0)
#define RemoveInventoryText ((void __cdecl (*)(void))0x00424FD0)
#define HarpoonBolt_Control ((void __cdecl (*)(int16_t item_num))0x0042C0F0)

View File

@ -625,6 +625,7 @@ static void Inject_Inventory(const bool enable)
INJECT(enable, 0x004239F0, Inv_DoInventoryBackground);
INJECT(enable, 0x00423C40, Inv_RingIsOpen);
INJECT(enable, 0x00423DB0, Inv_RingIsNotOpen);
INJECT(enable, 0x00423E40, Inv_RingNotActive);
INJECT(enable, 0x004242F0, Inv_AddItem);
INJECT(enable, 0x00424B00, Inv_InsertItem);
INJECT(enable, 0x00424C30, Inv_RequestItem);