From 77f2e56039033756ace1ed0899d61e52a2b48608 Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Sat, 6 Aug 2022 14:07:46 -0500 Subject: [PATCH] Support starts with and more options on ganons boss key --- .../Enhancements/randomizer/randomizer.cpp | 74 +++++++++++++++---- soh/src/code/z_sram.c | 25 ++++++- 2 files changed, 82 insertions(+), 17 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index c65f144a58..d51f71d0bf 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -1684,13 +1684,61 @@ void Randomizer::ParseRandomizerSettingsFile(const char* spoilerFileName) { gSaveContext.randoSettings[index].value = 3; } break; - case RSK_GANONS_BOSS_KEY: - if(it.value() == "Start with") { + case RSK_KEYSANITY: + 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; + } else if(it.value() == "Any Dungeon") { + gSaveContext.randoSettings[index].value = 3; + } else if(it.value() == "Overworld") { + gSaveContext.randoSettings[index].value = 4; + } else if(it.value() == "Anywhere") { + gSaveContext.randoSettings[index].value = 5; + } + break; + case RSK_BOSS_KEYSANITY: + 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") { + gSaveContext.randoSettings[index].value = 2; + } else if(it.value() == "Any Dungeon") { + gSaveContext.randoSettings[index].value = 3; + } else if(it.value() == "Overworld") { + gSaveContext.randoSettings[index].value = 4; + } else if(it.value() == "Anywhere") { + gSaveContext.randoSettings[index].value = 5; + } + break; + case RSK_GANONS_BOSS_KEY: + if(it.value() == "Vanilla") { + gSaveContext.randoSettings[index].value = 0; + } else if(it.value() == "Own dungeon") { + gSaveContext.randoSettings[index].value = 1; + } else if(it.value() == "Start with") { + gSaveContext.randoSettings[index].value = 2; + } else if(it.value() == "Any Dungeon") { + gSaveContext.randoSettings[index].value = 3; + } else if(it.value() == "Overworld") { + gSaveContext.randoSettings[index].value = 4; + } else if(it.value() == "Anywhere") { + gSaveContext.randoSettings[index].value = 5; + } else if(it.value() == "LACS-Vanilla") { + gSaveContext.randoSettings[index].value = 6; + } else if(it.value() == "LACS-Medallions") { + gSaveContext.randoSettings[index].value = 7; + } else if(it.value() == "LACS-Stones") { + gSaveContext.randoSettings[index].value = 8; + } else if(it.value() == "LACS-Rewards") { + gSaveContext.randoSettings[index].value = 9; + } else if(it.value() == "LACS-Dungeons") { + gSaveContext.randoSettings[index].value = 10; + } else if(it.value() == "LACS-Tokens") { + gSaveContext.randoSettings[index].value = 11; } break; case RSK_SKIP_CHILD_ZELDA: @@ -3479,9 +3527,9 @@ void GenerateRandomizerImgui() { cvarSettings[RSK_GOSSIP_STONE_HINTS] = CVar_GetS32("gRandomizeGossipStoneHints", 1); cvarSettings[RSK_HINT_CLARITY] = CVar_GetS32("gRandomizeHintClarity", 2); cvarSettings[RSK_HINT_DISTRIBUTION] = CVar_GetS32("gRandomizeHintDistribution", 1); - cvarSettings[RSK_KEYSANITY] = CVar_GetS32("gRandomizeKeysanity", 0); + cvarSettings[RSK_KEYSANITY] = CVar_GetS32("gRandomizeKeysanity", 1); cvarSettings[RSK_GERUDO_KEYS] = CVar_GetS32("gRandomizeGerudoKeys", 0); - cvarSettings[RSK_BOSS_KEYSANITY] = CVar_GetS32("gRandomizeBossKeysanity", 0); + cvarSettings[RSK_BOSS_KEYSANITY] = CVar_GetS32("gRandomizeBossKeysanity", 1); cvarSettings[RSK_GANONS_BOSS_KEY] = CVar_GetS32("gRandomizeShuffleGanonBossKey", 0); cvarSettings[RSK_STARTING_CONSUMABLES] = CVar_GetS32("gRandomizeStartingConsumables", 0); cvarSettings[RSK_FULL_WALLETS] = CVar_GetS32("gRandomizeFullWallets", 0); @@ -3570,14 +3618,13 @@ void DrawRandoEditor(bool& open) { // Shuffle Dungeon Items Settings const char* randoShuffleMapsAndCompasses[6] = { "Own Dungeon", "Any Dungeon", "Overworld", - "Anywhere", "Start with", "Vanilla" }; + "Anywhere", "Start With", "Vanilla" }; const char* randoShuffleSmallKeys[6] = { "Start With", "Vanilla", "Own Dungeon", "Any Dungeon", "Overworld", "Anywhere" }; const char* randoShuffleGerudoFortressKeys[4] = { "Vanilla", "Any Dungeon", "Overworld", "Anywhere" }; const char* randoShuffleBossKeys[6] = { "Start With", "Vanilla", "Own Dungeon", "Any Dungeon", "Overworld", "Anywhere" }; - // const char* randoShuffleGanonsBossKey[12] = { "Own Dungeon", "Any Dungeon", "Overworld", "Anywhere", - // "LACS Vanilla", "LACS Medallions", "LACS Stones", "LACS Rewards", - // "LACS Dungeons", "LACS Tokens", "Start with", "Vanilla" }; - const char* randoShuffleGanonsBossKey[3] = {"Vanilla", "Own dungeon", "Start with"}; + const char* randoShuffleGanonsBossKey[12] = { "Vanilla", "Own dungeon", "Start with", "Any Dungeon", + "Overworld", "Anywhere", "LACS-Vanilla", "LACS-Medallions", + "LACS-Stones", "LACS-Rewards", "LACS-Dungeons", "LACS-Tokens" }; // Timesaver Settings const char* randoSkipSongReplays[3] = { "Don't skip", "Skip (no SFX)", "Skip (Keep SFX)" }; @@ -4088,7 +4135,7 @@ void DrawRandoEditor(bool& open) { "\n" "Anywhere - Small Keys can appear anywhere in the world." ); - SohImGui::EnhancementCombobox("gRandomizeKeysanity", randoShuffleSmallKeys, 6, 0); + SohImGui::EnhancementCombobox("gRandomizeKeysanity", randoShuffleSmallKeys, 6, 1); PaddedSeparator(); // Gerudo Keys @@ -4114,7 +4161,7 @@ void DrawRandoEditor(bool& open) { "\n" "Anywhere - Boss Keys can appear anywhere in the world." ); - SohImGui::EnhancementCombobox("gRandomizeBossKeysanity", randoShuffleBossKeys, 6, 0); + SohImGui::EnhancementCombobox("gRandomizeBossKeysanity", randoShuffleBossKeys, 6, 1); PaddedSeparator(); // RANDOTODO implement ganon's boss key outside of ganon's castle @@ -4127,8 +4174,7 @@ void DrawRandoEditor(bool& open) { "\n" "Start with - Places Ganon's Boss Key in your starting inventory." ); - SohImGui::EnhancementCombobox("gRandomizeShuffleGanonBossKey", randoShuffleGanonsBossKey, 3, - 0); + SohImGui::EnhancementCombobox("gRandomizeShuffleGanonBossKey", randoShuffleGanonsBossKey, 12, 0); PaddedSeparator(); // Start with Maps & Compasses diff --git a/soh/src/code/z_sram.c b/soh/src/code/z_sram.c index ddc28450fa..2a494cf9b4 100644 --- a/soh/src/code/z_sram.c +++ b/soh/src/code/z_sram.c @@ -814,9 +814,28 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) { GiveLinkRupees(9001); } - // For Ganon's boss key "Start With" is 0 - if(Randomizer_GetSettingValue(RSK_GANONS_BOSS_KEY) == 0) { - gSaveContext.inventory.dungeonItems[10] |= 1; + if(Randomizer_GetSettingValue(RSK_KEYSANITY) == 0) { + // TODO: If master quest there are different key counts + gSaveContext.inventory.dungeonKeys[SCENE_BMORI1] = 5; // Forest + gSaveContext.inventory.dungeonKeys[SCENE_HIDAN] = 8; // Fire + gSaveContext.inventory.dungeonKeys[SCENE_MIZUSIN] = 6; // Water + gSaveContext.inventory.dungeonKeys[SCENE_JYASINZOU] = 5; // Spirit + gSaveContext.inventory.dungeonKeys[SCENE_HAKADAN] = 5; // Shadow + gSaveContext.inventory.dungeonKeys[SCENE_HAKADANCH] = 2; // BotW + gSaveContext.inventory.dungeonKeys[SCENE_MEN] = 9; // GTG + gSaveContext.inventory.dungeonKeys[SCENE_GANONTIKA] = 2; // Ganon + } + + if(Randomizer_GetSettingValue(RSK_BOSS_KEYSANITY) == 0) { + gSaveContext.inventory.dungeonItems[SCENE_BMORI1] |= 1; // Forest + gSaveContext.inventory.dungeonItems[SCENE_HIDAN] |= 1; // Fire + gSaveContext.inventory.dungeonItems[SCENE_MIZUSIN] |= 1; // Water + gSaveContext.inventory.dungeonItems[SCENE_JYASINZOU] |= 1; // Spirit + gSaveContext.inventory.dungeonItems[SCENE_HAKADAN] |= 1; // Shadow + } + + if(Randomizer_GetSettingValue(RSK_GANONS_BOSS_KEY) == 2) { + gSaveContext.inventory.dungeonItems[SCENE_GANON] |= 1; } HIGH_SCORE(HS_POE_POINTS) = 1000 - (100 * Randomizer_GetSettingValue(RSK_BIG_POE_COUNT));