Fix stars being in an infinite loop (#496)
* Fix stars being in an infinite loop * Give syncing a distance In theory I would no longer need to sync cutscene flags, but it's still worth keeping
This commit is contained in:
parent
068aa442fc
commit
f0bce590b9
|
@ -16,13 +16,14 @@ void bhv_spawned_star_init(void) {
|
||||||
if (!(o->oInteractionSubtype & INT_SUBTYPE_NO_EXIT) && o->parentObj) {
|
if (!(o->oInteractionSubtype & INT_SUBTYPE_NO_EXIT) && o->parentObj) {
|
||||||
o->oBehParams = o->parentObj->oBehParams;
|
o->oBehParams = o->parentObj->oBehParams;
|
||||||
}
|
}
|
||||||
s32 sp24 = (o->oBehParams >> 24) & 0xFF;
|
s32 starId = (o->oBehParams >> 24) & 0xFF;
|
||||||
if (bit_shift_left(sp24) & save_file_get_star_flags(gCurrSaveFileNum - 1, gCurrCourseNum - 1))
|
if (bit_shift_left(starId) & save_file_get_star_flags(gCurrSaveFileNum - 1, gCurrCourseNum - 1))
|
||||||
cur_obj_set_model(smlua_model_util_load(E_MODEL_TRANSPARENT_STAR));
|
cur_obj_set_model(smlua_model_util_load(E_MODEL_TRANSPARENT_STAR));
|
||||||
cur_obj_play_sound_2(SOUND_GENERAL2_STAR_APPEARS);
|
cur_obj_play_sound_2(SOUND_GENERAL2_STAR_APPEARS);
|
||||||
|
|
||||||
// exclamation box stars are not sent through the normal exclamation box
|
// exclamation box stars are not sent through the normal exclamation box
|
||||||
// path due to jankiness in oBehParams. Send the spawn event here instead.
|
// path due to jankiness in oBehParams. Send the spawn event here instead.
|
||||||
|
// Only exclamation boxes use bhvSpawnedStar so this check really isn't necessary
|
||||||
u8 spawnedFromExclamationBox = (o->parentObj != NULL && o->parentObj->behavior == smlua_override_behavior(bhvExclamationBox));
|
u8 spawnedFromExclamationBox = (o->parentObj != NULL && o->parentObj->behavior == smlua_override_behavior(bhvExclamationBox));
|
||||||
if (gNetworkAreaLoaded && spawnedFromExclamationBox) {
|
if (gNetworkAreaLoaded && spawnedFromExclamationBox) {
|
||||||
o->oStarSpawnExtCutsceneFlags = 1;
|
o->oStarSpawnExtCutsceneFlags = 1;
|
||||||
|
@ -81,7 +82,10 @@ void slow_star_rotation(void) {
|
||||||
|
|
||||||
void bhv_spawned_star_loop(void) {
|
void bhv_spawned_star_loop(void) {
|
||||||
if (!sync_object_is_initialized(o->oSyncID)) {
|
if (!sync_object_is_initialized(o->oSyncID)) {
|
||||||
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
|
sync_object_init(o, 4000);
|
||||||
|
sync_object_init_field(o, &o->oBehParams);
|
||||||
|
sync_object_init_field(o, &o->oAction);
|
||||||
|
sync_object_init_field(o, &o->oStarSpawnExtCutsceneFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (o->oAction == 0) {
|
if (o->oAction == 0) {
|
||||||
|
@ -142,6 +146,9 @@ void bhv_spawned_star_loop(void) {
|
||||||
o->oAction++;
|
o->oAction++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (o->oTimer == 0) {
|
||||||
|
o->oStarSpawnExtCutsceneFlags = 0;
|
||||||
|
}
|
||||||
set_sparkle_spawn_star_hitbox();
|
set_sparkle_spawn_star_hitbox();
|
||||||
slow_star_rotation();
|
slow_star_rotation();
|
||||||
network_send_object(o);
|
network_send_object(o);
|
||||||
|
|
|
@ -107,7 +107,10 @@ void bhv_star_spawn_init(void) {
|
||||||
|
|
||||||
void bhv_star_spawn_loop(void) {
|
void bhv_star_spawn_loop(void) {
|
||||||
if (!sync_object_is_initialized(o->oSyncID)) {
|
if (!sync_object_is_initialized(o->oSyncID)) {
|
||||||
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
|
sync_object_init(o, 4000);
|
||||||
|
sync_object_init_field(o, &o->oBehParams);
|
||||||
|
sync_object_init_field(o, &o->oAction);
|
||||||
|
sync_object_init_field(o, &o->oStarSpawnExtCutsceneFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (o->oAction) {
|
switch (o->oAction) {
|
||||||
|
@ -158,6 +161,7 @@ void bhv_star_spawn_loop(void) {
|
||||||
gObjCutsceneDone = TRUE;
|
gObjCutsceneDone = TRUE;
|
||||||
clear_time_stop_flags(TIME_STOP_ENABLED | TIME_STOP_MARIO_AND_DOORS);
|
clear_time_stop_flags(TIME_STOP_ENABLED | TIME_STOP_MARIO_AND_DOORS);
|
||||||
o->activeFlags &= ~ACTIVE_FLAG_INITIATED_TIME_STOP;
|
o->activeFlags &= ~ACTIVE_FLAG_INITIATED_TIME_STOP;
|
||||||
|
o->oStarSpawnExtCutsceneFlags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (o->oInteractStatus & INT_STATUS_INTERACTED) {
|
if (o->oInteractStatus & INT_STATUS_INTERACTED) {
|
||||||
|
|
Loading…
Reference in New Issue