Shuffle Fairies - Fix fairies spawning without playing song (#4884)

* Fix fairies spawning without playing song

* Better if statement
This commit is contained in:
aMannus 2025-01-15 23:12:06 +01:00 committed by GitHub
parent 0497ad20d8
commit 5ae527c194
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -129,20 +129,15 @@ void ShuffleFairies_OnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should,
} else if (id == VB_SPAWN_GOSSIP_STONE_FAIRY) {
EnGs* gossipStone = (EnGs*)(actor);
// If not any of the songs that normally spawn a fairy, mimic vanilla behaviour.
if (gPlayState->msgCtx.ocarinaMode == OCARINA_MODE_01) {
Player* player = GET_PLAYER(gPlayState);
player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR;
return;
} else if (gPlayState->msgCtx.unk_E3F2 != OCARINA_SONG_LULLABY &&
gPlayState->msgCtx.unk_E3F2 != OCARINA_SONG_SARIAS &&
gPlayState->msgCtx.unk_E3F2 != OCARINA_SONG_EPONAS &&
gPlayState->msgCtx.unk_E3F2 != OCARINA_SONG_SUNS &&
gPlayState->msgCtx.unk_E3F2 != OCARINA_SONG_TIME &&
gPlayState->msgCtx.unk_E3F2 != OCARINA_SONG_STORMS &&
gPlayState->msgCtx.ocarinaMode != OCARINA_MODE_04) {
return;
}
// Mimic vanilla behaviour, only go into this path if song played is one of the ones normally spawning a fairy.
// Otherwise fall back to vanilla behaviour.
if (gPlayState->msgCtx.ocarinaMode == OCARINA_MODE_04 &&
(gPlayState->msgCtx.unk_E3F2 == OCARINA_SONG_LULLABY ||
gPlayState->msgCtx.unk_E3F2 == OCARINA_SONG_SARIAS ||
gPlayState->msgCtx.unk_E3F2 == OCARINA_SONG_EPONAS ||
gPlayState->msgCtx.unk_E3F2 == OCARINA_SONG_SUNS ||
gPlayState->msgCtx.unk_E3F2 == OCARINA_SONG_TIME ||
gPlayState->msgCtx.unk_E3F2 == OCARINA_SONG_STORMS)) {
int32_t params = (gPlayState->sceneNum == SCENE_GROTTOS) ? Grotto_CurrentGrotto() : 0;
// Distinguish storms fairies from the normal song fairies
@ -171,6 +166,7 @@ void ShuffleFairies_OnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should,
*should = false;
}
}
}
}
uint32_t onVanillaBehaviorHook = 0;