Synchronized cap switch, and exclamation box contents
This commit is contained in:
parent
5ca3f2ebd7
commit
f1789d4e78
|
@ -458,6 +458,7 @@
|
|||
#define /*0x0F4*/ oExclamationBoxUnkF4 OBJECT_FIELD_F32(0x1B) // scale?
|
||||
#define /*0x0F8*/ oExclamationBoxUnkF8 OBJECT_FIELD_F32(0x1C) // scale?
|
||||
#define /*0x0FC*/ oExclamationBoxUnkFC OBJECT_FIELD_S32(0x1D) // angle?
|
||||
#define /*0x100*/ oExclamationBoxForce OBJECT_FIELD_S32(0x1E) // angle?
|
||||
|
||||
/* Eyerok Boss */
|
||||
#define /*0x0F8*/ oEyerokBossNumHands OBJECT_FIELD_S32(0x1C)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// capswitch.c.inc
|
||||
|
||||
static u8 capSwitchForcePress = FALSE;
|
||||
|
||||
void cap_switch_act_0(void) {
|
||||
o->oAnimState = o->oBehParams2ndByte;
|
||||
cur_obj_scale(0.5f);
|
||||
|
@ -16,14 +18,20 @@ void cap_switch_act_0(void) {
|
|||
}
|
||||
|
||||
void cap_switch_act_1(void) {
|
||||
if (cur_obj_is_mario_on_platform()) {
|
||||
if (capSwitchForcePress || cur_obj_is_mario_on_platform()) {
|
||||
save_file_set_flags(D_8032F0C0[o->oBehParams2ndByte]);
|
||||
o->oAction = 2;
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_ACTIVATE_CAP_SWITCH);
|
||||
if (!capSwitchForcePress) {
|
||||
capSwitchForcePress = TRUE;
|
||||
network_send_object(o);
|
||||
}
|
||||
capSwitchForcePress = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void cap_switch_act_2(void) {
|
||||
capSwitchForcePress = FALSE;
|
||||
s32 sp1C;
|
||||
if (o->oTimer < 5) {
|
||||
cur_obj_scale_over_time(2, 4, 0.5f, 0.1f);
|
||||
|
@ -34,18 +42,28 @@ void cap_switch_act_2(void) {
|
|||
queue_rumble_data(5, 80);
|
||||
}
|
||||
} else {
|
||||
sp1C = cur_obj_update_dialog_with_cutscene(&gMarioState[0], 1, 0x0C, CUTSCENE_CAP_SWITCH_PRESS, 0);
|
||||
if (sp1C)
|
||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||
if (marioState == &gMarioState[0]) {
|
||||
sp1C = cur_obj_update_dialog_with_cutscene(&gMarioState[0], 1, 0x0C, CUTSCENE_CAP_SWITCH_PRESS, 0);
|
||||
if (sp1C) { o->oAction = 3; }
|
||||
} else {
|
||||
o->oAction = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cap_switch_act_3(void) {
|
||||
capSwitchForcePress = FALSE;
|
||||
} // dead function
|
||||
|
||||
void (*sCapSwitchActions[])(void) = { cap_switch_act_0, cap_switch_act_1,
|
||||
cap_switch_act_2, cap_switch_act_3 };
|
||||
|
||||
void bhv_cap_switch_loop(void) {
|
||||
if (o->oSyncID == 0) {
|
||||
network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS);
|
||||
network_init_object_field(o, &capSwitchForcePress);
|
||||
}
|
||||
|
||||
cur_obj_call_action_function(sCapSwitchActions);
|
||||
}
|
||||
|
|
|
@ -71,10 +71,9 @@ void exclamation_box_act_2(void) {
|
|||
o->oPosY = o->oHomeY;
|
||||
o->oGraphYOffset = 0.0f;
|
||||
}
|
||||
if (o->oExclamationBoxUnkFC == 0x4000 || cur_obj_was_attacked_or_ground_pounded()) {
|
||||
if (o->oExclamationBoxForce || o->oExclamationBoxUnkFC == 0x4000 || cur_obj_was_attacked_or_ground_pounded()) {
|
||||
cur_obj_become_intangible();
|
||||
o->oExclamationBoxUnkFC = 0x4000;
|
||||
network_send_object(o);
|
||||
o->oVelY = 30.0f;
|
||||
o->oGravity = -8.0f;
|
||||
o->oFloorHeight = o->oPosY;
|
||||
|
@ -105,6 +104,15 @@ void exclamation_box_act_3(void) {
|
|||
void exclamation_box_spawn_contents(struct Struct802C0DF0 *a0, u8 a1) {
|
||||
struct Object *sp1C = NULL;
|
||||
|
||||
if (o->oExclamationBoxForce) {
|
||||
o->oExclamationBoxForce = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
o->oExclamationBoxForce = TRUE;
|
||||
network_send_object(o);
|
||||
o->oExclamationBoxForce = FALSE;
|
||||
|
||||
while (a0->unk0 != 99) {
|
||||
if (a1 == a0->unk0) {
|
||||
sp1C = spawn_object(o, a0->model, a0->behavior);
|
||||
|
@ -114,6 +122,10 @@ void exclamation_box_spawn_contents(struct Struct802C0DF0 *a0, u8 a1) {
|
|||
o->oBehParams |= a0->unk2 << 24;
|
||||
if (a0->model == 122)
|
||||
o->oFlags |= 0x4000;
|
||||
|
||||
struct Object* spawn_objects[] = { sp1C };
|
||||
u32 models[] = { a0->model };
|
||||
network_send_spawn_objects(spawn_objects, models, 1);
|
||||
break;
|
||||
}
|
||||
a0++;
|
||||
|
@ -144,7 +156,7 @@ void (*sExclamationBoxActions[])(void) = { exclamation_box_act_0, exclamation_bo
|
|||
void bhv_exclamation_box_loop(void) {
|
||||
if (o->oSyncID == 0) {
|
||||
network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS);
|
||||
network_init_object_field(o, &o->oExclamationBoxUnkFC);
|
||||
network_init_object_field(o, &o->oExclamationBoxForce);
|
||||
}
|
||||
cur_obj_scale(2.0f);
|
||||
cur_obj_call_action_function(sExclamationBoxActions);
|
||||
|
|
Loading…
Reference in New Issue