diff --git a/soh/soh/Enhancements/presets.h b/soh/soh/Enhancements/presets.h index 6304c79ce..bcd61c6ed 100644 --- a/soh/soh/Enhancements/presets.h +++ b/soh/soh/Enhancements/presets.h @@ -186,6 +186,14 @@ const std::vector enhancementsCvars = { "gBombchuBowlingNoSmallCucco", "gBombchuBowlingNoBigCucco", "gBombchuBowlingAmmunition", + "gCustomizeOcarinaGame", + "gInstantOcarinaGameWin", + "gOcarinaGameNoteSpeed", + "gOcarinaUnlimitedFailTime", + "gOcarinaGameStartingNotes", + "gOcarinaGameRoundOneNotes", + "gOcarinaGameRoundTwoNotes", + "gOcarinaGameRoundThreeNotes", "gCreditsFix", "gSilverRupeeJingleExtend", "gStaticExplosionRadius", @@ -787,6 +795,13 @@ const std::vector randomizerPresetEntries = { // Adult Minimum Weight (8 to 13) PRESET_ENTRY_S32("gAdultMinimumWeightFish", 6), + // Customize Lost Woods Ocarina Game Behavior + PRESET_ENTRY_S32("gCustomizeOcarinaGame", 1), + // Start With Five Notes + PRESET_ENTRY_S32("gOcarinaGameStartingNotes", 5), + // Round One Notes + PRESET_ENTRY_S32("gOcarinaGameRoundOneNotes", 5), + // Visual Stone of Agony PRESET_ENTRY_S32("gVisualAgony", 1), // Pull grave during the day diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index 7265087a0..4df2fb960 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -817,6 +817,40 @@ void DrawEnhancementsMenu() { UIWidgets::Tooltip("The minimum weight for the unique fishing reward as an adult"); ImGui::EndMenu(); } + UIWidgets::Spacer(0); + + if (ImGui::BeginMenu("Lost Woods Ocarina Game")) { + UIWidgets::EnhancementCheckbox("Customize Behavior", "gCustomizeOcarinaGame"); + UIWidgets::Tooltip("Turn on/off changes to the lost woods ocarina game behavior"); + bool disabled = !CVarGetInteger("gCustomizeOcarinaGame", 0); + static const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off"; + UIWidgets::PaddedEnhancementCheckbox("Instant Win", "gInstantOcarinaGameWin", true, false, disabled, disabledTooltip); + UIWidgets::Tooltip("Skips the lost woods ocarina game"); + UIWidgets::PaddedEnhancementSliderInt("Note Play Speed: %dx", "##OcarinaGameNoteSpeed", "gOcarinaGameNoteSpeed", 1, 5, "", 1, true, true, false, disabled, disabledTooltip); + UIWidgets::Tooltip("Adjust the speed that the skull kids play notes"); + UIWidgets::PaddedEnhancementCheckbox("Unlimited Playback Time", "gOcarinaUnlimitedFailTime", true, false, disabled, disabledTooltip); + UIWidgets::Tooltip("Removes the timer to play back the song"); + UIWidgets::PaddedEnhancementSliderInt("Number of Starting Notes: %d", "##OcarinaGameStartingNotes", "gOcarinaGameStartingNotes", 1, 8, "", 3, true, true, false, + disabled, disabledTooltip); + UIWidgets::Tooltip("Adjust the number of notes the skull kids play to start the first round"); + int roundMin = CVarGetInteger("gOcarinaGameStartingNotes", 3); + UIWidgets::PaddedEnhancementSliderInt("Round One Notes: %d", "##OcarinaGameRoundOne", + "gOcarinaGameRoundOneNotes", roundMin, 8, "", 5, true, true, + false, + disabled, disabledTooltip); + UIWidgets::Tooltip("Adjust the number of notes you need to play to end the first round"); + UIWidgets::PaddedEnhancementSliderInt("Round Two Notes: %d", "##OcarinaGameRoundTwoNotes", + "gOcarinaGameRoundTwoNotes", roundMin, 8, "", 6, true, true, + false, + disabled, disabledTooltip); + UIWidgets::Tooltip("Adjust the number of notes you need to play to end the second round"); + UIWidgets::PaddedEnhancementSliderInt("Round Three Notes: %d", "##OcarinaGameRoundThreeNotes", + "gOcarinaGameRoundThreeNotes", roundMin, 8, "", 8, true, true, + false, + disabled, disabledTooltip); + UIWidgets::Tooltip("Adjust the number of notes you need to play to end the third round"); + ImGui::EndMenu(); + } UIWidgets::Spacer(0); diff --git a/soh/src/code/code_800EC960.c b/soh/src/code/code_800EC960.c index 27de9b2d5..41d2a8ec3 100644 --- a/soh/src/code/code_800EC960.c +++ b/soh/src/code/code_800EC960.c @@ -2065,16 +2065,40 @@ void func_800EE404(void) { void Audio_OcaMemoryGameStart(u8 minigameRound) { u8 i; + + // #region SOH [Enhancement] + if (CVarGetInteger("gCustomizeOcarinaGame", 0)) { + u8 startingNotes = 3; + u8 roundOneCount = CVarGetInteger("gOcarinaGameRoundOneNotes", 5); + u8 roundTwoCount = CVarGetInteger("gOcarinaGameRoundTwoNotes", 6); + u8 roundThreeCount = CVarGetInteger("gOcarinaGameRoundThreeNotes", 8); + u8 modMinigameNoteCnts[] = { roundOneCount, roundTwoCount, roundThreeCount }; - if (minigameRound > 2) { - minigameRound = 2; - } - sOcaMinigameAppendPos = 0; - sOcaMinigameEndPos = sOcaMinigameNoteCnts[minigameRound]; + startingNotes = CVarGetInteger("gOcarinaGameStartingNotes", 3); - for (i = 0; i < 3; i++) { - Audio_OcaMemoryGameGenNote(); + if (minigameRound > 2) { + minigameRound = 2; + } + + sOcaMinigameAppendPos = 0; + sOcaMinigameEndPos = modMinigameNoteCnts[minigameRound]; + + for (i = 0; i < startingNotes; i++) { + Audio_OcaMemoryGameGenNote(); + } + // #endregion + } else { + if (minigameRound > 2) { + minigameRound = 2; + } + + sOcaMinigameAppendPos = 0; + sOcaMinigameEndPos = sOcaMinigameNoteCnts[minigameRound]; + + for (i = 0; i < 3; i++) { + Audio_OcaMemoryGameGenNote(); + } } } @@ -2093,11 +2117,24 @@ s32 Audio_OcaMemoryGameGenNote(void) { rndNote = sOcarinaNoteValues[(rnd + 1) % 5]; } - sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].noteIdx = rndNote; - sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].unk_02 = 0x2D; - sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].volume = 0x50; - sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].vibrato = 0; - sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].tone = 0; + // #region SOH [Enhancement] + if (CVarGetInteger("gCustomizeOcarinaGame", 0)) { + int noteSpeed = 0x2D; + noteSpeed = noteSpeed / CVarGetInteger("gOcarinaGameNoteSpeed", 1); + + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].noteIdx = rndNote; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].unk_02 = noteSpeed; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].volume = 0x50; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].vibrato = 0; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].tone = 0; + // #endregion + } else { + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].noteIdx = rndNote; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].unk_02 = 0x2D; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].volume = 0x50; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].vibrato = 0; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].tone = 0; + } sOcaMinigameAppendPos++; diff --git a/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c index 3492d6de9..207d9612b 100644 --- a/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -1412,12 +1412,20 @@ void EnSkj_StartOcarinaMinigame(EnSkj* this, PlayState* play) { EnSkj_TurnPlayer(this, player); if (dialogState == TEXT_STATE_CLOSING) { - func_8010BD58(play, OCARINA_ACTION_MEMORY_GAME); - if (sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid != NULL) { - sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid->minigameState = SKULL_KID_OCARINA_PLAY_NOTES; + // #region SOH [Enhancement] + if (CVarGetInteger("gInstantOcarinaGameWin", 0) && CVarGetInteger("gCustomizeOcarinaGame", 0)) { + play->msgCtx.ocarinaMode = OCARINA_MODE_0F; + this->songFailTimer = 160; + this->actionFunc = EnSkj_WaitForPlayback; + // #endregion + } else { + func_8010BD58(play, OCARINA_ACTION_MEMORY_GAME); + if (sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid != NULL) { + sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid->minigameState = SKULL_KID_OCARINA_PLAY_NOTES; + this->songFailTimer = 160; + this->actionFunc = EnSkj_WaitForPlayback; + } } - this->songFailTimer = 160; - this->actionFunc = EnSkj_WaitForPlayback; } } @@ -1466,7 +1474,14 @@ void EnSkj_WaitForPlayback(EnSkj* this, PlayState* play) { break; case MSGMODE_MEMORY_GAME_PLAYER_PLAYING: if (this->songFailTimer != 0) { - this->songFailTimer--; + // #region SOH [Enhancement] + if (CVarGetInteger("gOcarinaUnlimitedFailTime", 0) == 1 && + CVarGetInteger("gCustomizeOcarinaGame", 0) == 1) { + // don't decrement timer + // #endregion + } else { + this->songFailTimer--; + } } else { // took too long, game failed func_80078884(NA_SE_SY_OCARINA_ERROR); Message_CloseTextbox(play);