From 3633bdeeaf84821905b0c9cddc9c8a1401cf6df7 Mon Sep 17 00:00:00 2001 From: Josh Bodner Date: Wed, 20 Jul 2022 19:57:38 -0700 Subject: [PATCH 01/16] Fix Child Zelda Skip rando setting always on --- .../randomizer/3drando/spoiler_log.cpp | 2 +- .../Enhancements/randomizer/randomizer.cpp | 128 +++++++++--------- 2 files changed, 67 insertions(+), 63 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp index 5deea4088..a253cf12d 100644 --- a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp @@ -373,7 +373,7 @@ 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; + jsonData["settings"]["Skip Child Zelda"] = std::format("{0}", Settings::skipChildZelda); } // spoilerLog.RootElement()->InsertEndChild(parentNode); diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 09704e867..aa9cb5611 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -1530,64 +1530,64 @@ void Randomizer::ParseRandomizerSettingsFile(const char* spoilerFileName) { // this is annoying but the same strings are used in different orders // and i don't want the spoilerfile to just have numbers instead of // human readable settings values so it'll have to do for now - switch(gSaveContext.randoSettings[index].key) { + switch (gSaveContext.randoSettings[index].key) { case RSK_FOREST: - if(it.value() == "Closed") { - gSaveContext.randoSettings[index].value = 0; - } else if(it.value() == "Open") { + if (it.value() == "Closed") { + gSaveContext.randoSettings[index].value = 0; + } else if (it.value() == "Open") { gSaveContext.randoSettings[index].value = 1; - } else if(it.value() == "Closed Deku") { + } else if (it.value() == "Closed Deku") { gSaveContext.randoSettings[index].value = 2; } break; case RSK_KAK_GATE: - if(it.value() == "Closed") { - gSaveContext.randoSettings[index].value = 0; - } else if(it.value() == "Open") { + if (it.value() == "Closed") { + gSaveContext.randoSettings[index].value = 0; + } else if (it.value() == "Open") { gSaveContext.randoSettings[index].value = 1; } break; case RSK_DOOR_OF_TIME: - if(it.value() == "Open") { - gSaveContext.randoSettings[index].value = 0; - } else if(it.value() == "Closed") { + if (it.value() == "Open") { + gSaveContext.randoSettings[index].value = 0; + } else if (it.value() == "Closed") { gSaveContext.randoSettings[index].value = 1; - } else if(it.value() == "Intended") { + } else if (it.value() == "Intended") { gSaveContext.randoSettings[index].value = 2; } break; case RSK_ZORAS_FOUNTAIN: - if(it.value() == "Normal") { - gSaveContext.randoSettings[index].value = 0; - } else if(it.value() == "Adult") { + if (it.value() == "Normal") { + gSaveContext.randoSettings[index].value = 0; + } else if (it.value() == "Adult") { gSaveContext.randoSettings[index].value = 1; - } else if(it.value() == "Open") { + } else if (it.value() == "Open") { gSaveContext.randoSettings[index].value = 2; } break; case RSK_GERUDO_FORTRESS: - if(it.value() == "Normal") { - gSaveContext.randoSettings[index].value = 0; - } else if(it.value() == "Fast") { + if (it.value() == "Normal") { + gSaveContext.randoSettings[index].value = 0; + } else if (it.value() == "Fast") { gSaveContext.randoSettings[index].value = 1; - } else if(it.value() == "Open") { + } else if (it.value() == "Open") { gSaveContext.randoSettings[index].value = 2; } break; case RSK_RAINBOW_BRIDGE: - if(it.value() == "Open") { - gSaveContext.randoSettings[index].value = 0; - } else if(it.value() == "Vanilla") { + if (it.value() == "Open") { + gSaveContext.randoSettings[index].value = 0; + } else if (it.value() == "Vanilla") { gSaveContext.randoSettings[index].value = 1; - } else if(it.value() == "Stones") { + } else if (it.value() == "Stones") { gSaveContext.randoSettings[index].value = 2; - } else if(it.value() == "Medallions") { + } else if (it.value() == "Medallions") { gSaveContext.randoSettings[index].value = 3; - } else if(it.value() == "Rewards") { + } else if (it.value() == "Rewards") { gSaveContext.randoSettings[index].value = 4; - } else if(it.value() == "Dungeons") { + } else if (it.value() == "Dungeons") { gSaveContext.randoSettings[index].value = 5; - } else if(it.value() == "Tokens") { + } else if (it.value() == "Tokens") { gSaveContext.randoSettings[index].value = 6; } break; @@ -1603,82 +1603,86 @@ void Randomizer::ParseRandomizerSettingsFile(const char* spoilerFileName) { gSaveContext.randoSettings[index].value = std::stoi(numericValueString); break; case RSK_RANDOM_TRIALS: - if(it.value() == "Off") { - gSaveContext.randoSettings[index].value = 0; - } else if(it.value() == "On") { + if (it.value() == "Off") { + gSaveContext.randoSettings[index].value = 0; + } else if (it.value() == "On") { gSaveContext.randoSettings[index].value = 1; } break; case RSK_STARTING_MAPS_COMPASSES: - if(it.value() == "Own Dungeon") { - gSaveContext.randoSettings[index].value = 0; + if (it.value() == "Own Dungeon") { + gSaveContext.randoSettings[index].value = 0; } else if (it.value() == "Start With") { - gSaveContext.randoSettings[index].value = 1; + gSaveContext.randoSettings[index].value = 1; } break; case RSK_STARTING_DEKU_SHIELD: - if(it.value() == "Off") { - gSaveContext.randoSettings[index].value = 0; - } else if(it.value() == "On") { + if (it.value() == "Off") { + gSaveContext.randoSettings[index].value = 0; + } else if (it.value() == "On") { gSaveContext.randoSettings[index].value = 1; } break; case RSK_STARTING_KOKIRI_SWORD: - if(it.value() == "Off") { - gSaveContext.randoSettings[index].value = 0; - } else if(it.value() == "On") { + if (it.value() == "Off") { + gSaveContext.randoSettings[index].value = 0; + } else if (it.value() == "On") { gSaveContext.randoSettings[index].value = 1; } break; case RSK_STARTING_OCARINA: - if(it.value() == "Off") { - gSaveContext.randoSettings[index].value = 0; - } else if(it.value() == "Fairy Ocarina") { + if (it.value() == "Off") { + gSaveContext.randoSettings[index].value = 0; + } else if (it.value() == "Fairy Ocarina") { gSaveContext.randoSettings[index].value = 1; } break; case RSK_GOSSIP_STONE_HINTS: - if(it.value() == "No Hints") { - gSaveContext.randoSettings[index].value = 0; - } else if(it.value() == "Need Nothing") { + if (it.value() == "No Hints") { + gSaveContext.randoSettings[index].value = 0; + } else if (it.value() == "Need Nothing") { gSaveContext.randoSettings[index].value = 1; - } else if(it.value() == "Mask of Truth") { + } else if (it.value() == "Mask of Truth") { gSaveContext.randoSettings[index].value = 2; - } else if(it.value() == "Stone of Agony") { + } else if (it.value() == "Stone of Agony") { gSaveContext.randoSettings[index].value = 3; } break; case RSK_HINT_CLARITY: - if(it.value() == "Obscure") { - gSaveContext.randoSettings[index].value = 0; - } else if(it.value() == "Ambiguous") { + if (it.value() == "Obscure") { + gSaveContext.randoSettings[index].value = 0; + } else if (it.value() == "Ambiguous") { gSaveContext.randoSettings[index].value = 1; - } else if(it.value() == "Clear") { + } else if (it.value() == "Clear") { gSaveContext.randoSettings[index].value = 2; } break; case RSK_HINT_DISTRIBUTION: - if(it.value() == "Useless") { - gSaveContext.randoSettings[index].value = 0; - } else if(it.value() == "Balanced") { + if (it.value() == "Useless") { + gSaveContext.randoSettings[index].value = 0; + } else if (it.value() == "Balanced") { gSaveContext.randoSettings[index].value = 1; - } else if(it.value() == "Strong") { + } else if (it.value() == "Strong") { gSaveContext.randoSettings[index].value = 2; - } else if(it.value() == "Very Strong") { + } else if (it.value() == "Very Strong") { gSaveContext.randoSettings[index].value = 3; } break; case RSK_GANONS_BOSS_KEY: - if(it.value() == "Start With") { - gSaveContext.randoSettings[index].value = 0; - } else if(it.value() == "Vanilla") { + if (it.value() == "Start With") { + gSaveContext.randoSettings[index].value = 0; + } else if (it.value() == "Vanilla") { gSaveContext.randoSettings[index].value = 1; - } else if(it.value() == "Own Dungeon") { + } else if (it.value() == "Own Dungeon") { gSaveContext.randoSettings[index].value = 2; } break; case RSK_SKIP_CHILD_ZELDA: - gSaveContext.randoSettings[index].value = it.value(); + if (it.value() == "false") { + gSaveContext.randoSettings[index].value = 0; + } else if (it.value() == "true") { + gSaveContext.randoSettings[index].value = 1; + } break; case RSK_STARTING_CONSUMABLES: case RSK_FULL_WALLETS: From 795ee54f2b9ccd7110d51021310dab3be0bf80c6 Mon Sep 17 00:00:00 2001 From: Josh Bodner Date: Wed, 20 Jul 2022 21:44:32 -0700 Subject: [PATCH 02/16] Remove use of std::format since Jenkins doesn't like it --- soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp | 2 +- soh/soh/Enhancements/randomizer/randomizer.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp index a253cf12d..d41a8a11f 100644 --- a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp @@ -373,7 +373,7 @@ 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"] = std::format("{0}", Settings::skipChildZelda); + jsonData["settings"]["Skip Child Zelda"] = Settings::skipChildZelda ? "On" : "Off"; } // spoilerLog.RootElement()->InsertEndChild(parentNode); diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index aa9cb5611..d77163456 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -1678,9 +1678,9 @@ void Randomizer::ParseRandomizerSettingsFile(const char* spoilerFileName) { } break; case RSK_SKIP_CHILD_ZELDA: - if (it.value() == "false") { + if (it.value() == "No") { gSaveContext.randoSettings[index].value = 0; - } else if (it.value() == "true") { + } else if (it.value() == "Yes") { gSaveContext.randoSettings[index].value = 1; } break; From 75a4d2cf9987d30dcb27818da9eea4821d2316ce Mon Sep 17 00:00:00 2001 From: Josh Bodner Date: Wed, 20 Jul 2022 21:50:55 -0700 Subject: [PATCH 03/16] Actually use the same strings everywhere lol --- soh/soh/Enhancements/randomizer/randomizer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index d77163456..d2894622d 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -1678,9 +1678,9 @@ void Randomizer::ParseRandomizerSettingsFile(const char* spoilerFileName) { } break; case RSK_SKIP_CHILD_ZELDA: - if (it.value() == "No") { + if (it.value() == "Off") { gSaveContext.randoSettings[index].value = 0; - } else if (it.value() == "Yes") { + } else if (it.value() == "On") { gSaveContext.randoSettings[index].value = 1; } break; From 17b3f65276b64153bd10e2c6d8164a8c848ab962 Mon Sep 17 00:00:00 2001 From: Josh Bodner Date: Wed, 20 Jul 2022 22:57:18 -0700 Subject: [PATCH 04/16] Fix the issue for real --- soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp index d41a8a11f..b182d8dca 100644 --- a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp @@ -42,7 +42,7 @@ static RandomizerHash randomizerHash; static SpoilerData spoilerData; void GenerateHash() { - for (size_t i = 0; i < Settings::seed.size(); i++) { + for (size_t i = 0; i < Settings::hashIconIndexes.size(); i++) { int number = Settings::seed[i] - '0'; Settings::hashIconIndexes[i] = number; } From cddca2700a2e9d133bbffea0956bb09d35ef735a Mon Sep 17 00:00:00 2001 From: Josh Bodner Date: Wed, 20 Jul 2022 23:08:57 -0700 Subject: [PATCH 05/16] Move Child Zelda spoiler write out of for loop so it's not repeatedly hit --- soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp index b182d8dca..8010bad06 100644 --- a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp @@ -371,10 +371,11 @@ 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 ? "On" : "Off"; } + + // 3drando doesn't have a "skip child zelda" setting, manually add it to the spoilerfile + jsonData["settings"]["Skip Child Zelda"] = Settings::skipChildZelda ? "On" : "Off"; + // spoilerLog.RootElement()->InsertEndChild(parentNode); // for (const uint32_t key : allLocations) { From 2edc81ee2d4171a0c977f6ae9f33954ee56446d9 Mon Sep 17 00:00:00 2001 From: Josh Bodner Date: Thu, 21 Jul 2022 11:03:28 -0700 Subject: [PATCH 06/16] Attempt to restore formatting of randomizer.cpp --- .../Enhancements/randomizer/randomizer.cpp | 128 +++++++++--------- 1 file changed, 62 insertions(+), 66 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index d2894622d..09704e867 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -1530,64 +1530,64 @@ void Randomizer::ParseRandomizerSettingsFile(const char* spoilerFileName) { // this is annoying but the same strings are used in different orders // and i don't want the spoilerfile to just have numbers instead of // human readable settings values so it'll have to do for now - switch (gSaveContext.randoSettings[index].key) { + switch(gSaveContext.randoSettings[index].key) { case RSK_FOREST: - if (it.value() == "Closed") { - gSaveContext.randoSettings[index].value = 0; - } else if (it.value() == "Open") { + if(it.value() == "Closed") { + gSaveContext.randoSettings[index].value = 0; + } else if(it.value() == "Open") { gSaveContext.randoSettings[index].value = 1; - } else if (it.value() == "Closed Deku") { + } else if(it.value() == "Closed Deku") { gSaveContext.randoSettings[index].value = 2; } break; case RSK_KAK_GATE: - if (it.value() == "Closed") { - gSaveContext.randoSettings[index].value = 0; - } else if (it.value() == "Open") { + if(it.value() == "Closed") { + gSaveContext.randoSettings[index].value = 0; + } else if(it.value() == "Open") { gSaveContext.randoSettings[index].value = 1; } break; case RSK_DOOR_OF_TIME: - if (it.value() == "Open") { - gSaveContext.randoSettings[index].value = 0; - } else if (it.value() == "Closed") { + if(it.value() == "Open") { + gSaveContext.randoSettings[index].value = 0; + } else if(it.value() == "Closed") { gSaveContext.randoSettings[index].value = 1; - } else if (it.value() == "Intended") { + } else if(it.value() == "Intended") { gSaveContext.randoSettings[index].value = 2; } break; case RSK_ZORAS_FOUNTAIN: - if (it.value() == "Normal") { - gSaveContext.randoSettings[index].value = 0; - } else if (it.value() == "Adult") { + if(it.value() == "Normal") { + gSaveContext.randoSettings[index].value = 0; + } else if(it.value() == "Adult") { gSaveContext.randoSettings[index].value = 1; - } else if (it.value() == "Open") { + } else if(it.value() == "Open") { gSaveContext.randoSettings[index].value = 2; } break; case RSK_GERUDO_FORTRESS: - if (it.value() == "Normal") { - gSaveContext.randoSettings[index].value = 0; - } else if (it.value() == "Fast") { + if(it.value() == "Normal") { + gSaveContext.randoSettings[index].value = 0; + } else if(it.value() == "Fast") { gSaveContext.randoSettings[index].value = 1; - } else if (it.value() == "Open") { + } else if(it.value() == "Open") { gSaveContext.randoSettings[index].value = 2; } break; case RSK_RAINBOW_BRIDGE: - if (it.value() == "Open") { - gSaveContext.randoSettings[index].value = 0; - } else if (it.value() == "Vanilla") { + if(it.value() == "Open") { + gSaveContext.randoSettings[index].value = 0; + } else if(it.value() == "Vanilla") { gSaveContext.randoSettings[index].value = 1; - } else if (it.value() == "Stones") { + } else if(it.value() == "Stones") { gSaveContext.randoSettings[index].value = 2; - } else if (it.value() == "Medallions") { + } else if(it.value() == "Medallions") { gSaveContext.randoSettings[index].value = 3; - } else if (it.value() == "Rewards") { + } else if(it.value() == "Rewards") { gSaveContext.randoSettings[index].value = 4; - } else if (it.value() == "Dungeons") { + } else if(it.value() == "Dungeons") { gSaveContext.randoSettings[index].value = 5; - } else if (it.value() == "Tokens") { + } else if(it.value() == "Tokens") { gSaveContext.randoSettings[index].value = 6; } break; @@ -1603,86 +1603,82 @@ void Randomizer::ParseRandomizerSettingsFile(const char* spoilerFileName) { gSaveContext.randoSettings[index].value = std::stoi(numericValueString); break; case RSK_RANDOM_TRIALS: - if (it.value() == "Off") { - gSaveContext.randoSettings[index].value = 0; - } else if (it.value() == "On") { + if(it.value() == "Off") { + gSaveContext.randoSettings[index].value = 0; + } else if(it.value() == "On") { gSaveContext.randoSettings[index].value = 1; } break; case RSK_STARTING_MAPS_COMPASSES: - if (it.value() == "Own Dungeon") { - gSaveContext.randoSettings[index].value = 0; + if(it.value() == "Own Dungeon") { + gSaveContext.randoSettings[index].value = 0; } else if (it.value() == "Start With") { - gSaveContext.randoSettings[index].value = 1; + gSaveContext.randoSettings[index].value = 1; } break; case RSK_STARTING_DEKU_SHIELD: - if (it.value() == "Off") { - gSaveContext.randoSettings[index].value = 0; - } else if (it.value() == "On") { + if(it.value() == "Off") { + gSaveContext.randoSettings[index].value = 0; + } else if(it.value() == "On") { gSaveContext.randoSettings[index].value = 1; } break; case RSK_STARTING_KOKIRI_SWORD: - if (it.value() == "Off") { - gSaveContext.randoSettings[index].value = 0; - } else if (it.value() == "On") { + if(it.value() == "Off") { + gSaveContext.randoSettings[index].value = 0; + } else if(it.value() == "On") { gSaveContext.randoSettings[index].value = 1; } break; case RSK_STARTING_OCARINA: - if (it.value() == "Off") { - gSaveContext.randoSettings[index].value = 0; - } else if (it.value() == "Fairy Ocarina") { + if(it.value() == "Off") { + gSaveContext.randoSettings[index].value = 0; + } else if(it.value() == "Fairy Ocarina") { gSaveContext.randoSettings[index].value = 1; } break; case RSK_GOSSIP_STONE_HINTS: - if (it.value() == "No Hints") { - gSaveContext.randoSettings[index].value = 0; - } else if (it.value() == "Need Nothing") { + if(it.value() == "No Hints") { + gSaveContext.randoSettings[index].value = 0; + } else if(it.value() == "Need Nothing") { gSaveContext.randoSettings[index].value = 1; - } else if (it.value() == "Mask of Truth") { + } else if(it.value() == "Mask of Truth") { gSaveContext.randoSettings[index].value = 2; - } else if (it.value() == "Stone of Agony") { + } else if(it.value() == "Stone of Agony") { gSaveContext.randoSettings[index].value = 3; } break; case RSK_HINT_CLARITY: - if (it.value() == "Obscure") { - gSaveContext.randoSettings[index].value = 0; - } else if (it.value() == "Ambiguous") { + if(it.value() == "Obscure") { + gSaveContext.randoSettings[index].value = 0; + } else if(it.value() == "Ambiguous") { gSaveContext.randoSettings[index].value = 1; - } else if (it.value() == "Clear") { + } else if(it.value() == "Clear") { gSaveContext.randoSettings[index].value = 2; } break; case RSK_HINT_DISTRIBUTION: - if (it.value() == "Useless") { - gSaveContext.randoSettings[index].value = 0; - } else if (it.value() == "Balanced") { + if(it.value() == "Useless") { + gSaveContext.randoSettings[index].value = 0; + } else if(it.value() == "Balanced") { gSaveContext.randoSettings[index].value = 1; - } else if (it.value() == "Strong") { + } else if(it.value() == "Strong") { gSaveContext.randoSettings[index].value = 2; - } else if (it.value() == "Very Strong") { + } else if(it.value() == "Very Strong") { gSaveContext.randoSettings[index].value = 3; } break; case RSK_GANONS_BOSS_KEY: - if (it.value() == "Start With") { - gSaveContext.randoSettings[index].value = 0; - } else if (it.value() == "Vanilla") { + if(it.value() == "Start With") { + gSaveContext.randoSettings[index].value = 0; + } else if(it.value() == "Vanilla") { gSaveContext.randoSettings[index].value = 1; - } else if (it.value() == "Own Dungeon") { + } else if(it.value() == "Own Dungeon") { gSaveContext.randoSettings[index].value = 2; } break; case RSK_SKIP_CHILD_ZELDA: - if (it.value() == "Off") { - gSaveContext.randoSettings[index].value = 0; - } else if (it.value() == "On") { - gSaveContext.randoSettings[index].value = 1; - } + gSaveContext.randoSettings[index].value = it.value(); break; case RSK_STARTING_CONSUMABLES: case RSK_FULL_WALLETS: From 1d208c7dc21c717376b0240d987737e75d76e6e9 Mon Sep 17 00:00:00 2001 From: Josh Bodner Date: Thu, 21 Jul 2022 11:04:37 -0700 Subject: [PATCH 07/16] Revert to using boolean in json --- soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp index 8010bad06..c64134fbc 100644 --- a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp @@ -374,7 +374,7 @@ 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 ? "On" : "Off"; + jsonData["settings"]["Skip Child Zelda"] = Settings::skipChildZelda; // spoilerLog.RootElement()->InsertEndChild(parentNode); From 41d1bbe13750c78df3de1d5f2d64e1a05890ec33 Mon Sep 17 00:00:00 2001 From: Jeffrey Crowell Date: Thu, 21 Jul 2022 18:27:44 -0400 Subject: [PATCH 08/16] Fix nullptr dereference in morpha (#870) reported on discord, i don't have the ability to reproduce this, but it appears to be a benign fix, as the only time that the tent2 is checked down later is guarded by a null check. --- soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index 8adea13af..3dbc97a07 100644 --- a/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -929,7 +929,7 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_0; Math_ApproachF(&this->baseAlpha, 0.0, 1.0f, 5.0f); for (indS1 = 0; indS1 < 40; indS1++) { - if (sMorphaTent2->tentSpawnPos) {} + if (sMorphaTent2 && sMorphaTent2->tentSpawnPos) {} indT5 = Rand_ZeroFloat(20.9f); indS0 = sTentSpawnIndex[indT5]; spFC.x = 0; @@ -3604,4 +3604,4 @@ void BossMo_Reset(void) { sBossGanonSeed1 = 0; sBossGanonSeed2 = 0; sBossGanonSeed3 = 0; -} \ No newline at end of file +} From 880e3928cfaf9cd317e4ce74602bb31cca260f50 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Thu, 21 Jul 2022 18:28:43 -0400 Subject: [PATCH 09/16] Fixes odd rando interaction with malon after receiving her check. (#867) --- soh/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/soh/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/soh/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c index 15b0b8455..b0ff90eac 100644 --- a/soh/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/soh/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -290,7 +290,8 @@ void EnMa1_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 6; this->unk_1E8.unk_00 = 0; - if (!(gSaveContext.eventChkInf[1] & 0x10) || (CHECK_QUEST_ITEM(QUEST_SONG_EPONA) && !gSaveContext.n64ddFlag)) { + if (!(gSaveContext.eventChkInf[1] & 0x10) || (CHECK_QUEST_ITEM(QUEST_SONG_EPONA) && !gSaveContext.n64ddFlag) || + (gSaveContext.n64ddFlag && Flags_GetTreasure(globalCtx, 0x1F))) { this->actionFunc = func_80AA0D88; EnMa1_ChangeAnim(this, ENMA1_ANIM_2); } else { From dfa929a16fea084fb61c872963d00e25f7b672fd Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Thu, 21 Jul 2022 18:31:26 -0400 Subject: [PATCH 10/16] Reset var for shadow boss key room spike walls (#860) --- soh/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c b/soh/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c index 877916b67..e12549c2b 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c @@ -228,8 +228,8 @@ void func_8087FFC0(BgHakaTrap* this, GlobalContext* globalCtx) { this->colliderCylinder.dim.pos.z = this->dyna.actor.world.pos.z + sp28.x * sine + sp28.z * cosine; } +static UNK_TYPE D_80881018 = 0; void func_808801B8(BgHakaTrap* this, GlobalContext* globalCtx) { - static UNK_TYPE D_80881018 = 0; Player* player = GET_PLAYER(globalCtx); if ((D_80880F30 == 0) && (!Player_InCsMode(globalCtx))) { @@ -553,4 +553,5 @@ void BgHakaTrap_Draw(Actor* thisx, GlobalContext* globalCtx) { void BgHakaTrap_Reset(void) { D_80880F30 = 0; D_80881014 = 0; + D_80881018 = 0; } \ No newline at end of file From e41873fff47295a76337ebd7b20b9dab65d9855e Mon Sep 17 00:00:00 2001 From: RaelCappra Date: Thu, 21 Jul 2022 19:34:04 -0300 Subject: [PATCH 11/16] Savestate crash fix on Ubuntu (#843) --- soh/soh/Enhancements/savestates.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/soh/soh/Enhancements/savestates.cpp b/soh/soh/Enhancements/savestates.cpp index 33ee3eb04..bddd2cfaa 100644 --- a/soh/soh/Enhancements/savestates.cpp +++ b/soh/soh/Enhancements/savestates.cpp @@ -869,21 +869,19 @@ SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) { switch (request.type) { case RequestType::SAVE: requests.push(request); - break; + return SaveStateReturn::SUCCESS; case RequestType::LOAD: if (states.contains(request.slot)) { requests.push(request); + return SaveStateReturn::SUCCESS; } else { SPDLOG_ERROR("Invalid SaveState slot: {}", request.type); SohImGui::overlay->TextDrawNotification(1.0f, true, "state slot %u empty", request.slot); return SaveStateReturn::FAIL_INVALID_SLOT; } - break; [[unlikely]] default: SPDLOG_ERROR("Invalid SaveState request type: {}", request.type); return SaveStateReturn::FAIL_BAD_REQUEST; - break; - } } From d08b1d277edc55ca01f9b497e96b91f97244dbba Mon Sep 17 00:00:00 2001 From: RaelCappra Date: Thu, 21 Jul 2022 19:34:35 -0300 Subject: [PATCH 12/16] Savestate crash fix on Ubuntu (#843) From eb49053e73f86233c2e93e3aae06e4e2bdc45c11 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Thu, 21 Jul 2022 18:35:30 -0400 Subject: [PATCH 13/16] Prevent unrestricted items camera crash (#852) --- soh/src/code/z_room.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/soh/src/code/z_room.c b/soh/src/code/z_room.c index ab3d04721..04f2d421b 100644 --- a/soh/src/code/z_room.c +++ b/soh/src/code/z_room.c @@ -402,6 +402,12 @@ BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) { camera = GET_ACTIVE_CAM(globalCtx); camId = camera->camDataIdx; + if (camId == -1 && CVar_GetS32("gNoRestrictItems", 0)) { + // This prevents a crash when using items that change the + // camera (such as din's fire) on scenes with prerendered backgrounds + return NULL; + } + // jfifid camId2 = func_80041C10(&globalCtx->colCtx, camId, BGCHECK_SCENE)[2].y; if (camId2 >= 0) { From c19beca9806f2536329174dbb423340ea4e48559 Mon Sep 17 00:00:00 2001 From: Baoulettes Date: Fri, 22 Jul 2022 00:36:46 +0200 Subject: [PATCH 14/16] Fast Save Loader crashes fixes (#848) --- libultraship/libultraship/ImGuiImpl.cpp | 16 +- soh/soh/SaveManager.cpp | 17 ++ soh/soh/SaveManager.h | 3 +- .../overlays/gamestates/ovl_title/z_title.c | 173 +++++++++--------- 4 files changed, 119 insertions(+), 90 deletions(-) diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index b9ce62aee..c08e2f033 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -1335,10 +1335,20 @@ namespace SohImGui { EnhancementCheckbox("OoT Debug Mode", "gDebugEnabled"); Tooltip("Enables Debug Mode, allowing you to select maps with L + R + Z, noclip with L + D-pad Right,\nand open the debug menu with L on the pause screen"); EnhancementCheckbox("Fast File Select", "gSkipLogoTitle"); - Tooltip("Load the game to the selected slot below upon launch\nUse slot number 4 to load directly into the game's internal Map Select\n(Does not require the Debug Menu, but you will be unable to save there\nYou can also load the Map Select with OoT Debug Mode + slot 0)\nWith slot 0 you can directly go to the File Select menu\nAttention: loading an empty save file will result in a crash"); + Tooltip("Load the game to the selected menu or file\n\"Zelda Map Select\" require debug mode else you will fallback to File choose menu\nUsing a file number that don't have save will create a save file only\nif you toggle on \"Create a new save if none ?\" else it will bring you to the\nFile choose menu"); if (CVar_GetS32("gSkipLogoTitle", 0)) { - EnhancementSliderInt("Loading %d", "##SaveFileID", "gSaveFileID", 0, 4, ""); - } + const char* FastFileSelect[5] = { + "File N.1", + "File N.2", + "File N.3", + "File select", + "Zelda Map Select (require OoT Debug Mode)" + }; + ImGui::Text("Loading :"); + EnhancementCombobox("gSaveFileID", FastFileSelect, 5, 0); + EnhancementCheckbox("Create a new save if none", "gCreateNewSave"); + Tooltip("Enable the creation of a new save file\nif none exist in the File number selected\nNo file name will be assigned please do in Save editor once you see the first text\nelse your save file name will be named \"00000000\"\nIf disabled you will fall back in File select menu"); + }; ImGui::Separator(); EnhancementCheckbox("Stats", "gStatsEnabled"); Tooltip("Shows the stats window, with your FPS and frametimes,\nand the OS you're playing on"); diff --git a/soh/soh/SaveManager.cpp b/soh/soh/SaveManager.cpp index cbe4315d3..f59cf0ecc 100644 --- a/soh/soh/SaveManager.cpp +++ b/soh/soh/SaveManager.cpp @@ -517,6 +517,19 @@ void SaveManager::LoadFile(int fileNum) { InitMeta(fileNum); } +bool SaveManager::SaveFile_Exist(int fileNum) { + + try { + std::filesystem::exists(GetFileName(fileNum)); + printf("File[%d] - exist \n",fileNum); + return true; + } + catch(std::filesystem::filesystem_error const& ex) { + printf("File[%d] - do not exist \n",fileNum); + return false; + } +} + void SaveManager::AddInitFunction(InitFunc func) { initFuncs.emplace_back(func); } @@ -1332,3 +1345,7 @@ extern "C" void Save_CopyFile(int from, int to) { extern "C" void Save_DeleteFile(int fileNum) { SaveManager::Instance->DeleteZeldaFile(fileNum); } + +extern "C" bool Save_Exist(int fileNum) { + return SaveManager::Instance->SaveFile_Exist(fileNum); +} \ No newline at end of file diff --git a/soh/soh/SaveManager.h b/soh/soh/SaveManager.h index 2304bb4b5..ee13451fb 100644 --- a/soh/soh/SaveManager.h +++ b/soh/soh/SaveManager.h @@ -41,6 +41,7 @@ public: void SaveFile(int fileNum); void SaveGlobal(); void LoadFile(int fileNum); + bool SaveFile_Exist(int fileNum); // Adds a function that is called when we are intializing a save, including when we are loading a save. void AddInitFunction(InitFunc func); @@ -149,5 +150,5 @@ void Save_AddSaveFunction(char* name, int version, Save_SaveFunc func); SaveFileMetaInfo* Save_GetSaveMetaInfo(int fileNum); void Save_CopyFile(int from, int to); void Save_DeleteFile(int fileNum); - +bool Save_Exist(int fileNum); #endif diff --git a/soh/src/overlays/gamestates/ovl_title/z_title.c b/soh/src/overlays/gamestates/ovl_title/z_title.c index 0ab8e699e..50c7c8a36 100644 --- a/soh/src/overlays/gamestates/ovl_title/z_title.c +++ b/soh/src/overlays/gamestates/ovl_title/z_title.c @@ -11,9 +11,9 @@ #include "textures/nintendo_rogo_static/nintendo_rogo_static.h" #include #include "GameVersions.h" +#include const char* GetGameVersionString(); - char* quote; void Title_PrintBuildInfo(Gfx** gfxp) { @@ -224,72 +224,6 @@ void Title_Draw(TitleContext* this) { void Title_Main(GameState* thisx) { TitleContext* this = (TitleContext*)thisx; - if (CVar_GetS32("gSkipLogoTitle",0)!=0) { - gSaveContext.language = CVar_GetS32("gLanguages", 0); - Sram_InitSram(&this->state); - s16 selectedfile = CVar_GetS32("gSaveFileID", 0); - if (selectedfile == 4) { - selectedfile = 0xFF; - } else if(selectedfile == 0){ - gSaveContext.fileNum = selectedfile; - gSaveContext.gameMode = 0; - this->state.running = false; - SET_NEXT_GAMESTATE(&this->state, FileChoose_Init, SelectContext); - return; - } else { - selectedfile--; - if (selectedfile < 0) { - selectedfile = 0xFF; - } - } - if (selectedfile == 0xFF) { - gSaveContext.fileNum = selectedfile; - Sram_OpenSave(); - gSaveContext.gameMode = 0; - this->state.running = false; - SET_NEXT_GAMESTATE(&this->state, Select_Init, SelectContext); - } else { - gSaveContext.fileNum = selectedfile; - Sram_OpenSave(); - gSaveContext.gameMode = 0; - this->state.running = false; - //return; - SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext); - } - gSaveContext.respawn[0].entranceIndex = -1; - gSaveContext.respawnFlag = 0; - gSaveContext.seqId = (u8)NA_BGM_DISABLED; - gSaveContext.natureAmbienceId = 0xFF; - gSaveContext.showTitleCard = true; - gSaveContext.dogParams = 0; - gSaveContext.timer1State = 0; - gSaveContext.timer2State = 0; - gSaveContext.eventInf[0] = 0; - gSaveContext.eventInf[1] = 0; - gSaveContext.eventInf[2] = 0; - gSaveContext.eventInf[3] = 0; - gSaveContext.unk_13EE = 0x32; - gSaveContext.nayrusLoveTimer = 0; - gSaveContext.healthAccumulator = 0; - gSaveContext.unk_13F0 = 0; - gSaveContext.unk_13F2 = 0; - gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX; - gSaveContext.skyboxTime = 0; - gSaveContext.nextTransition = 0xFF; - gSaveContext.nextCutsceneIndex = 0xFFEF; - gSaveContext.cutsceneTrigger = 0; - gSaveContext.chamberCutsceneNum = 0; - gSaveContext.nextDayTime = 0xFFFF; - gSaveContext.unk_13C3 = 0; - gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = gSaveContext.buttonStatus[4] = BTN_ENABLED; - gSaveContext.unk_13E7 = gSaveContext.unk_13E8 = gSaveContext.unk_13EA = gSaveContext.unk_13EC = gSaveContext.unk_13F4 = 0; - gSaveContext.unk_13F6 = gSaveContext.magic; - gSaveContext.magic = 0; - gSaveContext.magicLevel = gSaveContext.magic; - gSaveContext.naviTimer = 0; - return; - } - OPEN_DISPS(this->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0, NULL); @@ -330,27 +264,94 @@ void Title_Destroy(GameState* thisx) { void Title_Init(GameState* thisx) { //u32 size = 0; TitleContext* this = (TitleContext*)thisx; + FileChooseContext* FileChooseCtx = (FileChooseContext*)thisx; - quote = SetQuote(); + if (CVar_GetS32("gSkipLogoTitle",0)) { + bool saveloading = false; + Sram_InitSram(&this->state.init); + gSaveContext.language = CVar_GetS32("gLanguages", 0); + s32 selectedfile = CVar_GetS32("gSaveFileID", 0); + if (selectedfile == 4) { + if (CVar_GetS32("gDebugEnabled",0)) { + selectedfile = 0xFF; + } else { + selectedfile = 3; + } + } + if (selectedfile < 0) { + selectedfile = 3; //If somehow the save file number under 0 revert back to 3 to prevent boot error + } + if(selectedfile == 3){ + saveloading = true; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.natureAmbienceId = 0xFF; + gSaveContext.gameMode = 1; + SET_NEXT_GAMESTATE(&this->state, FileChoose_Init, FileChooseContext); + this->state.running = false; + return; + } else if (selectedfile == 0xFF || selectedfile > 3) { + saveloading = true; + Sram_InitDebugSave(); + gSaveContext.fileNum = selectedfile; + SET_NEXT_GAMESTATE(&this->state, Select_Init, SelectContext); + this->state.running = false; + return; + } else if (selectedfile >= 0 && selectedfile <= 2) { + if (Save_Exist(selectedfile) == true) { //The file exist load it + saveloading = true; + gSaveContext.fileNum = selectedfile; + Sram_OpenSave(); + gSaveContext.gameMode = 0; + gSaveContext.magic = gSaveContext.magic; + SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext); + this->state.running = false; + return; + } else { + if (CVar_GetS32("gCreateNewSave",0)) { + //File do not exist create a new save file + saveloading = true; + Sram_InitSram(&FileChooseCtx->state.init); + gSaveContext.fileNum = selectedfile; + Sram_InitSave(FileChooseCtx); + Sram_OpenSave(); + gSaveContext.gameMode = 0; + SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext); + this->state.running = false; + return; + } else { + //File do not exist but user do not wish to auto create a save file with blank name + saveloading = true; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.natureAmbienceId = 0xFF; + gSaveContext.gameMode = 1; + SET_NEXT_GAMESTATE(&this->state, FileChoose_Init, FileChooseContext); + this->state.running = false; + return; + } + } + } + } else { + quote = SetQuote(); - //this->staticSegment = GAMESTATE_ALLOC_MC(&this->state, size); - osSyncPrintf("z_title.c\n"); - //ASSERT(this->staticSegment != NULL); + //this->staticSegment = GAMESTATE_ALLOC_MC(&this->state, size); + osSyncPrintf("z_title.c\n"); + //ASSERT(this->staticSegment != NULL); - //ResourceMgr_CacheDirectory("nintendo_rogo_static*"); + //ResourceMgr_CacheDirectory("nintendo_rogo_static*"); - // Disable vismono - D_801614B0.a = 0; - R_UPDATE_RATE = 1; - Matrix_Init(&this->state); - View_Init(&this->view, this->state.gfxCtx); - this->state.main = Title_Main; - this->state.destroy = Title_Destroy; - this->exit = false; - gSaveContext.fileNum = 0xFF; - this->ult = 0; - this->unk_1D4 = 0x14; - this->coverAlpha = 255; - this->addAlpha = -3; - this->visibleDuration = 0x3C; + // Disable vismono + D_801614B0.a = 0; + R_UPDATE_RATE = 1; + Matrix_Init(&this->state); + View_Init(&this->view, this->state.gfxCtx); + this->state.main = Title_Main; + this->state.destroy = Title_Destroy; + this->exit = false; + gSaveContext.fileNum = 0xFF; + this->ult = 0; + this->unk_1D4 = 0x14; + this->coverAlpha = 255; + this->addAlpha = -3; + this->visibleDuration = 0x3C; + } } From 52f22275e3c8fab39d2792682687ecb78c9db271 Mon Sep 17 00:00:00 2001 From: Sarge-117 <108380086+Sarge-117@users.noreply.github.com> Date: Thu, 21 Jul 2022 15:39:04 -0700 Subject: [PATCH 15/16] Fix Giant's Knife unexpected behaviours (#834) * Giant's Knife Behaviour Fixes Fixes a case where Giant's Knife (specifically, breaking and re-buying it) can behave unexpectedly if you don't have a Kokiri Sword in your inventory. Also fixes the broken icon not showing up in inventory after you break it. * less whitespace * fix 0xE check Accidentally committed with the wrong check * Move the grayscale code up Moved the grayscaling portion up higher in the function and renamed "bool not_acquired" to "bool age_restricted". Thanks to @vaguerant for the suggestion! --- soh/src/code/z_parameter.c | 6 ++++-- .../ovl_kaleido_scope/z_kaleido_equipment.c | 19 +++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 4a79bd3bc..4c7443f9f 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -1676,13 +1676,15 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { if (item == ITEM_SWORD_BGS) { gSaveContext.swordHealth = 8; - if (ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xF) { - gSaveContext.inventory.equipment ^= 8 << gEquipShifts[EQUIP_SWORD]; + if (ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xF + ||(gSaveContext.n64ddFlag && ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xE)) { // In rando, when buying Giant's Knife, also check + gSaveContext.inventory.equipment ^= 8 << gEquipShifts[EQUIP_SWORD]; // for 0xE in case we don't have Kokiri Sword if (gSaveContext.equips.buttonItems[0] == ITEM_SWORD_KNIFE) { gSaveContext.equips.buttonItems[0] = ITEM_SWORD_BGS; Interface_LoadItemIcon1(globalCtx, 0); } } + } else if (item == ITEM_SWORD_MASTER) { gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER; gSaveContext.equips.equipment &= 0xFFF0; diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index a7d22e584..863c8ef4a 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -637,24 +637,23 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { gItemIcons[sAdultUpgradeItemBases[i] + CUR_UPG_VALUE(sAdultUpgrades[i]) - 1], 32, 32, 0); } } - + // Draw inventory screen icons for (k = 0, bit = rowStart, point = 4; k < 3; k++, point += 4, temp++, bit++) { + int itemId = ITEM_SWORD_KOKIRI + temp; + bool age_restricted = (gItemAgeReqs[itemId] != 9) && (gItemAgeReqs[itemId] != gSaveContext.linkAge); + if (age_restricted) { + gsDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255); + gsSPGrayscale(POLY_KAL_DISP++, true); + } if (((u32)i == 0) && (k == 2) && (gSaveContext.bgsFlag != 0)) { KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gBiggoronSwordIconTex, 32, 32, point); } else if ((i == 0) && (k == 2) && (gBitFlags[bit + 1] & gSaveContext.inventory.equipment)) { KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gBrokenGiantsKnifeIconTex, 32, 32, point); - } - if (gBitFlags[bit] & gSaveContext.inventory.equipment) { - int itemId = ITEM_SWORD_KOKIRI + temp; - bool not_acquired = (gItemAgeReqs[itemId] != 9) && (gItemAgeReqs[itemId] != gSaveContext.linkAge); - if (not_acquired) { - gsDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255); - gsSPGrayscale(POLY_KAL_DISP++, true); - } + } else if (gBitFlags[bit] & gSaveContext.inventory.equipment) { KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[itemId], 32, 32, point); - gsSPGrayscale(POLY_KAL_DISP++, false); } + gsSPGrayscale(POLY_KAL_DISP++, false); } } From 84236e7ac334c992e78920af0dfa1d6354413b51 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Thu, 21 Jul 2022 20:11:13 -0400 Subject: [PATCH 16/16] stop floor under shadow statue opening immediately (#857) * stop floor under shadow statue opening immediately * use ActorResetFunc to reset sStatueRotY Co-authored-by: briaguya --- soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c b/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c index bc77e2c26..894bf51fb 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c @@ -34,6 +34,7 @@ void BgHakaGate_Init(Actor* thisx, GlobalContext* globalCtx); void BgHakaGate_Destroy(Actor* thisx, GlobalContext* globalCtx); void BgHakaGate_Update(Actor* thisx, GlobalContext* globalCtx); void BgHakaGate_Draw(Actor* this, GlobalContext* globalCtx); +void BgHakaGate_Reset(void); void BgHakaGate_DoNothing(BgHakaGate* this, GlobalContext* globalCtx); void BgHakaGate_StatueInactive(BgHakaGate* this, GlobalContext* globalCtx); @@ -62,7 +63,7 @@ const ActorInit Bg_Haka_Gate_InitVars = { (ActorFunc)BgHakaGate_Destroy, (ActorFunc)BgHakaGate_Update, (ActorFunc)BgHakaGate_Draw, - NULL, + (ActorResetFunc)BgHakaGate_Reset, }; static InitChainEntry sInitChain[] = { @@ -378,3 +379,7 @@ void BgHakaGate_Draw(Actor* thisx, GlobalContext* globalCtx) { BgHakaGate_DrawFlame(this, globalCtx); } } + +void BgHakaGate_Reset(void) { + sStatueRotY = 0; +}