port Inv_Ring_DoMotions

This commit is contained in:
Marcin Kurczewski 2024-09-05 16:43:33 +02:00
parent ca97b93fc0
commit e950528f9c
No known key found for this signature in database
GPG Key ID: CC65E6FD28CAE42A
7 changed files with 99 additions and 30 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">59.36% (723)</tspan> · <tspan class="known">38.18% (465)</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">59.44% (724)</tspan> · <tspan class="known">38.10% (464)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="443.42" height="6" x="0" y="0" class="decompiled"/>
<rect width="285.18" height="6" x="443.42" y="0" class="known"/>
<rect width="444.03" height="6" x="0" y="0" class="decompiled"/>
<rect width="284.57" height="6" x="444.03" y="0" class="known"/>
<rect width="18.40" height="6" x="728.60" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -426,7 +426,7 @@
<rect width="12" height="12" x="705" y="90" class="decompiled"><title>void __cdecl Inv_Ring_GetView(RING_INFO *ring, PHD_3DPOS *viewer);</title></rect>
<rect width="12" height="12" x="720" y="90" class="decompiled"><title>void __cdecl Inv_Ring_Light(RING_INFO *ring);</title></rect>
<rect width="12" height="12" x="735" y="90" class="decompiled"><title>void __cdecl Inv_Ring_CalcAdders(RING_INFO *ring, int16_t rotation_duration);</title></rect>
<rect width="12" height="12" x="0" y="105" class="known"><title>void __cdecl Inv_Ring_DoMotions(RING_INFO *ring);</title></rect>
<rect width="12" height="12" x="0" y="105" class="decompiled"><title>void __cdecl Inv_Ring_DoMotions(RING_INFO *ring);</title></rect>
<rect width="12" height="12" x="15" y="105" class="known"><title>void __cdecl Inv_Ring_RotateLeft(RING_INFO *ring);</title></rect>
<rect width="12" height="12" x="30" y="105" class="known"><title>void __cdecl Inv_Ring_RotateRight(RING_INFO *ring);</title></rect>
<rect width="12" height="12" x="45" y="105" class="known"><title>void __cdecl Inv_Ring_MotionInit(RING_INFO *ring, int16_t frames, int16_t status, int16_t status_target);</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">63.90%</tspan> · <tspan class="known">35.77%</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">63.99%</tspan> · <tspan class="known">35.68%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="477.32" height="6" x="0" y="0" class="decompiled"/>
<rect width="267.23" height="6" x="477.32" y="0" class="known"/>
<rect width="478.02" height="6" x="0" y="0" class="decompiled"/>
<rect width="266.54" height="6" x="478.02" y="0" class="known"/>
<rect width="2.44" height="6" x="744.56" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -1597,7 +1597,7 @@
<rect width="13.48" height="13.11" x="448.61" y="92.72" class="decompiled"><title>void __cdecl Output_DrawClippedPoly_Textured(int32_t vtx_count);</title></rect>
<rect width="13.48" height="13.11" x="448.61" y="108.84" class="known"><title>void __cdecl DoSnowEffect(ITEM_INFO *skidoo);</title></rect>
<rect width="13.48" height="13.06" x="448.61" y="124.95" class="decompiled"><title>void __cdecl Lara_UseItem(GAME_OBJECT_ID object_num);</title></rect>
<rect width="13.48" height="13.01" x="448.61" y="141.01" class="known"><title>void __cdecl Inv_Ring_DoMotions(RING_INFO *ring);</title></rect>
<rect width="13.48" height="13.01" x="448.61" y="141.01" class="decompiled"><title>void __cdecl Inv_Ring_DoMotions(RING_INFO *ring);</title></rect>
<rect width="13.48" height="13.01" x="448.61" y="157.03" class="known"><title>void __cdecl DartEmitterControl(int16_t item_num);</title></rect>
<rect width="13.48" height="12.96" x="448.61" y="173.04" class="decompiled"><title>void __cdecl Output_InsertTransQuad_Sorted(int32_t x, int32_t y, int32_t width, int32_t height, int32_t z);</title></rect>
<rect width="13.48" height="12.96" x="448.61" y="189.01" class="known"><title>void __cdecl WaterFall(int16_t fx_num);</title></rect>

Before

Width:  |  Height:  |  Size: 364 KiB

After

Width:  |  Height:  |  Size: 364 KiB

View File

@ -762,20 +762,20 @@ typedef struct __unaligned {
int16_t status_target;
int16_t radius_target;
int16_t radius_rate;
int16_t camera_ytarget;
int16_t camera_yrate;
int16_t camera_y_target;
int16_t camera_y_rate;
int16_t camera_pitch_target;
int16_t camera_pitch_rate;
int16_t rotate_target;
int16_t rotate_rate;
int16_t item_ptxrot_target;
int16_t item_ptxrot_rate;
int16_t item_xrot_target;
int16_t item_xrot_rate;
int32_t item_ytrans_target;
int32_t item_ytrans_rate;
int32_t item_ztrans_target;
int32_t item_ztrans_rate;
int16_t item_pt_x_rot_target;
int16_t item_pt_x_rot_rate;
int16_t item_x_rot_target;
int16_t item_x_rot_rate;
int32_t item_y_trans_target;
int32_t item_y_trans_rate;
int32_t item_z_trans_target;
int32_t item_z_trans_rate;
int32_t misc;
} IMOTION_INFO;
@ -3224,7 +3224,7 @@ typedef enum {
0x00425110 0x0060 + void __cdecl Inv_Ring_GetView(RING_INFO *ring, PHD_3DPOS *viewer);
0x00425170 0x0040 + void __cdecl Inv_Ring_Light(RING_INFO *ring);
0x004251B0 0x002C + void __cdecl Inv_Ring_CalcAdders(RING_INFO *ring, int16_t rotation_duration);
0x004251E0 0x013E - void __cdecl Inv_Ring_DoMotions(RING_INFO *ring);
0x004251E0 0x013E + void __cdecl Inv_Ring_DoMotions(RING_INFO *ring);
0x00425320 0x002F - void __cdecl Inv_Ring_RotateLeft(RING_INFO *ring);
0x00425350 0x002F - void __cdecl Inv_Ring_RotateRight(RING_INFO *ring);
0x00425380 0x0063 - void __cdecl Inv_Ring_MotionInit(RING_INFO *ring, int16_t frames, int16_t status, int16_t status_target);

View File

@ -96,3 +96,71 @@ void __cdecl Inv_Ring_CalcAdders(
ring->rot_adder_l = ring->angle_adder / rotation_duration;
ring->rot_adder_r = -ring->angle_adder / rotation_duration;
}
void __cdecl Inv_Ring_DoMotions(RING_INFO *const ring)
{
IMOTION_INFO *const imo = ring->imo;
if (imo->count != 0) {
ring->radius += imo->radius_rate;
ring->camera.pos.y += imo->camera_y_rate;
ring->ring_pos.rot.y += imo->rotate_rate;
ring->camera_pitch += imo->camera_pitch_rate;
INVENTORY_ITEM *const inv_item = ring->list[ring->current_object];
inv_item->x_rot_pt += imo->item_pt_x_rot_rate;
inv_item->x_rot += imo->item_x_rot_rate;
inv_item->y_trans += imo->item_y_trans_rate;
inv_item->z_trans += imo->item_z_trans_rate;
imo->count--;
if (imo->count == 0) {
imo->status = imo->status_target;
if (imo->radius_rate != 0) {
imo->radius_rate = 0;
ring->radius = imo->radius_target;
}
if (imo->camera_y_rate != 0) {
imo->camera_y_rate = 0;
ring->camera.pos.y = imo->camera_y_target;
}
if (imo->rotate_rate != 0) {
imo->rotate_rate = 0;
ring->ring_pos.rot.y = imo->rotate_target;
}
if (imo->item_pt_x_rot_rate != 0) {
imo->item_pt_x_rot_rate = 0;
inv_item->x_rot_pt = imo->item_pt_x_rot_target;
}
if (imo->item_x_rot_rate != 0) {
imo->item_x_rot_rate = 0;
inv_item->x_rot = imo->item_x_rot_target;
}
if (imo->item_y_trans_rate != 0) {
imo->item_y_trans_rate = 0;
inv_item->y_trans = imo->item_y_trans_target;
}
if (imo->item_z_trans_rate != 0) {
imo->item_z_trans_rate = 0;
inv_item->z_trans = imo->item_z_trans_target;
}
if (imo->camera_pitch_rate != 0) {
imo->camera_pitch_rate = 0;
ring->camera_pitch = imo->camera_pitch_target;
}
}
}
if (ring->rotating) {
ring->ring_pos.rot.y += ring->rot_adder;
ring->rot_count--;
if (ring->rot_count == 0) {
ring->current_object = ring->target_object;
ring->ring_pos.rot.y =
-PHD_90 - ring->target_object * ring->angle_adder;
ring->rotating = 0;
}
}
}

View File

@ -8,3 +8,4 @@ void __cdecl Inv_Ring_Init(
void __cdecl Inv_Ring_GetView(const RING_INFO *ring, PHD_3DPOS *view);
void __cdecl Inv_Ring_Light(const RING_INFO *ring);
void __cdecl Inv_Ring_CalcAdders(RING_INFO *ring, int16_t rotation_duration);
void __cdecl Inv_Ring_DoMotions(RING_INFO *ring);

View File

@ -105,7 +105,6 @@
#define Inv_RemoveAllItems ((void __cdecl (*)(void))0x00424CB0)
#define Inv_RemoveItem ((int32_t __cdecl (*)(GAME_OBJECT_ID object_num))0x00424CD0)
#define RemoveInventoryText ((void __cdecl (*)(void))0x00424FD0)
#define Inv_Ring_DoMotions ((void __cdecl (*)(RING_INFO *ring))0x004251E0)
#define Inv_Ring_RotateLeft ((void __cdecl (*)(RING_INFO *ring))0x00425320)
#define Inv_Ring_RotateRight ((void __cdecl (*)(RING_INFO *ring))0x00425350)
#define Inv_Ring_MotionInit ((void __cdecl (*)(RING_INFO *ring, int16_t frames, int16_t status, int16_t status_target))0x00425380)

View File

@ -778,20 +778,20 @@ typedef struct __unaligned {
int16_t status_target;
int16_t radius_target;
int16_t radius_rate;
int16_t camera_ytarget;
int16_t camera_yrate;
int16_t camera_y_target;
int16_t camera_y_rate;
int16_t camera_pitch_target;
int16_t camera_pitch_rate;
int16_t rotate_target;
int16_t rotate_rate;
int16_t item_ptxrot_target;
int16_t item_ptxrot_rate;
int16_t item_xrot_target;
int16_t item_xrot_rate;
int32_t item_ytrans_target;
int32_t item_ytrans_rate;
int32_t item_ztrans_target;
int32_t item_ztrans_rate;
int16_t item_pt_x_rot_target;
int16_t item_pt_x_rot_rate;
int16_t item_x_rot_target;
int16_t item_x_rot_rate;
int32_t item_y_trans_target;
int32_t item_y_trans_rate;
int32_t item_z_trans_target;
int32_t item_z_trans_rate;
int32_t misc;
} IMOTION_INFO;

View File

@ -626,6 +626,7 @@ static void Inject_Inventory(const bool enable)
INJECT(enable, 0x00425110, Inv_Ring_GetView);
INJECT(enable, 0x00425170, Inv_Ring_Light);
INJECT(enable, 0x004251B0, Inv_Ring_CalcAdders);
INJECT(enable, 0x004251E0, Inv_Ring_DoMotions);
}
static void Inject_Lara_Control(const bool enable)