Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MorsGames
GitHub Repository: MorsGames/sm64plus
Path: blob/master/src/game/behaviors/capswitch.inc.c
7861 views
1
// capswitch.c.inc
2
3
UNUSED u8 sCapSwitchText[] = { DIALOG_010, DIALOG_011, DIALOG_012 };
4
5
void cap_switch_act_0(void) {
6
o->oAnimState = o->oBehParams2ndByte;
7
cur_obj_scale(0.5f);
8
o->oPosY += 71.0f;
9
spawn_object_relative_with_scale(0, 0, -71, 0, 0.5f, o, MODEL_CAP_SWITCH_BASE, bhvCapSwitchBase);
10
if (gCurrLevelNum != LEVEL_UNKNOWN_32) {
11
if (save_file_get_flags() & sCapSaveFlags[o->oBehParams2ndByte]) {
12
o->oAction = 3;
13
o->header.gfx.scale[1] = 0.1f;
14
} else
15
o->oAction = 1;
16
} else
17
o->oAction = 1;
18
}
19
20
void cap_switch_act_1(void) {
21
if (cur_obj_is_mario_on_platform()) {
22
save_file_set_flags(sCapSaveFlags[o->oBehParams2ndByte]);
23
o->oAction = 2;
24
cur_obj_play_sound_2(SOUND_GENERAL_ACTIVATE_CAP_SWITCH);
25
}
26
}
27
28
void cap_switch_act_2(void) {
29
s32 sp1C;
30
if (o->oTimer < 5) {
31
cur_obj_scale_over_time(2, 4, 0.5f, 0.1f);
32
if (o->oTimer == 4) {
33
cur_obj_shake_screen(SHAKE_POS_SMALL);
34
spawn_mist_particles();
35
spawn_triangle_break_particles(60, MODEL_CARTOON_STAR, 0.3f, o->oBehParams2ndByte);
36
#if ENABLE_RUMBLE
37
queue_rumble_data(5, 80);
38
#endif
39
}
40
} else {
41
//! Neither of these flags are defined in this function so they do nothing.
42
// On an extra note, there's a specific check for this cutscene and
43
// there's no dialog defined since the cutscene itself calls the dialog.
44
sp1C = cur_obj_update_dialog_with_cutscene(MARIO_DIALOG_LOOK_FRONT,
45
(DIALOG_FLAG_TEXT_RESPONSE | DIALOG_FLAG_UNK_CAPSWITCH), CUTSCENE_CAP_SWITCH_PRESS, 0);
46
if (sp1C)
47
o->oAction = 3;
48
}
49
}
50
51
void cap_switch_act_3(void) {
52
} // dead function
53
54
void (*sCapSwitchActions[])(void) = { cap_switch_act_0, cap_switch_act_1,
55
cap_switch_act_2, cap_switch_act_3 };
56
57
void bhv_cap_switch_loop(void) {
58
cur_obj_call_action_function(sCapSwitchActions);
59
}
60
61