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

54 lines
1.5 KiB
C
Raw Permalink Normal View History

2019-08-25 04:46:40 +00:00
// capswitch.c.inc
2020-03-02 03:42:52 +00:00
void cap_switch_act_0(void) {
2019-08-25 04:46:40 +00:00
o->oAnimState = o->oBehParams2ndByte;
2020-03-02 03:42:52 +00:00
cur_obj_scale(0.5f);
2019-08-25 04:46:40 +00:00
o->oPosY += 71.0f;
spawn_object_relative_with_scale(0, 0, -71, 0, 0.5f, o, MODEL_CAP_SWITCH_BASE, bhvCapSwitchBase);
if (gCurrLevelNum != LEVEL_UNKNOWN_32) {
if (save_file_get_flags() & D_8032F0C0[o->oBehParams2ndByte]) {
o->oAction = 3;
o->header.gfx.scale[1] = 0.1f;
} else
o->oAction = 1;
} else
o->oAction = 1;
}
2020-03-02 03:42:52 +00:00
void cap_switch_act_1(void) {
if (cur_obj_is_mario_on_platform()) {
2019-08-25 04:46:40 +00:00
save_file_set_flags(D_8032F0C0[o->oBehParams2ndByte]);
o->oAction = 2;
2020-03-02 03:42:52 +00:00
cur_obj_play_sound_2(SOUND_GENERAL_ACTIVATE_CAP_SWITCH);
2019-08-25 04:46:40 +00:00
}
}
2020-03-02 03:42:52 +00:00
void cap_switch_act_2(void) {
2019-08-25 04:46:40 +00:00
s32 sp1C;
if (o->oTimer < 5) {
2020-03-02 03:42:52 +00:00
cur_obj_scale_over_time(2, 4, 0.5f, 0.1f);
2019-08-25 04:46:40 +00:00
if (o->oTimer == 4) {
2020-03-02 03:42:52 +00:00
cur_obj_shake_screen(SHAKE_POS_SMALL);
spawn_mist_particles();
2019-08-25 04:46:40 +00:00
spawn_triangle_break_particles(60, 139, 0.3f, o->oBehParams2ndByte);
2020-04-03 18:57:26 +00:00
#ifdef VERSION_SH
queue_rumble_data(5, 80);
#endif
2019-08-25 04:46:40 +00:00
}
} else {
2020-03-02 03:42:52 +00:00
sp1C = cur_obj_update_dialog_with_cutscene(1, 0x0C, CUTSCENE_CAP_SWITCH_PRESS, 0);
2019-08-25 04:46:40 +00:00
if (sp1C)
o->oAction = 3;
}
}
2020-03-02 03:42:52 +00:00
void cap_switch_act_3() {
2019-08-25 04:46:40 +00:00
} // dead function
2020-03-02 03:42:52 +00:00
void (*sCapSwitchActions[])(void) = { cap_switch_act_0, cap_switch_act_1,
cap_switch_act_2, cap_switch_act_3 };
2019-08-25 04:46:40 +00:00
void bhv_cap_switch_loop(void) {
2020-03-02 03:42:52 +00:00
cur_obj_call_action_function(sCapSwitchActions);
2019-08-25 04:46:40 +00:00
}