Synchronized bomp

This commit is contained in:
MysterD 2020-08-11 23:01:36 -07:00
parent d5b087acd8
commit 47948b2a4e
1 changed files with 24 additions and 4 deletions

View File

@ -4,6 +4,14 @@ void bhv_small_bomp_init(void) {
o->oFaceAngleYaw -= 0x4000; o->oFaceAngleYaw -= 0x4000;
o->oSmallBompInitX = o->oPosX; o->oSmallBompInitX = o->oPosX;
o->oTimer = random_float() * 100.0f; o->oTimer = random_float() * 100.0f;
if (o->oSyncID == 0) {
network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS);
network_init_object_field(o, &o->oAction);
network_init_object_field(o, &o->oForwardVel);
network_init_object_field(o, &o->oMoveAngleYaw);
network_init_object_field(o, &o->oPosX);
network_init_object_field(o, &o->oTimer);
}
} }
void bhv_small_bomp_loop(void) { void bhv_small_bomp_loop(void) {
@ -34,11 +42,13 @@ void bhv_small_bomp_loop(void) {
o->oForwardVel = 0; o->oForwardVel = 0;
} }
if (o->oTimer == 60) { if (o->oTimer >= 60) {
if (o->oTimer == 60) { cur_obj_play_sound_2(SOUND_OBJ_UNKNOWN2); }
if (!network_owns_object(o)) { break; }
o->oAction = BOMP_ACT_RETRACT; o->oAction = BOMP_ACT_RETRACT;
o->oForwardVel = 10.0f; o->oForwardVel = 10.0f;
o->oMoveAngleYaw -= 0x8000; o->oMoveAngleYaw -= 0x8000;
cur_obj_play_sound_2(SOUND_OBJ_UNKNOWN2); network_send_object(o);
} }
break; break;
@ -60,6 +70,14 @@ void bhv_small_bomp_loop(void) {
void bhv_large_bomp_init(void) { void bhv_large_bomp_init(void) {
o->oMoveAngleYaw += 0x4000; o->oMoveAngleYaw += 0x4000;
o->oTimer = random_float() * 100.0f; o->oTimer = random_float() * 100.0f;
if (o->oSyncID == 0) {
network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS);
network_init_object_field(o, &o->oAction);
network_init_object_field(o, &o->oForwardVel);
network_init_object_field(o, &o->oMoveAngleYaw);
network_init_object_field(o, &o->oPosX);
network_init_object_field(o, &o->oTimer);
}
} }
void bhv_large_bomp_loop(void) { void bhv_large_bomp_loop(void) {
@ -90,11 +108,13 @@ void bhv_large_bomp_loop(void) {
o->oForwardVel = 0; o->oForwardVel = 0;
} }
if (o->oTimer == 60) { if (o->oTimer >= 60) {
if (o->oTimer == 60) { cur_obj_play_sound_2(SOUND_OBJ_UNKNOWN2); }
if (!network_owns_object(o)) { break; }
o->oAction = BOMP_ACT_RETRACT; o->oAction = BOMP_ACT_RETRACT;
o->oForwardVel = 10.0f; o->oForwardVel = 10.0f;
o->oMoveAngleYaw -= 0x8000; o->oMoveAngleYaw -= 0x8000;
cur_obj_play_sound_2(SOUND_OBJ_UNKNOWN2); network_send_object(o);
} }
break; break;