2019-08-25 04:46:40 +00:00
|
|
|
// cannon.c.inc
|
|
|
|
|
|
|
|
void bhv_cannon_base_unused_loop(void) {
|
|
|
|
o->oPosY += o->oVelY;
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void opened_cannon_act_0(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
if (o->oTimer == 0) {
|
|
|
|
o->oInteractStatus = 0;
|
|
|
|
o->oPosX = o->oHomeX;
|
|
|
|
o->oPosY = o->oHomeY;
|
|
|
|
o->oPosZ = o->oHomeZ;
|
|
|
|
o->oMoveAnglePitch = 0;
|
|
|
|
o->oMoveAngleYaw = (s16)(o->oBehParams2ndByte << 8);
|
2019-10-05 19:08:05 +00:00
|
|
|
o->oCannonUnkF4 = 0;
|
|
|
|
o->oCannonUnk10C = 0;
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_enable_rendering();
|
|
|
|
cur_obj_become_tangible();
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|
|
|
|
if (o->oDistanceToMario < 500.0f) {
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_become_tangible();
|
|
|
|
cur_obj_enable_rendering();
|
2019-08-25 04:46:40 +00:00
|
|
|
if (o->oInteractStatus & INT_STATUS_INTERACTED
|
|
|
|
&& (!(o->oInteractStatus
|
|
|
|
& INT_STATUS_TOUCHED_BOB_OMB))) // bob-omb explodes when it gets into a cannon
|
|
|
|
{
|
|
|
|
o->oAction = 4;
|
2019-10-05 19:08:05 +00:00
|
|
|
o->oCannonUnk10C = 1;
|
|
|
|
o->oCannonUnkF8 = 1;
|
2019-08-25 04:46:40 +00:00
|
|
|
} else
|
|
|
|
o->oInteractStatus = 0;
|
|
|
|
} else {
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_become_intangible();
|
|
|
|
cur_obj_disable_rendering();
|
2019-10-05 19:08:05 +00:00
|
|
|
o->oCannonUnk10C = 0;
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void opened_cannon_act_4(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
if (o->oTimer == 0)
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_play_sound_2(SOUND_OBJ_CANNON1);
|
2019-08-25 04:46:40 +00:00
|
|
|
o->oPosY += 5.0f;
|
|
|
|
o->oPosX += (f32)((o->oTimer / 2 & 1) - 0.5) * 2;
|
|
|
|
o->oPosZ += (f32)((o->oTimer / 2 & 1) - 0.5) * 2;
|
|
|
|
if (o->oTimer > 67) {
|
|
|
|
o->oPosX += (f32)((o->oTimer / 2 & 1) - 0.5) * 4;
|
|
|
|
o->oPosZ += (f32)((o->oTimer / 2 & 1) - 0.5) * 4;
|
|
|
|
o->oAction = 6;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void opened_cannon_act_6(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
if (o->oTimer == 0)
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_play_sound_2(SOUND_OBJ_CANNON2);
|
2019-08-25 04:46:40 +00:00
|
|
|
if (o->oTimer < 4) {
|
|
|
|
o->oPosX += (f32)((o->oTimer / 2 & 1) - 0.5) * 4.0f;
|
|
|
|
o->oPosZ += (f32)((o->oTimer / 2 & 1) - 0.5) * 4.0f;
|
|
|
|
} else {
|
|
|
|
if (o->oTimer < 6) {
|
|
|
|
} else {
|
|
|
|
if (o->oTimer < 22) {
|
|
|
|
o->oMoveAngleYaw =
|
2019-10-05 19:08:05 +00:00
|
|
|
sins(o->oCannonUnkF4) * 0x4000 + ((s16)(o->oBehParams2ndByte << 8));
|
|
|
|
o->oCannonUnkF4 += 0x400;
|
2019-08-25 04:46:40 +00:00
|
|
|
} else if (o->oTimer < 26) {
|
|
|
|
} else {
|
2019-10-05 19:08:05 +00:00
|
|
|
o->oCannonUnkF4 = 0;
|
2019-08-25 04:46:40 +00:00
|
|
|
o->oAction = 5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void opened_cannon_act_5(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
if (o->oTimer == 0)
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_play_sound_2(SOUND_OBJ_CANNON3);
|
2019-08-25 04:46:40 +00:00
|
|
|
if (o->oTimer < 4) {
|
|
|
|
} else {
|
|
|
|
if (o->oTimer < 20) {
|
2019-10-05 19:08:05 +00:00
|
|
|
o->oCannonUnkF4 += 0x400;
|
|
|
|
o->oMoveAnglePitch = sins(o->oCannonUnkF4) * 0x2000;
|
2019-08-25 04:46:40 +00:00
|
|
|
} else if (o->oTimer < 25) {
|
|
|
|
} else
|
|
|
|
o->oAction = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void opened_cannon_act_1(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
UNUSED s32 unused;
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_become_intangible();
|
|
|
|
cur_obj_disable_rendering();
|
2019-10-05 19:08:05 +00:00
|
|
|
o->oCannonUnk10C = 0;
|
2019-08-25 04:46:40 +00:00
|
|
|
gMarioShotFromCannon = 1;
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void opened_cannon_act_2(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
o->oAction = 3;
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void opened_cannon_act_3(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
UNUSED s32 unused;
|
|
|
|
if (o->oTimer > 3)
|
|
|
|
o->oAction = 0;
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void (*sOpenedCannonActions[])(void) = { opened_cannon_act_0, opened_cannon_act_1, opened_cannon_act_2,
|
|
|
|
opened_cannon_act_3, opened_cannon_act_4, opened_cannon_act_5,
|
|
|
|
opened_cannon_act_6 };
|
2019-08-25 04:46:40 +00:00
|
|
|
|
|
|
|
u8 unused0EA1FC[] = { 2, 0, 0, 0, 0, 0, 0, 0, 63, 128, 0, 0, 2, 0, 0, 0, 65, 32, 0, 0,
|
|
|
|
63, 128, 0, 0, 2, 0, 0, 0, 65, 160, 0, 0, 63, 128, 0, 0, 2, 0, 0, 0,
|
|
|
|
65, 160, 0, 0, 63, 128, 0, 0, 8, 0, 0, 0, 65, 32, 0, 0, 63, 128, 0, 0 };
|
|
|
|
|
|
|
|
void bhv_cannon_base_loop(void) {
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_call_action_function(sOpenedCannonActions);
|
2019-10-05 19:08:05 +00:00
|
|
|
if (o->oCannonUnkF8)
|
|
|
|
o->oCannonUnkF8++;
|
2019-08-25 04:46:40 +00:00
|
|
|
o->oInteractStatus = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void bhv_cannon_barrel_loop(void) {
|
|
|
|
struct Object *parent = o->parentObj;
|
|
|
|
if (parent->header.gfx.node.flags & GRAPH_RENDER_ACTIVE) {
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_enable_rendering();
|
|
|
|
obj_copy_pos(o, o->parentObj);
|
2019-08-25 04:46:40 +00:00
|
|
|
o->oMoveAngleYaw = o->parentObj->oMoveAngleYaw;
|
|
|
|
o->oFaceAnglePitch = o->parentObj->oMoveAnglePitch;
|
|
|
|
} else
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_disable_rendering();
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|