pause warp: check player has buttons (#4927)

* pause warp: check player has buttons

* feedback
This commit is contained in:
Philip Dubé 2025-01-21 05:45:33 +00:00 committed by GitHub
parent 26e92a063f
commit ad9984ef68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,22 +2,23 @@
#include "global.h"
#include "z64.h"
#include "game-interactor/GameInteractor.h"
#include "soh/OTRGlobals.h"
static const int songMessageMap[] = {
TEXT_WARP_MINUET_OF_FOREST,
TEXT_WARP_BOLERO_OF_FIRE,
TEXT_WARP_SERENADE_OF_WATER,
TEXT_WARP_REQUIEM_OF_SPIRIT,
TEXT_WARP_NOCTURNE_OF_SHADOW,
TEXT_WARP_PRELUDE_OF_LIGHT
TEXT_WARP_MINUET_OF_FOREST,
TEXT_WARP_BOLERO_OF_FIRE,
TEXT_WARP_SERENADE_OF_WATER,
TEXT_WARP_REQUIEM_OF_SPIRIT,
TEXT_WARP_NOCTURNE_OF_SHADOW,
TEXT_WARP_PRELUDE_OF_LIGHT
};
static const int ocarinaSongMap[] = {
OCARINA_SONG_MINUET,
OCARINA_SONG_BOLERO,
OCARINA_SONG_SERENADE,
OCARINA_SONG_REQUIEM,
OCARINA_SONG_NOCTURNE,
OCARINA_SONG_MINUET,
OCARINA_SONG_BOLERO,
OCARINA_SONG_SERENADE,
OCARINA_SONG_REQUIEM,
OCARINA_SONG_NOCTURNE,
OCARINA_SONG_PRELUDE
};
@ -31,12 +32,12 @@ static const int entranceIndexMap[] = {
};
static const int songAudioMap[] = {
NA_BGM_OCA_MINUET,
NA_BGM_OCA_BOLERO,
NA_BGM_OCA_SERENADE,
NA_BGM_OCA_REQUIEM,
NA_BGM_OCA_NOCTURNE,
NA_BGM_OCA_LIGHT
NA_BGM_OCA_MINUET,
NA_BGM_OCA_BOLERO,
NA_BGM_OCA_SERENADE,
NA_BGM_OCA_REQUIEM,
NA_BGM_OCA_NOCTURNE,
NA_BGM_OCA_LIGHT
};
static bool isWarpActive = false;
@ -87,6 +88,47 @@ void PauseWarp_HandleSelection() {
int song = gPlayState->pauseCtx.cursorPoint[PAUSE_QUEST];
if (aButtonPressed && CHECK_QUEST_ITEM(song) && song >= QUEST_SONG_MINUET && song <= QUEST_SONG_PRELUDE &&
gPlayState->pauseCtx.pageIndex == PAUSE_QUEST && gPlayState->pauseCtx.state == 6) {
if (gSaveContext.ship.quest.id == QUEST_RANDOMIZER && Randomizer_GetSettingValue(RSK_SHUFFLE_OCARINA_BUTTONS)) {
bool canplay = false;
switch (song) {
case QUEST_SONG_MINUET:
canplay = Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_A) &&
Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_LEFT) &&
Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_RIGHT) &&
Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_UP);
break;
case QUEST_SONG_BOLERO:
canplay = Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_A) &&
Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_RIGHT) &&
Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_DOWN);
break;
case QUEST_SONG_SERENADE:
canplay = Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_A) &&
Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_LEFT) &&
Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_RIGHT) &&
Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_DOWN);
break;
case QUEST_SONG_REQUIEM:
canplay = Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_A) &&
Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_RIGHT) &&
Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_DOWN);
break;
case QUEST_SONG_NOCTURNE:
canplay = Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_A) &&
Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_LEFT) &&
Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_RIGHT) &&
Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_DOWN);
break;
case QUEST_SONG_PRELUDE:
canplay = Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_LEFT) &&
Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_RIGHT) &&
Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_UP);
break;
}
if (!canplay) {
return;
}
}
ActivateWarp(&gPlayState->pauseCtx, song);
}
}