Synchronized SL snow mounds

This commit is contained in:
MysterD 2020-10-05 23:08:36 -07:00
parent 4c8635f64c
commit b9ed4bbe67
1 changed files with 26 additions and 5 deletions

View File

@ -24,20 +24,41 @@ void bhv_sliding_snow_mound_loop(void) {
}
void bhv_snow_mound_spawn_loop(void) {
struct Object *sp1C;
struct Object* player = nearest_player_to_object(o);
int distanceToPlayer = dist_between_objects(o, player);
int angleToPlayer = obj_angle_to_object(o, player);
struct Object *sp1C = NULL;
if (!network_sync_object_initialized(o)) {
network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS);
network_init_object_field(o, &o->oTimer);
network_init_object_field(o, &o->oAction);
network_init_object_field(o, &o->oPrevAction);
}
if (!is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 6000)
|| o->oPosY + 1000.0f < gMarioObject->header.gfx.pos[1])
|| o->oPosY + 1000.0f < player->header.gfx.pos[1])
return;
if (o->oTimer == 64 || o->oTimer == 128 || o->oTimer == 192 || o->oTimer == 224 || o->oTimer == 256)
sp1C = spawn_object(o, MODEL_SL_SNOW_TRIANGLE, bhvSlidingSnowMound);
if (o->oTimer == 64 || o->oTimer == 128 || o->oTimer == 192 || o->oTimer == 224 || o->oTimer == 256) {
if (network_owns_object(o)) {
sp1C = spawn_object(o, MODEL_SL_SNOW_TRIANGLE, bhvSlidingSnowMound);
network_send_object(o);
}
}
if (o->oTimer == 256) {
if (sp1C != NULL && o->oTimer == 256) {
sp1C->header.gfx.scale[0] = 2.0f;
sp1C->header.gfx.scale[1] = 2.0f;
}
if (sp1C != NULL) {
struct Object* spawn_objects[] = { sp1C };
u32 models[] = { MODEL_SL_SNOW_TRIANGLE };
network_send_spawn_objects(spawn_objects, models, 1);
}
if (o->oTimer >= 256)
o->oTimer = 0;
}