mirror of
https://github.com/LostArtefacts/TR2X.git
synced 2024-12-03 11:30:56 +00:00
port Boat_Animation
This commit is contained in:
parent
94b41abb05
commit
fe73c9739a
@ -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.75% (545)</tspan> · <tspan class="known">52.79% (643)</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.83% (546)</tspan> · <tspan class="known">52.71% (642)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
|
||||
<g transform="translate(0 20)">
|
||||
<rect width="334.25" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="394.35" height="6" x="334.25" y="0" class="known"/>
|
||||
<rect width="334.86" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="393.74" height="6" x="334.86" y="0" class="known"/>
|
||||
<rect width="18.40" height="6" x="728.60" y="0" class="unused"/>
|
||||
</g>
|
||||
<g transform="translate(0 31)">
|
||||
@ -171,7 +171,7 @@
|
||||
<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="decompiled"><title>int32_t __cdecl Boat_Dynamics(int16_t boat_num);</title></rect>
|
||||
<rect width="12" height="12" x="660" y="15" class="decompiled"><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>
|
||||
<rect width="12" height="12" x="675" y="15" class="decompiled"><title>void __cdecl Boat_Animation(ITEM_INFO *boat, int32_t collide);</title></rect>
|
||||
<rect width="12" height="12" x="690" y="15" class="known"><title>void __cdecl Boat_Control(int16_t item_num);</title></rect>
|
||||
<rect width="12" height="12" x="705" y="15" class="known"><title>void __cdecl Gondola_Control(int16_t item_num);</title></rect>
|
||||
<rect width="12" height="12" x="720" y="15" class="decompiled"><title>void __cdecl Creature_Initialise(int16_t item_num);</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">41.05%</tspan> · <tspan class="known">58.63%</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">41.15%</tspan> · <tspan class="known">58.52%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
|
||||
<g transform="translate(0 20)">
|
||||
<rect width="306.61" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="437.95" height="6" x="306.61" y="0" class="known"/>
|
||||
<rect width="307.40" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="437.16" height="6" x="307.40" y="0" class="known"/>
|
||||
<rect width="2.44" height="6" x="744.56" y="0" class="unused"/>
|
||||
</g>
|
||||
<g transform="translate(0 31)">
|
||||
@ -1565,7 +1565,7 @@
|
||||
<rect width="15" height="13.84" x="502.85" y="59.39" class="decompiled"><title>const int16_t *__cdecl Output_CalcVerticeLight(const int16_t *obj_ptr);</title></rect>
|
||||
<rect width="15" height="13.84" x="520.84" y="59.39" class="decompiled"><title>int32_t __cdecl Lara_TestHangJumpUp(ITEM_INFO *item, COLL_INFO *coll);</title></rect>
|
||||
<rect width="14.95" height="13.84" x="538.84" y="59.39" class="decompiled"><title>void __cdecl HWR_DrawPolyList(void);</title></rect>
|
||||
<rect width="14.80" height="13.84" x="556.78" y="59.39" class="known"><title>void __cdecl Boat_Animation(ITEM_INFO *boat, int32_t collide);</title></rect>
|
||||
<rect width="14.80" height="13.84" x="556.78" y="59.39" class="decompiled"><title>void __cdecl Boat_Animation(ITEM_INFO *boat, int32_t collide);</title></rect>
|
||||
<rect width="14.80" height="13.84" x="574.58" y="59.39" class="known"><title>void __cdecl draw_flare(void);</title></rect>
|
||||
<rect width="14.75" height="13.84" x="592.38" y="59.39" class="known"><title>int32_t __cdecl Room_GetWaterHeight(int32_t x, int32_t y, int32_t z, int16_t room_num);</title></rect>
|
||||
<rect width="14.70" height="13.84" x="610.13" y="59.39" class="known"><title>void __cdecl RingIsOpen(RING_INFO *ring);</title></rect>
|
||||
|
Before Width: | Height: | Size: 361 KiB After Width: | Height: | Size: 361 KiB |
@ -2200,7 +2200,7 @@ typedef struct {
|
||||
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);
|
||||
0x0040D950 0x0169 + void __cdecl Boat_Animation(ITEM_INFO *boat, int32_t collide);
|
||||
0x0040DAC0 0x062A - void __cdecl Boat_Control(int16_t item_num);
|
||||
0x0040E0F0 0x00B3 - void __cdecl Gondola_Control(int16_t item_num);
|
||||
|
||||
|
@ -10,10 +10,13 @@
|
||||
#include "global/vars.h"
|
||||
#include "util.h"
|
||||
|
||||
#define BOAT_FALL_ANIM 15
|
||||
#define BOAT_DEATH_ANIM 18
|
||||
#define BOAT_GETON_LW_ANIM 0
|
||||
#define BOAT_GETON_RW_ANIM 8
|
||||
#define BOAT_GETON_J_ANIM 6
|
||||
#define BOAT_GETON_START 1
|
||||
|
||||
#define BOAT_RADIUS 500
|
||||
#define BOAT_SIDE 300
|
||||
#define BOAT_FRONT 750
|
||||
@ -32,6 +35,17 @@
|
||||
#define BOAT_TURN (PHD_DEGREE / 8) // = 22
|
||||
#define BOAT_MAX_TURN (PHD_DEGREE * 4) // = 728
|
||||
|
||||
typedef enum {
|
||||
BOAT_GETON = 0,
|
||||
BOAT_STILL = 1,
|
||||
BOAT_MOVING = 2,
|
||||
BOAT_JUMP_R = 3,
|
||||
BOAT_JUMP_L = 4,
|
||||
BOAT_HIT = 5,
|
||||
BOAT_FALL = 6,
|
||||
BOAT_DEATH = 8,
|
||||
} BOAT_ANIM;
|
||||
|
||||
typedef enum {
|
||||
GONDOLA_EMPTY = 0,
|
||||
GONDOLA_FLOATING = 1,
|
||||
@ -524,3 +538,74 @@ int32_t __cdecl Boat_UserControl(ITEM_INFO *const boat)
|
||||
|
||||
return no_turn;
|
||||
}
|
||||
|
||||
void __cdecl Boat_Animation(const ITEM_INFO *const boat, const int32_t collide)
|
||||
{
|
||||
ITEM_INFO *const lara = g_LaraItem;
|
||||
const BOAT_INFO *const boat_data = (const BOAT_INFO *)boat->data;
|
||||
|
||||
if (lara->hit_points <= 0) {
|
||||
if (lara->current_anim_state == BOAT_DEATH) {
|
||||
return;
|
||||
}
|
||||
lara->anim_num = g_Objects[O_LARA_BOAT].anim_idx + BOAT_DEATH_ANIM;
|
||||
lara->frame_num = g_Anims[lara->anim_num].frame_base;
|
||||
lara->goal_anim_state = BOAT_DEATH;
|
||||
lara->current_anim_state = BOAT_DEATH;
|
||||
return;
|
||||
}
|
||||
|
||||
if (boat->pos.y < boat_data->water - STEP_L / 2 && boat->fall_speed > 0) {
|
||||
if (lara->current_anim_state == BOAT_FALL) {
|
||||
return;
|
||||
}
|
||||
lara->anim_num = g_Objects[O_LARA_BOAT].anim_idx + BOAT_FALL_ANIM;
|
||||
lara->frame_num = g_Anims[lara->anim_num].frame_base;
|
||||
lara->goal_anim_state = BOAT_FALL;
|
||||
lara->current_anim_state = BOAT_FALL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (collide) {
|
||||
if (lara->current_anim_state == BOAT_HIT) {
|
||||
return;
|
||||
}
|
||||
lara->anim_num = g_Objects[O_LARA_BOAT].anim_idx + collide;
|
||||
lara->frame_num = g_Anims[lara->anim_num].frame_base;
|
||||
lara->goal_anim_state = BOAT_HIT;
|
||||
lara->current_anim_state = BOAT_HIT;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (lara->current_anim_state) {
|
||||
case BOAT_STILL:
|
||||
if (g_Input & IN_JUMP) {
|
||||
if (g_Input & IN_RIGHT) {
|
||||
lara->goal_anim_state = BOAT_JUMP_R;
|
||||
} else if (g_Input & IN_LEFT) {
|
||||
lara->goal_anim_state = BOAT_JUMP_L;
|
||||
}
|
||||
}
|
||||
|
||||
if (boat->speed > 0) {
|
||||
lara->goal_anim_state = BOAT_MOVING;
|
||||
}
|
||||
break;
|
||||
|
||||
case BOAT_MOVING:
|
||||
if (g_Input & IN_JUMP) {
|
||||
if (g_Input & IN_RIGHT) {
|
||||
lara->goal_anim_state = BOAT_JUMP_R;
|
||||
} else if (g_Input & IN_LEFT) {
|
||||
lara->goal_anim_state = BOAT_JUMP_L;
|
||||
}
|
||||
} else if (boat->speed <= 0) {
|
||||
lara->goal_anim_state = BOAT_STILL;
|
||||
}
|
||||
break;
|
||||
|
||||
case BOAT_FALL:
|
||||
lara->goal_anim_state = BOAT_MOVING;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -14,3 +14,4 @@ void __cdecl Boat_DoWakeEffect(const ITEM_INFO *boat);
|
||||
int32_t __cdecl Boat_DoDynamics(int32_t height, int32_t fall_speed, int32_t *y);
|
||||
int32_t __cdecl Boat_Dynamics(int16_t boat_num);
|
||||
int32_t __cdecl Boat_UserControl(ITEM_INFO *boat);
|
||||
void __cdecl Boat_Animation(const ITEM_INFO *boat, int32_t collide);
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
// clang-format off
|
||||
#define Output_InsertInventoryBackground ((void __cdecl (*)(const int16_t *obj_ptr))0x00401D50)
|
||||
#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 Collide_GetCollisionInfo ((void __cdecl (*)(COLL_INFO *coll, int32_t xpos, int32_t ypos, int32_t zpos, int16_t room_num, int32_t obj_height))0x004128F0)
|
||||
|
@ -670,6 +670,7 @@ static void Inject_Objects(const bool enable)
|
||||
INJECT(enable, 0x0040D290, Boat_DoDynamics);
|
||||
INJECT(enable, 0x0040D2E0, Boat_Dynamics);
|
||||
INJECT(enable, 0x0040D7C0, Boat_UserControl);
|
||||
INJECT(enable, 0x0040D950, Boat_Animation);
|
||||
}
|
||||
|
||||
static void Inject_S_Audio_Sample(const bool enable)
|
||||
|
Loading…
Reference in New Issue
Block a user