Resynchronized WF tower platforms using Network Area Timer

This commit is contained in:
MysterD 2021-08-03 23:39:28 -07:00
parent e17cba85f3
commit c5700825a8

View file

@ -54,31 +54,14 @@ void bhv_wf_elevator_tower_platform_loop(void) {
}
}
void bhv_wf_sliding_tower_platform_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->oForwardVel);
network_init_object_field(o, &o->oPlatformUnk110);
network_init_object_field(o, &o->oPlatformUnk10C);
network_init_object_field(o, &o->oMoveAngleYaw);
network_init_object_field(o, &o->oPosX);
network_init_object_field(o, &o->oPosZ);
network_init_object_field(o, &o->oVelX);
network_init_object_field(o, &o->oVelZ);
}
static void bhv_wf_sliding_tower_platform_loop_inner(void) {
s32 sp24 = o->oPlatformUnk110 / o->oPlatformUnk10C;
switch (o->oAction) {
case 0:
o->oForwardVel = -o->oPlatformUnk10C;
if (network_owns_object(o) && o->oTimer > sp24) {
if (o->oTimer > sp24) {
o->oAction++;
network_send_object(o);
}
if (!network_owns_object(o) && o->oTimer > sp24) { o->oForwardVel = 0; }
o->oForwardVel = -o->oPlatformUnk10C;
break;
case 1:
if (o->oTimer > sp24)
@ -99,6 +82,13 @@ void bhv_wf_sliding_tower_platform_loop(void) {
}
}
void bhv_wf_sliding_tower_platform_loop(void) {
u32 loopTime = 1 + (o->oPlatformUnk110 / o->oPlatformUnk10C);
loopTime *= 2;
loopTime += 1;
cur_obj_area_timer_loop(loopTime, bhv_wf_sliding_tower_platform_loop_inner);
}
void spawn_and_init_wf_platforms(s16 a, const BehaviorScript *bhv) {
s16 yaw;
struct Object *platform = spawn_object(o, a, bhv);