port Lara_State_ForwardJump

This commit is contained in:
Marcin Kurczewski 2023-10-05 22:38:09 +02:00
parent 9dc15815ff
commit 07424fbd43
No known key found for this signature in database
GPG Key ID: CC65E6FD28CAE42A
8 changed files with 64 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">5.67% (68)</tspan> · <tspan class="known">91.92% (1103)</tspan> · <tspan class="todo">0.67% (8)</tspan> · <tspan class="unused">1.75% (21)</tspan></tspan></text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">5.75% (69)</tspan> · <tspan class="known">91.83% (1102)</tspan> · <tspan class="todo">0.67% (8)</tspan> · <tspan class="unused">1.75% (21)</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="42.33" height="6" x="0" y="0" class="decompiled"/>
<rect width="686.62" height="6" x="42.33" y="0" class="known"/>
<rect width="42.95" height="6" x="0" y="0" class="decompiled"/>
<rect width="686" height="6" x="42.95" y="0" class="known"/>
<rect width="4.98" height="6" x="728.95" y="0" class="todo"/>
<rect width="13.07" height="6" x="733.93" y="0" class="unused"/>
</g>
@ -470,7 +470,7 @@
<rect width="12" height="12" x="600" y="105" class="decompiled"><title>void __cdecl Lara_State_Walk(struct ITEM_INFO *item, struct COLL_INFO *coll);</title></rect>
<rect width="12" height="12" x="615" y="105" class="decompiled"><title>void __cdecl Lara_State_Run(struct ITEM_INFO *item, struct COLL_INFO *coll);</title></rect>
<rect width="12" height="12" x="630" y="105" class="decompiled"><title>void __cdecl Lara_State_Stop(struct ITEM_INFO *item, struct COLL_INFO *coll);</title></rect>
<rect width="12" height="12" x="645" y="105" class="known"><title>void __cdecl Lara_State_ForwardJump(struct ITEM_INFO *item, struct COLL_INFO *coll);</title></rect>
<rect width="12" height="12" x="645" y="105" class="decompiled"><title>void __cdecl Lara_State_ForwardJump(struct ITEM_INFO *item, struct COLL_INFO *coll);</title></rect>
<rect width="12" height="12" x="660" y="105" class="known"><title>void __cdecl Lara_State_FastBack(struct ITEM_INFO *item, struct COLL_INFO *coll);</title></rect>
<rect width="12" height="12" x="675" y="105" class="known"><title>void __cdecl Lara_State_TurnRight(struct ITEM_INFO *item, struct COLL_INFO *coll);</title></rect>
<rect width="12" height="12" x="690" y="105" class="known"><title>void __cdecl Lara_State_TurnLeft(struct ITEM_INFO *item, struct COLL_INFO *coll);</title></rect>
@ -1281,10 +1281,10 @@
</g>
<g transform="translate(0 531)">
<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">4.09%</tspan> · <tspan class="known">95.58%</tspan> · <tspan class="todo">0.02%</tspan> · <tspan class="unused">0.31%</tspan></tspan></text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">4.16%</tspan> · <tspan class="known">95.51%</tspan> · <tspan class="todo">0.02%</tspan> · <tspan class="unused">0.31%</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="30.59" height="6" x="0" y="0" class="decompiled"/>
<rect width="713.95" height="6" x="30.59" y="0" class="known"/>
<rect width="31.06" height="6" x="0" y="0" class="decompiled"/>
<rect width="713.48" height="6" x="31.06" y="0" class="known"/>
<rect width="0.13" height="6" x="744.54" y="0" class="todo"/>
<rect width="2.33" height="6" x="744.67" y="0" class="unused"/>
</g>
@ -1710,7 +1710,7 @@
<rect width="9.70" height="10.50" x="661.81" y="119.75" class="known"><title>void __cdecl WinVidSetDisplayAdapter(DISPLAY_ADAPTER *dispAdapter);</title></rect>
<rect width="9.64" height="10.50" x="674.51" y="119.75" class="known"><title>void __cdecl LiftControl(int16_t item_num);</title></rect>
<rect width="9.58" height="10.50" x="687.15" y="119.75" class="known"><title>void __cdecl Output_InsertTransQuad(int32_t x, int32_t y, int32_t width, int32_t height, int32_t z);</title></rect>
<rect width="9.58" height="10.50" x="699.73" y="119.75" class="known"><title>void __cdecl Lara_State_ForwardJump(struct ITEM_INFO *item, struct COLL_INFO *coll);</title></rect>
<rect width="9.58" height="10.50" x="699.73" y="119.75" class="decompiled"><title>void __cdecl Lara_State_ForwardJump(struct ITEM_INFO *item, struct COLL_INFO *coll);</title></rect>
<rect width="9.58" height="10.50" x="712.31" y="119.75" class="known"><title>void __cdecl DoFlareInHand(int32_t flare_age);</title></rect>
<rect width="9.58" height="10.50" x="724.90" y="119.75" class="known"><title>void __cdecl CreateWindowPalette(void);</title></rect>
<rect width="9.52" height="10.50" x="737.48" y="119.75" class="known"><title>bool __cdecl Output_XGenX(int16_t *obj_ptr);</title></rect>

Before

Width:  |  Height:  |  Size: 357 KiB

After

Width:  |  Height:  |  Size: 357 KiB

View File

@ -1016,6 +1016,14 @@ typedef enum LARA_STATE {
LS_LAST = 77,
} LARA_STATE;
typedef enum LARA_GUN_STATE {
LGS_ARMLESS = 0,
LGS_HANDS_BUSY = 1,
LGS_DRAW = 2,
LGS_UNDRAW = 3,
LGS_READY = 4,
} LARA_GUN_STATE;
# FUNCTIONS
# Flags:
# - to do
@ -1470,7 +1478,7 @@ typedef enum LARA_STATE {
004278A0 0000008B + void __cdecl Lara_State_Walk(struct ITEM_INFO *item, struct COLL_INFO *coll);
00427930 00000143 + void __cdecl Lara_State_Run(struct ITEM_INFO *item, struct COLL_INFO *coll);
00427A80 00000148 + void __cdecl Lara_State_Stop(struct ITEM_INFO *item, struct COLL_INFO *coll);
00427BD0 000000D3 - void __cdecl Lara_State_ForwardJump(struct ITEM_INFO *item, struct COLL_INFO *coll);
00427BD0 000000D3 + void __cdecl Lara_State_ForwardJump(struct ITEM_INFO *item, struct COLL_INFO *coll);
00427CB0 00000057 - void __cdecl Lara_State_FastBack(struct ITEM_INFO *item, struct COLL_INFO *coll);
00427D10 0000008A - void __cdecl Lara_State_TurnRight(struct ITEM_INFO *item, struct COLL_INFO *coll);
00427DA0 00000089 - void __cdecl Lara_State_TurnLeft(struct ITEM_INFO *item, struct COLL_INFO *coll);

View File

@ -140,3 +140,36 @@ void __cdecl Lara_State_Stop(struct ITEM_INFO *item, struct COLL_INFO *coll)
}
}
}
void __cdecl Lara_State_ForwardJump(
struct ITEM_INFO *item, struct COLL_INFO *coll)
{
if (item->goal_anim_state == LS_SWAN_DIVE
|| item->goal_anim_state == LS_REACH) {
item->goal_anim_state = LS_FORWARD_JUMP;
}
if (item->goal_anim_state != LS_DEATH && item->goal_anim_state != LS_STOP
&& item->goal_anim_state != LS_RUN) {
if ((g_Input & IN_ACTION) && g_Lara.gun_status == LGS_ARMLESS) {
item->goal_anim_state = LS_REACH;
}
if ((g_Input & IN_ROLL) || (g_Input & IN_BACK)) {
item->goal_anim_state = LS_TWIST;
}
if ((g_Input & IN_SLOW) && g_Lara.gun_status == LGS_ARMLESS) {
item->goal_anim_state = LS_SWAN_DIVE;
}
if (item->fall_speed > LARA_FAST_FALL_SPEED) {
item->goal_anim_state = LS_FAST_FALL;
}
}
if (g_Input & IN_LEFT) {
g_Lara.turn_rate -= LARA_TURN_RATE;
CLAMPL(g_Lara.turn_rate, -LARA_JUMP_TURN);
} else if (g_Input & IN_RIGHT) {
g_Lara.turn_rate += LARA_TURN_RATE;
CLAMPG(g_Lara.turn_rate, +LARA_JUMP_TURN);
}
}

View File

@ -7,3 +7,5 @@
void __cdecl Lara_State_Walk(struct ITEM_INFO *item, struct COLL_INFO *coll);
void __cdecl Lara_State_Run(struct ITEM_INFO *item, struct COLL_INFO *coll);
void __cdecl Lara_State_Stop(struct ITEM_INFO *item, struct COLL_INFO *coll);
void __cdecl Lara_State_ForwardJump(
struct ITEM_INFO *item, struct COLL_INFO *coll);

View File

@ -24,6 +24,7 @@
#define MAX_AUDIO_SAMPLE_BUFFERS 256
#define MAX_AUDIO_SAMPLE_TRACKS 32
#define FAST_FALL_SPEED 128
#define LARA_TURN_UNDO (2 * PHD_DEGREE) // = 364
#define LARA_TURN_RATE ((PHD_DEGREE / 4) + LARA_TURN_UNDO) // = 409
#define LARA_SLOW_TURN ((PHD_DEGREE * 2) + LARA_TURN_UNDO) // = 728
@ -31,3 +32,5 @@
#define LARA_LEAN_UNDO PHD_DEGREE
#define LARA_LEAN_RATE 273
#define LARA_LEAN_MAX ((10 * PHD_DEGREE) + LARA_LEAN_UNDO) // = 2002
#define LARA_JUMP_TURN ((PHD_DEGREE * 1) + LARA_TURN_UNDO) // = 546
#define LARA_FAST_FALL_SPEED (FAST_FALL_SPEED + 3) // = 131

View File

@ -373,7 +373,6 @@
#define Lara_LookUpDown ((void __cdecl (*)(void))0x00427720)
#define Lara_LookLeftRight ((void __cdecl (*)(void))0x00427790)
#define Lara_ResetLook ((void __cdecl (*)(void))0x00427810)
#define Lara_State_ForwardJump ((void __cdecl (*)(struct ITEM_INFO *item, struct COLL_INFO *coll))0x00427BD0)
#define Lara_State_FastBack ((void __cdecl (*)(struct ITEM_INFO *item, struct COLL_INFO *coll))0x00427CB0)
#define Lara_State_TurnRight ((void __cdecl (*)(struct ITEM_INFO *item, struct COLL_INFO *coll))0x00427D10)
#define Lara_State_TurnLeft ((void __cdecl (*)(struct ITEM_INFO *item, struct COLL_INFO *coll))0x00427DA0)

View File

@ -1059,3 +1059,11 @@ typedef enum LARA_STATE {
LS_MONKEYF = 76,
LS_LAST = 77,
} LARA_STATE;
typedef enum LARA_GUN_STATE {
LGS_ARMLESS = 0,
LGS_HANDS_BUSY = 1,
LGS_DRAW = 2,
LGS_UNDRAW = 3,
LGS_READY = 4,
} LARA_GUN_STATE;

View File

@ -85,6 +85,7 @@ static void Inject_Lara_State(void)
INJECT(1, 0x004278A0, Lara_State_Walk);
INJECT(1, 0x00427930, Lara_State_Run);
INJECT(1, 0x00427A80, Lara_State_Stop);
INJECT(1, 0x00427BD0, Lara_State_ForwardJump);
}
static void Inject_S_Audio_Sample(void)