port Creature_Underwater

This commit is contained in:
Marcin Kurczewski 2024-04-16 17:59:10 +02:00
parent e420e26e17
commit af14243414
No known key found for this signature in database
GPG Key ID: CC65E6FD28CAE42A
6 changed files with 27 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">35.47% (432)</tspan> · <tspan class="known">62.07% (756)</tspan> · <tspan class="todo">0.41% (5)</tspan> · <tspan class="unused">2.05% (25)</tspan></tspan></text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">35.55% (433)</tspan> · <tspan class="known">61.99% (755)</tspan> · <tspan class="todo">0.41% (5)</tspan> · <tspan class="unused">2.05% (25)</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="264.95" height="6" x="0" y="0" class="decompiled"/>
<rect width="463.66" height="6" x="264.95" y="0" class="known"/>
<rect width="265.56" height="6" x="0" y="0" class="decompiled"/>
<rect width="463.04" height="6" x="265.56" y="0" class="known"/>
<rect width="3.07" height="6" x="728.60" y="0" class="todo"/>
<rect width="15.33" height="6" x="731.67" y="0" class="unused"/>
</g>
@ -195,7 +195,7 @@
<rect width="12" height="12" x="225" y="30" class="decompiled"><title>void __cdecl Creature_Head(ITEM_INFO *item, int16_t required);</title></rect>
<rect width="12" height="12" x="240" y="30" class="decompiled"><title>void __cdecl Creature_Neck(ITEM_INFO *item, int16_t required);</title></rect>
<rect width="12" height="12" x="255" y="30" class="decompiled"><title>void __cdecl Creature_Float(int16_t item_num);</title></rect>
<rect width="12" height="12" x="270" y="30" class="known"><title>void __cdecl Creature_Underwater(ITEM_INFO *item, int32_t depth);</title></rect>
<rect width="12" height="12" x="270" y="30" class="decompiled"><title>void __cdecl Creature_Underwater(ITEM_INFO *item, int32_t depth);</title></rect>
<rect width="12" height="12" x="285" y="30" class="known"><title>int16_t __cdecl Creature_Effect(ITEM_INFO *item, BITE_INFO *bite, int16_t (*spawn)(int32_t x, int32_t y, int32_t z, int16_t speed, int16_t y_rot, int16_t room_num));</title></rect>
<rect width="12" height="12" x="300" y="30" class="known"><title>int32_t __cdecl Creature_Vault(int16_t item_num, int16_t angle, int32_t vault, int32_t shift);</title></rect>
<rect width="12" height="12" x="315" y="30" class="known"><title>void __cdecl Creature_Kill(ITEM_INFO *item, int32_t kill_anim, int32_t kill_state, int32_t lara_kill_state);</title></rect>
@ -1299,10 +1299,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">32.25%</tspan> · <tspan class="known">67.42%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.32%</tspan></tspan></text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">32.27%</tspan> · <tspan class="known">67.40%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.32%</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="240.90" height="6" x="0" y="0" class="decompiled"/>
<rect width="503.66" height="6" x="240.90" y="0" class="known"/>
<rect width="241.07" height="6" x="0" y="0" class="decompiled"/>
<rect width="503.49" height="6" x="241.07" y="0" class="known"/>
<rect width="0.10" height="6" x="744.56" y="0" class="todo"/>
<rect width="2.40" height="6" x="744.60" y="0" class="unused"/>
</g>
@ -2095,7 +2095,7 @@
<rect width="4.97" height="5.43" x="625.01" y="278.68" class="decompiled"><title>void __cdecl Music_Shutdown(void);</title></rect>
<rect width="4.97" height="5.43" x="625.01" y="287.11" class="known"><title>bool __cdecl TIME_Init(void);</title></rect>
<rect width="4.97" height="5.43" x="625.01" y="295.54" class="known"><title>LPCTSTR __cdecl GuidBinaryToString(GUID *guid);</title></rect>
<rect width="4.97" height="5.33" x="625.01" y="303.98" class="known"><title>void __cdecl Creature_Underwater(ITEM_INFO *item, int32_t depth);</title></rect>
<rect width="4.97" height="5.33" x="625.01" y="303.98" class="decompiled"><title>void __cdecl Creature_Underwater(ITEM_INFO *item, int32_t depth);</title></rect>
<rect width="4.97" height="5.33" x="625.01" y="312.30" class="decompiled"><title>const FLOOR_INFO *__cdecl Camera_GoodPosition(int32_t x, int32_t y, int32_t z, int16_t room_num);</title></rect>
<rect width="4.97" height="5.33" x="625.01" y="320.63" class="known"><title>void __cdecl InitialiseCult3(int16_t item_num);</title></rect>
<rect width="4.97" height="5.22" x="625.01" y="328.96" class="known"><title>void __cdecl set_arm_info(LARA_ARM *arm, int32_t frame);</title></rect>

Before

Width:  |  Height:  |  Size: 359 KiB

After

Width:  |  Height:  |  Size: 359 KiB

View File

@ -1808,7 +1808,7 @@ typedef struct {
0040FF10 00000049 + void __cdecl Creature_Head(ITEM_INFO *item, int16_t required);
0040FF60 0000004E + void __cdecl Creature_Neck(ITEM_INFO *item, int16_t required);
0040FFB0 000000A8 + void __cdecl Creature_Float(int16_t item_num);
00410060 00000050 - void __cdecl Creature_Underwater(ITEM_INFO *item, int32_t depth);
00410060 00000050 + void __cdecl Creature_Underwater(ITEM_INFO *item, int32_t depth);
004100B0 0000005C - int16_t __cdecl Creature_Effect(ITEM_INFO *item, BITE_INFO *bite, int16_t (*spawn)(int32_t x, int32_t y, int32_t z, int16_t speed, int16_t y_rot, int16_t room_num));
00410110 00000131 - int32_t __cdecl Creature_Vault(int16_t item_num, int16_t angle, int32_t vault, int32_t shift);
00410250 0000016F - void __cdecl Creature_Kill(ITEM_INFO *item, int32_t kill_anim, int32_t kill_state, int32_t lara_kill_state);

View File

@ -677,3 +677,19 @@ void __cdecl Creature_Float(const int16_t item_num)
Item_NewRoom(item_num, room_num);
}
}
void __cdecl Creature_Underwater(ITEM_INFO *const item, const int32_t depth)
{
const int32_t wh = Room_GetWaterHeight(
item->pos.x, item->pos.y, item->pos.z, item->room_num);
if (item->pos.y >= wh + depth) {
return;
}
item->pos.y = wh + depth;
if (item->rot.x > 2 * PHD_DEGREE) {
item->rot.x -= 2 * PHD_DEGREE;
} else {
CLAMPG(item->rot.x, 0);
}
}

View File

@ -17,3 +17,4 @@ void __cdecl Creature_Tilt(ITEM_INFO *item, int16_t angle);
void __cdecl Creature_Head(ITEM_INFO *item, int16_t required);
void __cdecl Creature_Neck(ITEM_INFO *item, int16_t required);
void __cdecl Creature_Float(int16_t item_num);
void __cdecl Creature_Underwater(ITEM_INFO *item, int32_t depth);

View File

@ -18,7 +18,6 @@
#define Boat_Animation ((void __cdecl (*)(ITEM_INFO *boat, int32_t collide))0x0040D950)
#define Boat_Control ((void __cdecl (*)(int16_t item_num))0x0040DAC0)
#define Gondola_Control ((void __cdecl (*)(int16_t item_num))0x0040E0F0)
#define Creature_Underwater ((void __cdecl (*)(ITEM_INFO *item, int32_t depth))0x00410060)
#define Creature_Effect ((int16_t __cdecl (*)(ITEM_INFO *item, BITE_INFO *bite, int16_t (*spawn)(int32_t x, int32_t y, int32_t z, int16_t speed, int16_t y_rot, int16_t room_num)))0x004100B0)
#define Creature_Vault ((int32_t __cdecl (*)(int16_t item_num, int16_t angle, int32_t vault, int32_t shift))0x00410110)
#define Creature_Kill ((void __cdecl (*)(ITEM_INFO *item, int32_t kill_anim, int32_t kill_state, int32_t lara_kill_state))0x00410250)

View File

@ -527,6 +527,7 @@ static void Inject_Creature(void)
INJECT(1, 0x0040FF10, Creature_Head);
INJECT(1, 0x0040FF60, Creature_Neck);
INJECT(1, 0x0040FFB0, Creature_Float);
INJECT(1, 0x00410060, Creature_Underwater);
}
static void Inject_Box(void)