Fixed exclamation box synchronization bug

This commit is contained in:
MysterD 2020-08-18 18:47:21 -07:00
parent 53576aa51e
commit 4b12d0e513

View file

@ -71,8 +71,11 @@ void exclamation_box_act_2(void) {
o->oPosY = o->oHomeY;
o->oGraphYOffset = 0.0f;
}
if (o->oExclamationBoxForce || nearest_mario_state_to_object(o) == &gMarioStates[0]) {
if (o->oExclamationBoxForce || o->oExclamationBoxUnkFC == 0x4000 || cur_obj_was_attacked_or_ground_pounded()) {
if (nearest_mario_state_to_object(o) == &gMarioStates[0]) {
if (o->oExclamationBoxUnkFC == 0x4000 || cur_obj_was_attacked_or_ground_pounded()) {
o->oExclamationBoxForce = TRUE;
network_send_object(o);
o->oExclamationBoxForce = FALSE;
cur_obj_become_intangible();
o->oExclamationBoxUnkFC = 0x4000;
o->oVelY = 30.0f;
@ -111,10 +114,6 @@ void exclamation_box_spawn_contents(struct Struct802C0DF0 *a0, u8 a1) {
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);
@ -139,6 +138,7 @@ void exclamation_box_act_4(void) {
spawn_mist_particles_variable(0, 0, 46.0f);
spawn_triangle_break_particles(20, 139, 0.3f, o->oAnimState);
create_sound_spawner(SOUND_GENERAL_BREAK_BOX);
o->oExclamationBoxForce = FALSE;
if (o->oBehParams2ndByte < 3) {
o->oAction = 5;
cur_obj_hide();
@ -147,7 +147,6 @@ void exclamation_box_act_4(void) {
}
void exclamation_box_act_5(void) {
o->oExclamationBoxForce = FALSE;
if (o->oTimer > 300)
o->oAction = 2;
}
@ -161,6 +160,15 @@ void bhv_exclamation_box_loop(void) {
network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS);
network_init_object_field(o, &o->oExclamationBoxForce);
}
if (o->oExclamationBoxForce && o->oAction < 3) {
cur_obj_become_intangible();
o->oExclamationBoxUnkFC = 0x4000;
o->oVelY = 30.0f;
o->oGravity = -8.0f;
o->oFloorHeight = o->oPosY;
o->oAction = 3;
queue_rumble_data_object(o, 5, 80);
}
cur_obj_scale(2.0f);
cur_obj_call_action_function(sExclamationBoxActions);
}