Switched SSL moving pyramid wall to timer syncing

This commit is contained in:
MysterD 2023-06-16 18:26:14 -07:00
parent ccfb46043b
commit 2b80d6480b

View file

@ -11,6 +11,10 @@
* positions.
*/
void bhv_ssl_moving_pyramid_wall_init(void) {
o->areaTimerType = AREA_TIMER_TYPE_LOOP;
o->areaTimer = 0;
o->areaTimerDuration = 200;
switch (o->oBehParams2ndByte) {
case PYRAMID_WALL_BP_POSITION_HIGH:
break;
@ -25,17 +29,6 @@ void bhv_ssl_moving_pyramid_wall_init(void) {
o->oAction = PYRAMID_WALL_ACT_MOVING_UP;
break;
}
if (!sync_object_is_initialized(o->oSyncID)) {
struct SyncObject *so = sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
if (so) {
sync_object_init_field(o, &o->oPrevAction);
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, &o->oTimer);
sync_object_init_field(o, &o->oVelY);
sync_object_init_field(o, &o->oPosY);
}
}
}
/**
@ -48,16 +41,14 @@ void bhv_ssl_moving_pyramid_wall_loop(void) {
o->oVelY = -5.12f;
if (o->oTimer == 100) {
o->oAction = PYRAMID_WALL_ACT_MOVING_UP;
if (sync_object_is_owned_locally(o->oSyncID)) {
network_send_object(o);
}
}
break;
case PYRAMID_WALL_ACT_MOVING_UP:
o->oVelY = 5.12f;
if (o->oTimer == 100)
if (o->oTimer == 100) {
o->oAction = PYRAMID_WALL_ACT_MOVING_DOWN;
}
break;
}