port Option_DoInventory

This commit is contained in:
Marcin Kurczewski 2024-08-29 00:38:26 +02:00
parent a67fdff862
commit c71f0b78ee
No known key found for this signature in database
GPG Key ID: CC65E6FD28CAE42A
6 changed files with 82 additions and 10 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">56.57% (689)</tspan> · <tspan class="known">40.97% (499)</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">56.65% (690)</tspan> · <tspan class="known">40.89% (498)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="422.56" height="6" x="0" y="0" class="decompiled"/>
<rect width="306.04" height="6" x="422.56" y="0" class="known"/>
<rect width="423.18" height="6" x="0" y="0" class="decompiled"/>
<rect width="305.42" height="6" x="423.18" y="0" class="known"/>
<rect width="18.40" height="6" x="728.60" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -1121,7 +1121,7 @@
<rect width="12" height="12" x="630" y="300" class="decompiled"><title>DWORD __cdecl EncodeLinePCX(BYTE *src, DWORD width, BYTE *dst);</title></rect>
<rect width="12" height="12" x="645" y="300" class="decompiled"><title>DWORD __cdecl EncodePutPCX(BYTE value, BYTE num, BYTE *buffer);</title></rect>
<rect width="12" height="12" x="660" y="300" class="decompiled"><title>void __cdecl Screenshot(LPDDS screen);</title></rect>
<rect width="12" height="12" x="675" y="300" class="known"><title>void __cdecl Option_DoInventory(INVENTORY_ITEM *item);</title></rect>
<rect width="12" height="12" x="675" y="300" class="decompiled"><title>void __cdecl Option_DoInventory(INVENTORY_ITEM *item);</title></rect>
<rect width="12" height="12" x="690" y="300" class="known"><title>void __cdecl Option_Passport(INVENTORY_ITEM *item);</title></rect>
<rect width="12" height="12" x="705" y="300" class="known"><title>void __cdecl Option_Detail(INVENTORY_ITEM *item);</title></rect>
<rect width="12" height="12" x="720" y="300" class="known"><title>void __cdecl Option_Sound(INVENTORY_ITEM *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">59.09%</tspan> · <tspan class="known">40.58%</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">59.13%</tspan> · <tspan class="known">40.55%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="441.39" height="6" x="0" y="0" class="decompiled"/>
<rect width="303.17" height="6" x="441.39" y="0" class="known"/>
<rect width="441.67" height="6" x="0" y="0" class="decompiled"/>
<rect width="302.89" height="6" x="441.67" y="0" class="known"/>
<rect width="2.44" height="6" x="744.56" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -1937,7 +1937,7 @@
<rect width="7.43" height="7.11" x="578.55" y="267.90" class="known"><title>void __cdecl InitialiseSkidman(int16_t item_num);</title></rect>
<rect width="7.43" height="7.11" x="578.55" y="278.01" class="known"><title>bool __cdecl WinInputInit(void);</title></rect>
<rect width="7.43" height="7.11" x="578.55" y="288.12" class="decompiled"><title>void __cdecl Random_Seed(void);</title></rect>
<rect width="7.43" height="7.11" x="578.55" y="298.23" class="known"><title>void __cdecl Option_DoInventory(INVENTORY_ITEM *item);</title></rect>
<rect width="7.43" height="7.11" x="578.55" y="298.23" class="decompiled"><title>void __cdecl Option_DoInventory(INVENTORY_ITEM *item);</title></rect>
<rect width="7.43" height="7.03" x="578.55" y="308.34" class="known"><title>void __cdecl BellControl(int16_t item_num);</title></rect>
<rect width="7.43" height="7.03" x="578.55" y="318.37" class="known"><title>void __cdecl Option_Controls_FlashConflicts(void);</title></rect>
<rect width="7.43" height="7.03" x="578.55" y="328.40" class="known"><title>void __cdecl S_SyncPictureBufferPalette(void);</title></rect>

Before

Width:  |  Height:  |  Size: 363 KiB

After

Width:  |  Height:  |  Size: 363 KiB

View File

@ -3961,7 +3961,7 @@ typedef enum {
0x0044EAA0 0x00D2 +R DWORD __cdecl EncodeLinePCX(BYTE *src, DWORD width, BYTE *dst);
0x0044EB80 0x003E +R DWORD __cdecl EncodePutPCX(BYTE value, BYTE num, BYTE *buffer);
0x0044EBC0 0x01F5 +R void __cdecl Screenshot(LPDDS screen);
0x0044EDC0 0x007F - void __cdecl Option_DoInventory(INVENTORY_ITEM *item);
0x0044EDC0 0x007F + void __cdecl Option_DoInventory(INVENTORY_ITEM *item);
0x0044EED0 0x0648 - void __cdecl Option_Passport(INVENTORY_ITEM *item);
0x0044F520 0x02DA - void __cdecl Option_Detail(INVENTORY_ITEM *item);
0x0044F800 0x049D - void __cdecl Option_Sound(INVENTORY_ITEM *item);

View File

@ -1,5 +1,69 @@
#include "game/option/option.h"
#include "global/funcs.h"
#include "global/vars.h"
void __cdecl Option_DoInventory(INVENTORY_ITEM *const item)
{
switch (item->obj_num) {
case O_PASSPORT_OPTION:
Option_Passport(item);
break;
case O_COMPASS_OPTION:
Option_Compass(item);
break;
case O_DETAIL_OPTION:
Option_Detail(item);
break;
case O_SOUND_OPTION:
Option_Sound(item);
break;
case O_CONTROL_OPTION:
Option_Controls(item);
break;
case O_GAMMA_OPTION:
break;
case O_PISTOL_OPTION:
case O_SHOTGUN_OPTION:
case O_MAGNUM_OPTION:
case O_UZI_OPTION:
case O_HARPOON_OPTION:
case O_M16_OPTION:
case O_GRENADE_OPTION:
case O_SMALL_MEDIPACK_OPTION:
case O_LARGE_MEDIPACK_OPTION:
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:
g_InputDB |= IN_SELECT;
break;
case O_PISTOL_AMMO_OPTION:
case O_SHOTGUN_AMMO_OPTION:
case O_MAGNUM_AMMO_OPTION:
case O_UZI_AMMO_OPTION:
case O_HARPOON_AMMO_OPTION:
case O_M16_AMMO_OPTION:
case O_GRENADE_AMMO_OPTION:
return;
default:
if ((g_InputDB & IN_SELECT) || (g_InputDB & IN_DESELECT)) {
item->goal_frame = 0;
item->anim_direction = -1;
}
break;
}
}
void __cdecl Option_ShutdownInventory(INVENTORY_ITEM *const item)
{
switch (item->obj_num) {

View File

@ -2,6 +2,7 @@
#include "global/types.h"
void __cdecl Option_DoInventory(INVENTORY_ITEM *item);
void __cdecl Option_ShutdownInventory(INVENTORY_ITEM *item);
void __cdecl Option_Passport_Shutdown(INVENTORY_ITEM *item);

View File

@ -365,7 +365,6 @@
#define game_malloc ((void *__cdecl (*)(size_t alloc_size, GAME_BUFFER buf_index))0x0044D6C0)
#define game_free ((void __cdecl (*)(size_t free_size))0x0044D740)
#define CalculateWibbleTable ((void __cdecl (*)(void))0x0044D780)
#define Option_DoInventory ((void __cdecl (*)(INVENTORY_ITEM *item))0x0044EDC0)
#define Option_Passport ((void __cdecl (*)(INVENTORY_ITEM *item))0x0044EED0)
#define Option_Detail ((void __cdecl (*)(INVENTORY_ITEM *item))0x0044F520)
#define Option_Sound ((void __cdecl (*)(INVENTORY_ITEM *item))0x0044F800)

View File

@ -39,6 +39,7 @@
#include "game/objects/general/door.h"
#include "game/objects/general/final_level_counter.h"
#include "game/objects/vehicles/boat.h"
#include "game/option/option.h"
#include "game/output.h"
#include "game/overlay.h"
#include "game/random.h"
@ -61,6 +62,7 @@ static void Inject_Room(bool enable);
static void Inject_Math(bool enable);
static void Inject_Matrix(bool enable);
static void Inject_Shell(bool enable);
static void Inject_Option(bool enable);
static void Inject_Text(bool enable);
static void Inject_Input(bool enable);
static void Inject_Output(bool enable);
@ -336,6 +338,11 @@ static void Inject_Shell(const bool enable)
INJECT(enable, 0x00454980, Shell_Main);
}
static void Inject_Option(const bool enable)
{
INJECT(enable, 0x0044EDC0, Option_DoInventory);
}
static void Inject_Text(const bool enable)
{
INJECT(enable, 0x00440450, Text_Init);
@ -921,6 +928,7 @@ void Inject_Exec(void)
Inject_Math(true);
Inject_Matrix(true);
Inject_Shell(true);
Inject_Option(true);
Inject_Text(true);
Inject_Input(true);
Inject_Output(true);