From acb2fbbb3844eb65fa3e2ebb33bb917f56286c03 Mon Sep 17 00:00:00 2001 From: briaguya Date: Fri, 23 Jun 2023 20:21:57 -0400 Subject: [PATCH] handle random mq dungeon count better --- .../randomizer/3drando/spoiler_log.cpp | 9 +++++++++ soh/soh/Enhancements/randomizer/randomizer.cpp | 15 ++++++++++++++- .../randomizer/randomizer_check_tracker.cpp | 8 ++++---- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp index dc4f41ae027..098652f10ff 100644 --- a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp @@ -402,6 +402,15 @@ static void WriteSettings(const bool printAll = false) { // 3drando doesn't have a "skip child zelda" setting, manually add it to the spoilerfile jsonData["settings"]["Skip Child Zelda"] = Settings::skipChildZelda; + // 3drando uses an MQ dungeon count of 13 to mean random, manually add that to the spoilerfile as a bool + if (Settings::MQDungeonCount.GetSelectedOptionIndex() == 0) { + jsonData["settings"]["World Settings:MQ Dungeons"] = "None"; + } else if (Settings::MQDungeonCount.GetSelectedOptionIndex() == 13) { + jsonData["settings"]["World Settings:MQ Dungeons"] = "Random Number"; + } else { + jsonData["settings"]["World Settings:MQ Dungeons"] = "Set Number"; + } + // spoilerLog.RootElement()->InsertEndChild(parentNode); // for (const uint32_t key : allLocations) { diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 202147bb94d..08b21372562 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -348,6 +348,7 @@ std::unordered_map SpoilerfileSettingNameToEn { "Timesaver Settings:Complete Mask Quest", RSK_COMPLETE_MASK_QUEST }, { "Timesaver Settings:Skip Scarecrow's Song", RSK_SKIP_SCARECROWS_SONG }, { "Timesaver Settings:Enable Glitch-Useful Cutscenes", RSK_ENABLE_GLITCH_CUTSCENES }, + { "World Settings:MQ Dungeons", RSK_RANDOM_MQ_DUNGEONS }, { "World Settings:MQ Dungeon Count", RSK_MQ_DUNGEON_COUNT } }; @@ -1032,6 +1033,15 @@ void Randomizer::ParseRandomizerSettingsFile(const char* spoilerFileName) { gSaveContext.randoSettings[index].value = RO_GANON_BOSS_KEY_KAK_TOKENS; } break; + case RSK_RANDOM_MQ_DUNGEONS: + if (it.value() == "None") { + gSaveContext.randoSettings[index].value = RO_MQ_DUNGEONS_NONE; + } else if (it.value() == "Random Number") { + gSaveContext.randoSettings[index].value = RO_MQ_DUNGEONS_RANDOM_NUMBER; + } else if (it.value() == "Set Number") { + gSaveContext.randoSettings[index].value = RO_MQ_DUNGEONS_SET_NUMBER; + } + break; case RSK_SKIP_CHILD_ZELDA: gSaveContext.randoSettings[index].value = it.value(); break; @@ -5409,7 +5419,10 @@ CustomMessage Randomizer::GetMapGetItemMessageWithHint(GetItemEntry itemEntry) { break; } - if (this->masterQuestDungeons.empty() || this->masterQuestDungeons.size() >= 12) { + if (this->randoSettings[RSK_RANDOM_MQ_DUNGEONS] == RO_MQ_DUNGEONS_NONE || + (this->randoSettings[RSK_RANDOM_MQ_DUNGEONS] == RO_MQ_DUNGEONS_SET_NUMBER && + this->randoSettings[RSK_MQ_DUNGEON_COUNT] == 12) + ) { messageEntry.Replace("{{typeHint}}", ""); } else if (ResourceMgr_IsSceneMasterQuest(sceneNum)) { messageEntry.Replace("{{typeHint}}", mapGetItemHints[0][1], mapGetItemHints[1][1], mapGetItemHints[2][1]); diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index 6998c6bb5c5..d1e5514be19 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -567,10 +567,10 @@ void InitializeChecks() { areasSpoiled |= (1 << rcObj.rcArea); } - showVOrMQ = (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_MQ_DUNGEON_COUNT) > 0); - //Bug: the above will spoil that everything is vanilla if the random count rolled 0. - // Should use the below instead, but the setting isn't currently saved to the savefile - //showVOrMQ = (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_RANDOM_MQ_DUNGEONS) != RO_GENERIC_OFF); + showVOrMQ = (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_RANDOM_MQ_DUNGEONS) == RO_MQ_DUNGEONS_RANDOM_NUMBER || + (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_RANDOM_MQ_DUNGEONS) == RO_MQ_DUNGEONS_SET_NUMBER && + OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_MQ_DUNGEON_COUNT) < 12) + ); UpdateChecks(); UpdateInventoryChecks();