mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-01-30 23:10:14 -05:00
Shuffle Fairies - Fix fairies spawning without playing song (#4884)
* Fix fairies spawning without playing song * Better if statement
This commit is contained in:
parent
0497ad20d8
commit
5ae527c194
@ -129,46 +129,42 @@ void ShuffleFairies_OnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should,
|
|||||||
} else if (id == VB_SPAWN_GOSSIP_STONE_FAIRY) {
|
} else if (id == VB_SPAWN_GOSSIP_STONE_FAIRY) {
|
||||||
EnGs* gossipStone = (EnGs*)(actor);
|
EnGs* gossipStone = (EnGs*)(actor);
|
||||||
|
|
||||||
// If not any of the songs that normally spawn a fairy, mimic vanilla behaviour.
|
// Mimic vanilla behaviour, only go into this path if song played is one of the ones normally spawning a fairy.
|
||||||
if (gPlayState->msgCtx.ocarinaMode == OCARINA_MODE_01) {
|
// Otherwise fall back to vanilla behaviour.
|
||||||
Player* player = GET_PLAYER(gPlayState);
|
if (gPlayState->msgCtx.ocarinaMode == OCARINA_MODE_04 &&
|
||||||
player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR;
|
(gPlayState->msgCtx.unk_E3F2 == OCARINA_SONG_LULLABY ||
|
||||||
return;
|
gPlayState->msgCtx.unk_E3F2 == OCARINA_SONG_SARIAS ||
|
||||||
} else if (gPlayState->msgCtx.unk_E3F2 != OCARINA_SONG_LULLABY &&
|
gPlayState->msgCtx.unk_E3F2 == OCARINA_SONG_EPONAS ||
|
||||||
gPlayState->msgCtx.unk_E3F2 != OCARINA_SONG_SARIAS &&
|
gPlayState->msgCtx.unk_E3F2 == OCARINA_SONG_SUNS ||
|
||||||
gPlayState->msgCtx.unk_E3F2 != OCARINA_SONG_EPONAS &&
|
gPlayState->msgCtx.unk_E3F2 == OCARINA_SONG_TIME ||
|
||||||
gPlayState->msgCtx.unk_E3F2 != OCARINA_SONG_SUNS &&
|
gPlayState->msgCtx.unk_E3F2 == OCARINA_SONG_STORMS)) {
|
||||||
gPlayState->msgCtx.unk_E3F2 != OCARINA_SONG_TIME &&
|
|
||||||
gPlayState->msgCtx.unk_E3F2 != OCARINA_SONG_STORMS &&
|
|
||||||
gPlayState->msgCtx.ocarinaMode != OCARINA_MODE_04) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t params = (gPlayState->sceneNum == SCENE_GROTTOS) ? Grotto_CurrentGrotto() : 0;
|
int32_t params = (gPlayState->sceneNum == SCENE_GROTTOS) ? Grotto_CurrentGrotto() : 0;
|
||||||
// Distinguish storms fairies from the normal song fairies
|
// Distinguish storms fairies from the normal song fairies
|
||||||
if (gPlayState->msgCtx.unk_E3F2 == OCARINA_SONG_STORMS) {
|
if (gPlayState->msgCtx.unk_E3F2 == OCARINA_SONG_STORMS) {
|
||||||
params |= 0x1000;
|
params |= 0x1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Combine actor + song params with position to get the right randomizer check
|
// Combine actor + song params with position to get the right randomizer check
|
||||||
params = TWO_ACTOR_PARAMS(params, (int32_t)gossipStone->actor.world.pos.z);
|
params = TWO_ACTOR_PARAMS(params, (int32_t)gossipStone->actor.world.pos.z);
|
||||||
|
|
||||||
// Check if a fairy already exists with the same identity as the stone is trying to spawn.
|
// Check if a fairy already exists with the same identity as the stone is trying to spawn.
|
||||||
// Because the gossip stone code runs several times after playing the song, we need to
|
// Because the gossip stone code runs several times after playing the song, we need to
|
||||||
// stop spawning the vanilla fairy as well when these fairies exist, otherwise both
|
// stop spawning the vanilla fairy as well when these fairies exist, otherwise both
|
||||||
// the randomized and the vanilla fairy will spawn. When the randomized fairy is already
|
// the randomized and the vanilla fairy will spawn. When the randomized fairy is already
|
||||||
// collected, the vanilla code will handle that part automatically.
|
// collected, the vanilla code will handle that part automatically.
|
||||||
FairyIdentity fairyIdentity = ShuffleFairies_GetFairyIdentity(params);
|
FairyIdentity fairyIdentity = ShuffleFairies_GetFairyIdentity(params);
|
||||||
if (!ShuffleFairies_FairyExists(fairyIdentity)) {
|
if (!ShuffleFairies_FairyExists(fairyIdentity)) {
|
||||||
if (ShuffleFairies_SpawnFairy(gossipStone->actor.world.pos.x, gossipStone->actor.world.pos.y,
|
if (ShuffleFairies_SpawnFairy(gossipStone->actor.world.pos.x, gossipStone->actor.world.pos.y,
|
||||||
gossipStone->actor.world.pos.z, params)) {
|
gossipStone->actor.world.pos.z, params)) {
|
||||||
Audio_PlayActorSound2(&gossipStone->actor, NA_SE_EV_BUTTERFRY_TO_FAIRY);
|
Audio_PlayActorSound2(&gossipStone->actor, NA_SE_EV_BUTTERFRY_TO_FAIRY);
|
||||||
// Set vanilla check for fairy spawned so it doesn't spawn the vanilla fairy afterwards as well.
|
// Set vanilla check for fairy spawned so it doesn't spawn the vanilla fairy afterwards as well.
|
||||||
gossipStone->unk_19D = 0;
|
gossipStone->unk_19D = 0;
|
||||||
|
*should = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
*should = false;
|
*should = false;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
*should = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user