sm64pc/src/game/behaviors/heave_ho.inc.c

125 lines
3.6 KiB
C
Raw Normal View History

2019-08-25 04:46:40 +00:00
// heave_ho.c.inc
s16 D_8032F460[][2] = { { 30, 0 }, { 42, 1 }, { 52, 0 }, { 64, 1 }, { 74, 0 },
2019-10-05 19:08:05 +00:00
{ 86, 1 }, { 96, 0 }, { 108, 1 }, { 118, 0 }, { -1, 0 }, };
2019-08-25 04:46:40 +00:00
void bhv_heave_ho_throw_mario_loop(void) {
o->oParentRelativePosX = 200.0f;
o->oParentRelativePosY = -50.0f;
o->oParentRelativePosZ = 0.0f;
o->oMoveAngleYaw = o->parentObj->oMoveAngleYaw;
2019-10-05 19:08:05 +00:00
switch (o->parentObj->oHeaveHoUnk88) {
2019-08-25 04:46:40 +00:00
case 0:
break;
case 1:
break;
case 2:
2020-03-02 03:42:52 +00:00
cur_obj_play_sound_2(SOUND_OBJ_HEAVEHO_TOSSED);
2019-08-25 04:46:40 +00:00
gMarioObject->oInteractStatus |= INT_STATUS_MARIO_UNK2;
gMarioStates->forwardVel = -45.0f;
gMarioStates->vel[1] = 95.0f;
2019-10-05 19:08:05 +00:00
o->parentObj->oHeaveHoUnk88 = 0;
2019-08-25 04:46:40 +00:00
break;
}
}
2020-03-02 03:42:52 +00:00
void heave_ho_act_1(void) {
2019-08-25 04:46:40 +00:00
s32 sp1C = 0;
o->oForwardVel = 0.0f;
2020-03-02 03:42:52 +00:00
cur_obj_reverse_animation();
2019-08-25 04:46:40 +00:00
while (1) {
if (D_8032F460[sp1C][0] == -1) {
o->oAction = 2;
break;
}
if (o->oTimer < D_8032F460[sp1C][0]) {
2020-03-02 03:42:52 +00:00
cur_obj_init_animation_with_accel_and_sound(2, D_8032F460[sp1C][1]);
2019-08-25 04:46:40 +00:00
break;
}
sp1C++;
}
}
2020-03-02 03:42:52 +00:00
void heave_ho_act_2(void) {
2019-08-25 04:46:40 +00:00
UNUSED s32 unused;
s16 angleVel;
2020-03-02 03:42:52 +00:00
if (1000.0f < cur_obj_lateral_dist_from_mario_to_home())
o->oAngleToMario = cur_obj_angle_to_home();
2019-08-25 04:46:40 +00:00
if (o->oTimer > 150) {
o->oHeaveHoUnkF4 = (302 - o->oTimer) / 152.0f;
if (o->oHeaveHoUnkF4 < 0.1) {
o->oHeaveHoUnkF4 = 0.1;
o->oAction = 1;
}
} else
o->oHeaveHoUnkF4 = 1.0f;
2020-03-02 03:42:52 +00:00
cur_obj_init_animation_with_accel_and_sound(0, o->oHeaveHoUnkF4);
2019-08-25 04:46:40 +00:00
o->oForwardVel = o->oHeaveHoUnkF4 * 10.0f;
angleVel = o->oHeaveHoUnkF4 * 0x400;
o->oMoveAngleYaw = approach_s16_symmetric(o->oMoveAngleYaw, o->oAngleToMario, angleVel);
}
2020-03-02 03:42:52 +00:00
void heave_ho_act_3(void) {
2019-08-25 04:46:40 +00:00
o->oForwardVel = 0.0f;
if (o->oTimer == 0)
2019-10-05 19:08:05 +00:00
o->oHeaveHoUnk88 = 2;
2019-08-25 04:46:40 +00:00
if (o->oTimer == 1) {
2020-03-02 03:42:52 +00:00
cur_obj_init_animation_with_accel_and_sound(1, 1.0f);
2019-08-25 04:46:40 +00:00
o->numCollidedObjs = 20;
}
2020-03-02 03:42:52 +00:00
if (cur_obj_check_if_near_animation_end())
2019-08-25 04:46:40 +00:00
o->oAction = 1;
}
2020-03-02 03:42:52 +00:00
void heave_ho_act_0(void) {
cur_obj_set_pos_to_home();
2019-08-25 04:46:40 +00:00
if (find_water_level(o->oPosX, o->oPosZ) < o->oPosY && o->oDistanceToMario < 4000.0f) {
2020-03-02 03:42:52 +00:00
cur_obj_become_tangible();
cur_obj_unhide();
2019-08-25 04:46:40 +00:00
o->oAction = 1;
} else {
2020-03-02 03:42:52 +00:00
cur_obj_become_intangible();
cur_obj_hide();
2019-08-25 04:46:40 +00:00
}
}
2020-03-02 03:42:52 +00:00
void (*sHeaveHoActions[])(void) = { heave_ho_act_0, heave_ho_act_1, heave_ho_act_2, heave_ho_act_3 };
2019-08-25 04:46:40 +00:00
2020-03-02 03:42:52 +00:00
void heave_ho_move(void) {
cur_obj_update_floor_and_walls();
cur_obj_call_action_function(sHeaveHoActions);
cur_obj_move_standard(-78);
2019-08-25 04:46:40 +00:00
if (o->oMoveFlags & (0x40 | 0x20 | 0x10 | 0x8))
o->oGraphYOffset = -15.0f;
else
o->oGraphYOffset = 0.0f;
if (o->oForwardVel > 3.0f)
2020-03-02 03:42:52 +00:00
cur_obj_play_sound_1(SOUND_AIR_HEAVEHO_MOVE);
2019-08-25 04:46:40 +00:00
if (o->oAction != 0 && o->oMoveFlags & (0x40 | 0x20 | 0x10 | 0x8))
o->oAction = 0;
if (o->oInteractStatus & INT_STATUS_GRABBED_MARIO) {
o->oInteractStatus = 0;
2019-10-05 19:08:05 +00:00
o->oHeaveHoUnk88 = 1;
2019-08-25 04:46:40 +00:00
o->oAction = 3;
}
}
void bhv_heave_ho_loop(void) {
2020-03-02 03:42:52 +00:00
cur_obj_scale(2.0f);
2019-08-25 04:46:40 +00:00
switch (o->oHeldState) {
case HELD_FREE:
2020-03-02 03:42:52 +00:00
heave_ho_move();
2019-08-25 04:46:40 +00:00
break;
case HELD_HELD:
2020-03-02 03:42:52 +00:00
cur_obj_unrender_and_reset_state(0, 0);
2019-08-25 04:46:40 +00:00
break;
case HELD_THROWN:
2020-03-02 03:42:52 +00:00
cur_obj_get_dropped();
2019-08-25 04:46:40 +00:00
break;
case HELD_DROPPED:
2020-03-02 03:42:52 +00:00
cur_obj_get_dropped();
2019-08-25 04:46:40 +00:00
break;
}
o->oInteractStatus = 0;
}