Prevent exclamation box from double spawning stars

This commit is contained in:
MysterD 2020-09-07 23:10:28 -07:00
parent f8044a5639
commit 2d0871e061
2 changed files with 13 additions and 18 deletions

View file

@ -458,7 +458,7 @@
#define /*0x0F4*/ oExclamationBoxUnkF4 OBJECT_FIELD_F32(0x1B) // scale? #define /*0x0F4*/ oExclamationBoxUnkF4 OBJECT_FIELD_F32(0x1B) // scale?
#define /*0x0F8*/ oExclamationBoxUnkF8 OBJECT_FIELD_F32(0x1C) // scale? #define /*0x0F8*/ oExclamationBoxUnkF8 OBJECT_FIELD_F32(0x1C) // scale?
#define /*0x0FC*/ oExclamationBoxUnkFC OBJECT_FIELD_S32(0x1D) // angle? #define /*0x0FC*/ oExclamationBoxUnkFC OBJECT_FIELD_S32(0x1D) // angle?
#define /*0x100*/ oExclamationBoxForce OBJECT_FIELD_S32(0x1E) // angle? #define /*0x100*/ oExclamationBoxForce OBJECT_FIELD_S32(0x49) // angle?
/* Eyerok Boss */ /* Eyerok Boss */
#define /*0x0F8*/ oEyerokBossNumHands OBJECT_FIELD_S32(0x1C) #define /*0x0F8*/ oEyerokBossNumHands OBJECT_FIELD_S32(0x1C)

View file

@ -36,6 +36,7 @@ void bhv_rotating_exclamation_box_loop(void) {
} }
void exclamation_box_act_0(void) { void exclamation_box_act_0(void) {
o->oExclamationBoxForce = FALSE;
if (o->oBehParams2ndByte < 3) { if (o->oBehParams2ndByte < 3) {
o->oAnimState = o->oBehParams2ndByte; o->oAnimState = o->oBehParams2ndByte;
if ((save_file_get_flags() & D_8032F0C0[o->oBehParams2ndByte]) if ((save_file_get_flags() & D_8032F0C0[o->oBehParams2ndByte])
@ -71,11 +72,15 @@ void exclamation_box_act_2(void) {
o->oPosY = o->oHomeY; o->oPosY = o->oHomeY;
o->oGraphYOffset = 0.0f; o->oGraphYOffset = 0.0f;
} }
if (nearest_mario_state_to_object(o) == &gMarioStates[0]) {
if (o->oExclamationBoxUnkFC == 0x4000 || cur_obj_was_attacked_or_ground_pounded()) { u8 isNearest = (nearest_mario_state_to_object(o) == &gMarioStates[0]);
o->oExclamationBoxForce = TRUE; if (o->oExclamationBoxForce || isNearest) {
network_send_object(o); if (o->oExclamationBoxForce || (isNearest && cur_obj_was_attacked_or_ground_pounded())) {
o->oExclamationBoxForce = FALSE; if (!o->oExclamationBoxForce) {
o->oExclamationBoxForce = TRUE;
network_send_object(o);
o->oExclamationBoxForce = FALSE;
}
cur_obj_become_intangible(); cur_obj_become_intangible();
o->oExclamationBoxUnkFC = 0x4000; o->oExclamationBoxUnkFC = 0x4000;
o->oVelY = 30.0f; o->oVelY = 30.0f;
@ -110,7 +115,6 @@ void exclamation_box_spawn_contents(struct Struct802C0DF0 *a0, u8 a1) {
struct Object *sp1C = NULL; struct Object *sp1C = NULL;
if (o->oExclamationBoxForce) { if (o->oExclamationBoxForce) {
o->oExclamationBoxForce = FALSE;
return; return;
} }
@ -138,7 +142,6 @@ void exclamation_box_act_4(void) {
spawn_mist_particles_variable(0, 0, 46.0f); spawn_mist_particles_variable(0, 0, 46.0f);
spawn_triangle_break_particles(20, 139, 0.3f, o->oAnimState); spawn_triangle_break_particles(20, 139, 0.3f, o->oAnimState);
create_sound_spawner(SOUND_GENERAL_BREAK_BOX); create_sound_spawner(SOUND_GENERAL_BREAK_BOX);
o->oExclamationBoxForce = FALSE;
if (o->oBehParams2ndByte < 3) { if (o->oBehParams2ndByte < 3) {
o->oAction = 5; o->oAction = 5;
cur_obj_hide(); cur_obj_hide();
@ -157,18 +160,10 @@ void (*sExclamationBoxActions[])(void) = { exclamation_box_act_0, exclamation_bo
void bhv_exclamation_box_loop(void) { void bhv_exclamation_box_loop(void) {
if (!network_sync_object_initialized(o)) { if (!network_sync_object_initialized(o)) {
network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS); struct SyncObject* so = network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS);
so->syncDeathEvent = FALSE;
network_init_object_field(o, &o->oExclamationBoxForce); 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_scale(2.0f);
cur_obj_call_action_function(sExclamationBoxActions); cur_obj_call_action_function(sExclamationBoxActions);
} }