From 2b75690a315b7d866c3479db5db17ed1c6ae29fe Mon Sep 17 00:00:00 2001 From: MysterD Date: Tue, 6 Oct 2020 20:27:54 -0700 Subject: [PATCH] Synchronized WDW express elevator --- src/game/behaviors/express_elevator.inc.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/game/behaviors/express_elevator.inc.c b/src/game/behaviors/express_elevator.inc.c index f3536384..788c3e18 100644 --- a/src/game/behaviors/express_elevator.inc.c +++ b/src/game/behaviors/express_elevator.inc.c @@ -1,10 +1,21 @@ // express_elevator.c.inc void bhv_wdw_express_elevator_loop(void) { + if (!network_sync_object_initialized(o)) { + network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS); + network_init_object_field(o, &o->oAction); + network_init_object_field(o, &o->oPrevAction); + network_init_object_field(o, &o->oTimer); + network_init_object_field(o, &o->oVelY); + network_init_object_field(o, &o->oPosY); + } + o->oVelY = 0.0f; if (o->oAction == 0) { - if (cur_obj_is_mario_on_platform()) + if (cur_obj_is_any_player_on_platform()) { o->oAction++; + network_send_object(o); + } } else if (o->oAction == 1) { o->oVelY = -20.0f; o->oPosY += o->oVelY; @@ -22,6 +33,6 @@ void bhv_wdw_express_elevator_loop(void) { o->oPosY = o->oHomeY; o->oAction++; } - } else if (!cur_obj_is_mario_on_platform()) + } else if (!cur_obj_is_any_player_on_platform()) o->oAction = 0; }