From f756da02e5b06b4aac2d462f943e1c980f9dcc61 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Thu, 20 Oct 2022 22:13:08 -0400 Subject: [PATCH] Fixes a few bugs I introduced for MQ file select screen. (#1808) * Fixes a few bugs I introduced for MQ file select screen. - MQ Saves could not be loaded while only an mq otr is present, because `requiresOriginal` was true when `gSaveContext.mqDungeonCount` was less than 12. That value only ever gets set for rando saves, so I added a check for the rando flag to that conditional. - The rando tag was not getting grayed out with the rest of the save file. - Some necessary meta info wasn't getting loaded when the randomizer CVar was off. Removed that check so that the rando save data always gets loaded during InitMeta. That way the amount of mq dungeons can be checked for validity with the loaded set of OTRs even if randomizer isn't enabled. * i not 1 Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> --- soh/soh/SaveManager.cpp | 9 +++++---- .../overlays/gamestates/ovl_file_choose/z_file_choose.c | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/soh/soh/SaveManager.cpp b/soh/soh/SaveManager.cpp index 2bb272ff5..5a9c35ac2 100644 --- a/soh/soh/SaveManager.cpp +++ b/soh/soh/SaveManager.cpp @@ -128,8 +128,6 @@ void SaveManager::LoadRandomizerVersion1() { } void SaveManager::LoadRandomizerVersion2() { - if(!CVar_GetS32("gRandomizer", 0)) return; - SaveManager::Instance->LoadArray("itemLocations", RC_MAX, [&](size_t i) { gSaveContext.itemLocations[i].check = RandomizerCheck(i); SaveManager::Instance->LoadStruct("", [&]() { @@ -338,8 +336,11 @@ void SaveManager::InitMeta(int fileNum) { } fileMetaInfo[fileNum].randoSave = gSaveContext.n64ddFlag; - fileMetaInfo[fileNum].requiresMasterQuest = gSaveContext.isMasterQuest || gSaveContext.mqDungeonCount > 0; - fileMetaInfo[fileNum].requiresOriginal = !gSaveContext.isMasterQuest || gSaveContext.mqDungeonCount < 12; + // If the file is marked as a Master Quest file or if we're randomized and have at least one master quest dungeon, we need the mq otr. + fileMetaInfo[fileNum].requiresMasterQuest = gSaveContext.isMasterQuest > 0 || (gSaveContext.n64ddFlag && gSaveContext.mqDungeonCount > 0); + // If the file is not marked as Master Quest, it could still theoretically be a rando save with all 12 MQ dungeons, in which case + // we don't actually require a vanilla OTR. + fileMetaInfo[fileNum].requiresOriginal = !gSaveContext.isMasterQuest && (!gSaveContext.n64ddFlag || gSaveContext.mqDungeonCount < 12); } void SaveManager::InitFile(bool isDebug) { diff --git a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index 4d5d232fb..7c1128899 100644 --- a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -1113,7 +1113,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) { // draw rando label if (Save_GetSaveMetaInfo(i)->randoSave) { - if (CVar_GetS32("gHudColors", 1) == 2) { + if (CVar_GetS32("gHudColors", 1) == 2 && FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->nameAlpha[i]); } else if (!FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[1][0], sWindowContentColors[1][1],