mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Desynchronize bouncing fireball spawner - just too noisy
This commit is contained in:
parent
5455f59ad5
commit
ed53a5422c
2 changed files with 8 additions and 31 deletions
|
|
@ -27,22 +27,7 @@ void bhv_bouncing_fireball_flame_loop(void) {
|
||||||
o->oInteractStatus = 0;
|
o->oInteractStatus = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bhv_bouncing_fireball_override_ownership(u8* shouldOverride, u8* shouldOwn) {
|
|
||||||
*shouldOverride = TRUE;
|
|
||||||
*shouldOwn = (get_network_player_smallest_global() == gNetworkPlayerLocal);
|
|
||||||
}
|
|
||||||
|
|
||||||
void bhv_bouncing_fireball_loop(void) {
|
void bhv_bouncing_fireball_loop(void) {
|
||||||
if (!network_sync_object_initialized(o)) {
|
|
||||||
struct SyncObject* so = network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS);
|
|
||||||
if (so) {
|
|
||||||
so->override_ownership = bhv_bouncing_fireball_override_ownership;
|
|
||||||
network_init_object_field(o, &o->oAction);
|
|
||||||
network_init_object_field(o, &o->oPrevAction);
|
|
||||||
network_init_object_field(o, &o->oTimer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
int distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
|
|
@ -54,20 +39,12 @@ void bhv_bouncing_fireball_loop(void) {
|
||||||
o->oAction = 1;
|
o->oAction = 1;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (network_owns_object(o)) {
|
|
||||||
sp2C = spawn_object(o, MODEL_RED_FLAME, bhvBouncingFireballFlame);
|
sp2C = spawn_object(o, MODEL_RED_FLAME, bhvBouncingFireballFlame);
|
||||||
sp28 = (10 - o->oTimer) * 0.5;
|
sp28 = (10 - o->oTimer) * 0.5;
|
||||||
if (sp2C != NULL) {
|
if (sp2C != NULL) {
|
||||||
obj_scale_xyz(sp2C, sp28, sp28, sp28);
|
obj_scale_xyz(sp2C, sp28, sp28, sp28);
|
||||||
if (o->oTimer == 0)
|
if (o->oTimer == 0)
|
||||||
obj_become_tangible(sp2C);
|
obj_become_tangible(sp2C);
|
||||||
|
|
||||||
struct Object* spawn_objects[] = { sp2C };
|
|
||||||
u32 models[] = { MODEL_RED_FLAME };
|
|
||||||
network_send_spawn_objects(spawn_objects, models, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
network_send_object(o);
|
|
||||||
}
|
}
|
||||||
if (o->oTimer > 10)
|
if (o->oTimer > 10)
|
||||||
o->oAction++;
|
o->oAction++;
|
||||||
|
|
|
||||||
|
|
@ -94,10 +94,10 @@ void network_send_spawn_objects_to(u8 sendToLocalIndex, struct Object* objects[]
|
||||||
|
|
||||||
if (sendToLocalIndex == PACKET_DESTINATION_BROADCAST) {
|
if (sendToLocalIndex == PACKET_DESTINATION_BROADCAST) {
|
||||||
network_send(&p);
|
network_send(&p);
|
||||||
LOG_INFO("tx spawn objects (BROADCAST)");
|
LOG_INFO("tx spawn objects (BROADCAST) | %u", get_id_from_behavior(objects[0]->behavior));
|
||||||
} else {
|
} else {
|
||||||
network_send_to(sendToLocalIndex, &p);
|
network_send_to(sendToLocalIndex, &p);
|
||||||
LOG_INFO("tx spawn objects to %d", gNetworkPlayers[sendToLocalIndex].globalIndex);
|
LOG_INFO("tx spawn objects to %d | %u", gNetworkPlayers[sendToLocalIndex].globalIndex, get_id_from_behavior(objects[0]->behavior));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue