Synchronized WDW express elevator

This commit is contained in:
MysterD 2020-10-06 20:27:54 -07:00
parent 5ad1b60a9f
commit 2b75690a31
1 changed files with 13 additions and 2 deletions

View File

@ -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;
}