From 697670b519fbfa9fb91a77c078ab6bd9199e2481 Mon Sep 17 00:00:00 2001 From: MysterD Date: Tue, 11 Aug 2020 23:00:55 -0700 Subject: [PATCH] Synchronized breakable wall --- include/object_fields.h | 3 +++ src/game/behaviors/breakable_wall.inc.c | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/object_fields.h b/include/object_fields.h index ec9a24c1..51b28e34 100644 --- a/include/object_fields.h +++ b/include/object_fields.h @@ -1162,4 +1162,7 @@ #define /*0x0FC*/ oYoshiChosenHome OBJECT_FIELD_S32(0x1D) #define /*0x100*/ oYoshiTargetYaw OBJECT_FIELD_S32(0x1E) +/* Breakable Wall */ +#define /*0x104*/ oBreakableWallForce OBJECT_FIELD_S32(0x1F) + #endif // OBJECT_FIELDS_H diff --git a/src/game/behaviors/breakable_wall.inc.c b/src/game/behaviors/breakable_wall.inc.c index 997d2208..2da01a10 100644 --- a/src/game/behaviors/breakable_wall.inc.c +++ b/src/game/behaviors/breakable_wall.inc.c @@ -1,9 +1,19 @@ // breakable_wall.c.inc void bhv_wf_breakable_wall_loop(void) { - if (gMarioStates->action == ACT_SHOT_FROM_CANNON) { + if (o->oSyncID == 0) { + network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS); + network_init_object_field(o, &o->oBreakableWallForce); + } + + if (o->oBreakableWallForce || gMarioStates->action == ACT_SHOT_FROM_CANNON) { cur_obj_become_tangible(); - if (obj_check_if_collided_with_object(o, gMarioObject)) { + if (o->oBreakableWallForce || obj_check_if_collided_with_object(o, gMarioObject)) { + if (!o->oBreakableWallForce) { + o->oBreakableWallForce = TRUE; + network_send_object(o); + syncObjects[o->oSyncID].syncDeathEvent = FALSE; + } if (cur_obj_has_behavior(bhvWfBreakableWallRight)) play_puzzle_jingle(); create_sound_spawner(SOUND_GENERAL_WALL_EXPLOSION);