Prevent exclamation box from spawning the wrong star on remote

This commit is contained in:
MysterD 2020-09-07 23:56:29 -07:00
parent 2d0871e061
commit 2f8d119301
2 changed files with 29 additions and 6 deletions

View File

@ -128,9 +128,13 @@ void exclamation_box_spawn_contents(struct Struct802C0DF0 *a0, u8 a1) {
if (a0->model == 122)
o->oFlags |= 0x4000;
// send non-star spawn events
// stars cant be sent here to due jankiness in oBehParams
if (a0->behavior != bhvSpawnedStar) {
struct Object* spawn_objects[] = { sp1C };
u32 models[] = { a0->model };
network_send_spawn_objects(spawn_objects, models, 1);
}
break;
}
a0++;
@ -145,18 +149,26 @@ void exclamation_box_act_4(void) {
if (o->oBehParams2ndByte < 3) {
o->oAction = 5;
cur_obj_hide();
} else
obj_mark_for_deletion(o);
} else {
o->oAction = 6;
cur_obj_become_intangible();
cur_obj_hide();
}
}
void exclamation_box_act_5(void) {
if (o->oTimer > 300)
o->oAction = 2;
}
void exclamation_box_act_6(void) {
if (o->oTimer > 1000)
obj_mark_for_deletion(o);
}
void (*sExclamationBoxActions[])(void) = { exclamation_box_act_0, exclamation_box_act_1,
exclamation_box_act_2, exclamation_box_act_3,
exclamation_box_act_4, exclamation_box_act_5 };
exclamation_box_act_4, exclamation_box_act_5,
exclamation_box_act_6 };
void bhv_exclamation_box_loop(void) {
if (!network_sync_object_initialized(o)) {

View File

@ -20,6 +20,17 @@ void bhv_spawned_star_init(void) {
if (bit_shift_left(sp24) & save_file_get_star_flags(gCurrSaveFileNum - 1, gCurrCourseNum - 1))
cur_obj_set_model(MODEL_TRANSPARENT_STAR);
cur_obj_play_sound_2(SOUND_GENERAL2_STAR_APPEARS);
// exclamation box stars are not sent through the normal exclamation box
// path due to jankiness in oBehParams. Send the spawn event here instead.
u8 spawnedFromExclamationBox = (o->parentObj != NULL && o->parentObj->behavior == bhvExclamationBox);
if (gNetworkLevelLoaded && spawnedFromExclamationBox) {
o->parentObj = o;
struct Object* spawn_objects[] = { o };
u32 models[] = { MODEL_STAR };
network_send_spawn_objects(spawn_objects, models, 1);
}
}
void set_sparkle_spawn_star_hitbox(void) {