port Boat_DoDynamics

This commit is contained in:
Marcin Kurczewski 2024-07-16 11:46:33 +02:00
parent 4abc4266ac
commit fa52661039
No known key found for this signature in database
GPG Key ID: CC65E6FD28CAE42A
6 changed files with 31 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">44.50% (542)</tspan> · <tspan class="known">53.04% (646)</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">44.58% (543)</tspan> · <tspan class="known">52.96% (645)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="332.41" height="6" x="0" y="0" class="decompiled"/>
<rect width="396.19" height="6" x="332.41" y="0" class="known"/>
<rect width="333.02" height="6" x="0" y="0" class="decompiled"/>
<rect width="395.58" height="6" x="333.02" y="0" class="known"/>
<rect width="18.40" height="6" x="728.60" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -168,7 +168,7 @@
<rect width="12" height="12" x="585" y="15" class="decompiled"><title>int32_t __cdecl Boat_TestWaterHeight(ITEM_INFO *item, int32_t z_off, int32_t x_off, XYZ_32 *pos);</title></rect>
<rect width="12" height="12" x="600" y="15" class="decompiled"><title>void __cdecl Boat_DoShift(int32_t boat_num);</title></rect>
<rect width="12" height="12" x="615" y="15" class="decompiled"><title>void __cdecl Boat_DoWakeEffect(ITEM_INFO *boat);</title></rect>
<rect width="12" height="12" x="630" y="15" class="known"><title>int32_t __cdecl Boat_DoDynamics(int32_t height, int32_t fall_speed, int32_t *y);</title></rect>
<rect width="12" height="12" x="630" y="15" class="decompiled"><title>int32_t __cdecl Boat_DoDynamics(int32_t height, int32_t fall_speed, int32_t *y);</title></rect>
<rect width="12" height="12" x="645" y="15" class="known"><title>int32_t __cdecl Boat_Dynamics(int16_t boat_num);</title></rect>
<rect width="12" height="12" x="660" y="15" class="known"><title>int32_t __cdecl Boat_UserControl(ITEM_INFO *boat);</title></rect>
<rect width="12" height="12" x="675" y="15" class="known"><title>void __cdecl Boat_Animation(ITEM_INFO *boat, int32_t collide);</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">40.55%</tspan> · <tspan class="known">59.13%</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">40.57%</tspan> · <tspan class="known">59.11%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="302.87" height="6" x="0" y="0" class="decompiled"/>
<rect width="441.69" height="6" x="302.87" y="0" class="known"/>
<rect width="303.04" height="6" x="0" y="0" class="decompiled"/>
<rect width="441.52" height="6" x="303.04" y="0" class="known"/>
<rect width="2.44" height="6" x="744.56" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -2114,7 +2114,7 @@
<rect width="4.73" height="5.16" x="703.94" y="253.38" class="decompiled"><title>void __cdecl Lara_State_Extra_Breath(ITEM_INFO *item, COLL_INFO *coll);</title></rect>
<rect width="4.73" height="5.16" x="711.67" y="253.38" class="known"><title>void __cdecl WriteSG(void *pointer, int32_t size);</title></rect>
<rect width="4.73" height="5.16" x="719.40" y="253.38" class="known"><title>void __cdecl GetSavedGamesList(REQUEST_INFO *req);</title></rect>
<rect width="4.63" height="5.16" x="727.12" y="253.38" class="known"><title>int32_t __cdecl Boat_DoDynamics(int32_t height, int32_t fall_speed, int32_t *y);</title></rect>
<rect width="4.63" height="5.16" x="727.12" y="253.38" class="decompiled"><title>int32_t __cdecl Boat_DoDynamics(int32_t height, int32_t fall_speed, int32_t *y);</title></rect>
<rect width="4.63" height="5.16" x="734.75" y="253.38" class="decompiled"><title>void __cdecl Lara_State_FastTurn(ITEM_INFO *item, COLL_INFO *coll);</title></rect>
<rect width="4.63" height="5.16" x="742.37" y="253.38" class="known"><title>void __cdecl set_flare_arm(int32_t frame);</title></rect>
<rect width="4.84" height="4.94" x="632.98" y="261.54" class="known"><title>void __cdecl DartEffectControl(int16_t fx_num);</title></rect>

Before

Width:  |  Height:  |  Size: 361 KiB

After

Width:  |  Height:  |  Size: 361 KiB

View File

@ -2197,7 +2197,7 @@ typedef struct {
0x0040CE40 0x00F8 + int32_t __cdecl Boat_TestWaterHeight(ITEM_INFO *item, int32_t z_off, int32_t x_off, XYZ_32 *pos);
0x0040CF40 0x01C1 + void __cdecl Boat_DoShift(int32_t boat_num);
0x0040D110 0x0174 + void __cdecl Boat_DoWakeEffect(ITEM_INFO *boat);
0x0040D290 0x004B - int32_t __cdecl Boat_DoDynamics(int32_t height, int32_t fall_speed, int32_t *y);
0x0040D290 0x004B + int32_t __cdecl Boat_DoDynamics(int32_t height, int32_t fall_speed, int32_t *y);
0x0040D2E0 0x04DD - int32_t __cdecl Boat_Dynamics(int16_t boat_num);
0x0040D7C0 0x0187 - int32_t __cdecl Boat_UserControl(ITEM_INFO *boat);
0x0040D950 0x0169 - void __cdecl Boat_Animation(ITEM_INFO *boat, int32_t collide);

View File

@ -277,3 +277,23 @@ void __cdecl Boat_DoWakeEffect(const ITEM_INFO *const boat)
CLAMPL(fx->shade, 0);
}
}
int32_t __cdecl Boat_DoDynamics(
const int32_t height, int32_t fall_speed, int32_t *const y)
{
if (height > *y) {
*y = fall_speed + *y;
if (*y > height) {
*y = height;
fall_speed = 0;
} else {
fall_speed += GRAVITY;
}
} else {
fall_speed += ((height - fall_speed - *y) >> 3);
CLAMPL(fall_speed, -20);
CLAMPG(*y, height);
}
return fall_speed;
}

View File

@ -11,3 +11,4 @@ int32_t __cdecl Boat_TestWaterHeight(
const ITEM_INFO *item, int32_t z_off, int32_t x_off, XYZ_32 *pos);
void __cdecl Boat_DoShift(const int32_t boat_num);
void __cdecl Boat_DoWakeEffect(const ITEM_INFO *boat);
int32_t __cdecl Boat_DoDynamics(int32_t height, int32_t fall_speed, int32_t *y);

View File

@ -6,7 +6,6 @@
// clang-format off
#define Output_InsertInventoryBackground ((void __cdecl (*)(const int16_t *obj_ptr))0x00401D50)
#define Boat_DoDynamics ((int32_t __cdecl (*)(int32_t height, int32_t fall_speed, int32_t *y))0x0040D290)
#define Boat_Dynamics ((int32_t __cdecl (*)(int16_t boat_num))0x0040D2E0)
#define Boat_UserControl ((int32_t __cdecl (*)(ITEM_INFO *boat))0x0040D7C0)
#define Boat_Animation ((void __cdecl (*)(ITEM_INFO *boat, int32_t collide))0x0040D950)

View File

@ -667,6 +667,7 @@ static void Inject_Objects(const bool enable)
INJECT(enable, 0x0040CE40, Boat_TestWaterHeight);
INJECT(enable, 0x0040CF40, Boat_DoShift);
INJECT(enable, 0x0040D110, Boat_DoWakeEffect);
INJECT(enable, 0x0040D290, Boat_DoDynamics);
}
static void Inject_S_Audio_Sample(const bool enable)