port Option_Controls_ShowControls

This commit is contained in:
Marcin Kurczewski 2024-09-05 01:10:14 +02:00
parent 399c8ae5da
commit e31af413ad
No known key found for this signature in database
GPG Key ID: CC65E6FD28CAE42A
6 changed files with 121 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">57.88% (705)</tspan> · <tspan class="known">39.66% (483)</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">57.96% (706)</tspan> · <tspan class="known">39.57% (482)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="432.38" height="6" x="0" y="0" class="decompiled"/>
<rect width="296.22" height="6" x="432.38" y="0" class="known"/>
<rect width="432.99" height="6" x="0" y="0" class="decompiled"/>
<rect width="295.61" height="6" x="432.99" y="0" class="known"/>
<rect width="18.40" height="6" x="728.60" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -1129,7 +1129,7 @@
<rect width="12" height="12" x="0" y="315" class="decompiled"><title>void __cdecl Option_Controls_FlashConflicts(void);</title></rect>
<rect width="12" height="12" x="15" y="315" class="decompiled"><title>void __cdecl Option_Controls_DefaultConflict(void);</title></rect>
<rect width="12" height="12" x="30" y="315" class="decompiled"><title>void __cdecl Option_Controls(INVENTORY_ITEM *item);</title></rect>
<rect width="12" height="12" x="45" y="315" class="known"><title>void __cdecl S_ShowControls(void);</title></rect>
<rect width="12" height="12" x="45" y="315" class="decompiled"><title>void __cdecl Option_Controls_ShowControls(void);</title></rect>
<rect width="12" height="12" x="60" y="315" class="known"><title>void __cdecl S_ChangeCtrlText(void);</title></rect>
<rect width="12" height="12" x="75" y="315" class="known"><title>void __cdecl S_RemoveCtrlText(void);</title></rect>
<rect width="12" height="12" x="90" y="315" class="known"><title>int32_t __cdecl GetRenderHeight(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">62.09%</tspan> · <tspan class="known">37.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">62.45%</tspan> · <tspan class="known">37.22%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="463.80" height="6" x="0" y="0" class="decompiled"/>
<rect width="280.76" height="6" x="463.80" y="0" class="known"/>
<rect width="466.50" height="6" x="0" y="0" class="decompiled"/>
<rect width="278.06" height="6" x="466.50" y="0" class="known"/>
<rect width="2.44" height="6" x="744.56" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -1344,7 +1344,7 @@
<rect width="28.60" height="29.99" x="177.07" y="0" class="decompiled"><title>void __cdecl Gun_Control(void);</title></rect>
<rect width="28.60" height="29.70" x="177.07" y="32.99" class="decompiled"><title>int32_t __cdecl Boat_Dynamics(int16_t boat_num);</title></rect>
<rect width="28.60" height="29.54" x="177.07" y="65.69" class="decompiled"><title>void __cdecl Output_InsertGT4_Sorted(const PHD_VBUF *vtx0, const PHD_VBUF *vtx1, const PHD_VBUF *vtx2, const PHD_VBUF *vtx3, const PHD_TEXTURE *texture, SORT_TYPE sort_type);</title></rect>
<rect width="28.60" height="29.36" x="177.07" y="98.23" class="known"><title>void __cdecl S_ShowControls(void);</title></rect>
<rect width="28.60" height="29.36" x="177.07" y="98.23" class="decompiled"><title>void __cdecl Option_Controls_ShowControls(void);</title></rect>
<rect width="28.60" height="28.33" x="177.07" y="130.59" class="decompiled"><title>void __cdecl Camera_Update(void);</title></rect>
<rect width="28.60" height="28.20" x="177.07" y="161.92" class="decompiled"><title>void __cdecl Output_InsertTrans8(const PHD_VBUF *vbuf, int16_t shade);</title></rect>
<rect width="28.60" height="28.12" x="177.07" y="193.12" class="known"><title>void __cdecl MonkControl(int16_t item_num);</title></rect>

Before

Width:  |  Height:  |  Size: 364 KiB

After

Width:  |  Height:  |  Size: 364 KiB

View File

@ -3984,7 +3984,7 @@ typedef enum {
0x0044FD60 0x007E + void __cdecl Option_Controls_FlashConflicts(void);
0x0044FDE0 0x0040 + void __cdecl Option_Controls_DefaultConflict(void);
0x0044FE20 0x06F4 + void __cdecl Option_Controls(INVENTORY_ITEM *item);
0x00450530 0x04D0 -R void __cdecl S_ShowControls(void);
0x00450530 0x04D0 + void __cdecl Option_Controls_ShowControls(void);
0x00450A00 0x0096 -R void __cdecl S_ChangeCtrlText(void);
0x00450AA0 0x003B -R void __cdecl S_RemoveCtrlText(void);
0x00450AE0 0x0006 -R int32_t __cdecl GetRenderHeight(void);

View File

@ -17,6 +17,7 @@ void __cdecl Option_Controls_FlashConflicts(void);
void __cdecl Option_Controls_DefaultConflict(void);
void __cdecl Option_Controls(INVENTORY_ITEM *item);
void __cdecl Option_Controls_Shutdown(INVENTORY_ITEM *item);
void __cdecl Option_Controls_ShowControls(void);
void __cdecl Option_Compass(INVENTORY_ITEM *item);
void __cdecl Option_Compass_Shutdown(INVENTORY_ITEM *item);

View File

@ -3,6 +3,8 @@
#include "global/funcs.h"
#include "global/vars.h"
#include <libtrx/utils.h>
#include <dinput.h>
static void Option_Controls_InitText(void);
@ -31,7 +33,7 @@ static void Option_Controls_InitText(void)
[g_LayoutPage == 0 ? GF_S_PC_DEFAULT_KEYS : GF_S_PC_USER_KEYS]);
Text_CentreH(g_ControlsText[0], 1);
Text_CentreV(g_ControlsText[0], 1);
S_ShowControls();
Option_Controls_ShowControls();
m_Cursor = -1;
Text_AddBackground(g_ControlsText[0], 0, 0, 0, 0, 48, 0, 0, 0);
Text_AddOutline(g_ControlsText[0], 1, 15, 0, 0);
@ -313,3 +315,110 @@ void __cdecl Option_Controls(INVENTORY_ITEM *const item)
g_InputDB = 0;
}
}
void __cdecl Option_Controls_ShowControls(void)
{
int32_t right_col = GetRenderWidth() / 2;
CLAMPG(right_col, 320);
if (g_ControlsTextA[0] == NULL) {
int32_t left_col = right_col - 140;
if (right_col >= 320) {
left_col = right_col - 200;
}
const CONTROL_LAYOUT *const layout = &g_Layout[g_LayoutPage];
g_ControlsTextA[0] =
Text_Create(left_col, -25, 16, g_KeyNames[layout->key[0]]);
g_ControlsTextA[1] =
Text_Create(left_col, -10, 16, g_KeyNames[layout->key[1]]);
g_ControlsTextA[2] =
Text_Create(left_col, 5, 16, g_KeyNames[layout->key[2]]);
g_ControlsTextA[3] =
Text_Create(left_col, 20, 16, g_KeyNames[layout->key[3]]);
g_ControlsTextA[4] =
Text_Create(left_col, 35, 16, g_KeyNames[layout->key[4]]);
g_ControlsTextA[5] =
Text_Create(left_col, 50, 16, g_KeyNames[layout->key[5]]);
g_ControlsTextA[6] =
Text_Create(left_col, 65, 16, g_KeyNames[layout->key[6]]);
g_ControlsTextA[7] =
Text_Create(right_col + 10, -25, 16, g_KeyNames[layout->key[7]]);
g_ControlsTextA[8] =
Text_Create(right_col + 10, -10, 16, g_KeyNames[layout->key[8]]);
g_ControlsTextA[9] =
Text_Create(right_col + 10, 5, 16, g_KeyNames[layout->key[9]]);
g_ControlsTextA[10] =
Text_Create(right_col + 10, 20, 16, g_KeyNames[layout->key[10]]);
g_ControlsTextA[11] =
Text_Create(right_col + 10, 35, 16, g_KeyNames[layout->key[11]]);
g_ControlsTextA[12] =
Text_Create(right_col + 10, 50, 16, g_KeyNames[layout->key[12]]);
g_ControlsTextA[13] =
Text_Create(right_col + 10, 65, 16, g_KeyNames[layout->key[13]]);
for (int32_t i = 0; i < 14; i++) {
Text_CentreV(g_ControlsTextA[i], true);
}
m_Cursor = 0;
}
if (g_ControlsTextB[0] == NULL) {
int32_t left_col = right_col - 70;
if (right_col >= 320) {
left_col = right_col - 130;
}
g_ControlsTextB[0] = Text_Create(
left_col, -25, 16, g_GF_GameStrings[GF_S_GAME_KEYMAP_RUN]);
g_ControlsTextB[1] = Text_Create(
left_col, -10, 16, g_GF_GameStrings[GF_S_GAME_KEYMAP_BACK]);
g_ControlsTextB[2] = Text_Create(
left_col, 5, 16, g_GF_GameStrings[GF_S_GAME_KEYMAP_LEFT]);
g_ControlsTextB[3] = Text_Create(
left_col, 20, 16, g_GF_GameStrings[GF_S_GAME_KEYMAP_RIGHT]);
g_ControlsTextB[4] = Text_Create(
left_col, 35, 16, g_GF_GameStrings[GF_S_GAME_KEYMAP_STEP_LEFT]);
g_ControlsTextB[5] = Text_Create(
left_col, 50, 16, g_GF_GameStrings[GF_S_GAME_KEYMAP_STEP_RIGHT]);
g_ControlsTextB[6] = Text_Create(
left_col, 65, 16, g_GF_GameStrings[GF_S_GAME_KEYMAP_WALK]);
g_ControlsTextB[7] = Text_Create(
right_col + 90, -25, 16, g_GF_GameStrings[GF_S_GAME_KEYMAP_JUMP]);
g_ControlsTextB[8] = Text_Create(
right_col + 90, -10, 16, g_GF_GameStrings[GF_S_GAME_KEYMAP_ACTION]);
g_ControlsTextB[9] = Text_Create(
right_col + 90, 5, 16,
g_GF_GameStrings[GF_S_GAME_KEYMAP_DRAW_WEAPON]);
g_ControlsTextB[10] = Text_Create(
right_col + 90, 20, 16, g_GF_GameStrings[GF_S_GAME_KEYMAP_FLARE]);
g_ControlsTextB[11] = Text_Create(
right_col + 90, 35, 16, g_GF_GameStrings[GF_S_GAME_KEYMAP_LOOK]);
g_ControlsTextB[12] = Text_Create(
right_col + 90, 50, 16, g_GF_GameStrings[GF_S_GAME_KEYMAP_ROLL]);
g_ControlsTextB[13] = Text_Create(
right_col + 90, 65, 16,
g_GF_GameStrings[GF_S_GAME_KEYMAP_INVENTORY]);
for (int32_t i = 0; i < 14; i++) {
Text_CentreV(g_ControlsTextB[i], true);
}
}
g_ControlsText[1] = Text_Create(0, -55, 0, " ");
Text_CentreV(g_ControlsText[1], 1);
Text_CentreH(g_ControlsText[1], 1);
Text_AddOutline(g_ControlsText[1], 1, 15, 0, 0);
if (right_col < 320) {
for (int32_t i = 0; i < 14; ++i) {
Text_SetScale(g_ControlsTextA[i], PHD_ONE * 0.5, PHD_ONE);
Text_SetScale(g_ControlsTextB[i], PHD_ONE * 0.5, PHD_ONE);
}
Text_AddBackground(g_ControlsText[1], 300, 140, 0, 0, 48, 0, 0, 0);
} else {
Text_AddBackground(g_ControlsText[1], 420, 150, 0, 0, 48, 0, 0, 0);
}
}

View File

@ -357,7 +357,6 @@
#define game_free ((void __cdecl (*)(size_t free_size))0x0044D740)
#define CalculateWibbleTable ((void __cdecl (*)(void))0x0044D780)
#define Option_Sound ((void __cdecl (*)(INVENTORY_ITEM *item))0x0044F800)
#define S_ShowControls ((void __cdecl (*)(void))0x00450530)
#define S_ChangeCtrlText ((void __cdecl (*)(void))0x00450A00)
#define S_RemoveCtrlText ((void __cdecl (*)(void))0x00450AA0)
#define GetRenderHeight ((int32_t __cdecl (*)(void))0x00450AE0)

View File

@ -372,6 +372,7 @@ static void Inject_Option(const bool enable)
INJECT(enable, 0x0044FD60, Option_Controls_FlashConflicts);
INJECT(enable, 0x0044FDE0, Option_Controls_DefaultConflict);
INJECT(enable, 0x0044FE20, Option_Controls);
INJECT(enable, 0x00450530, Option_Controls_ShowControls);
}
static void Inject_Text(const bool enable)