From 0de1cd96b1f466a8f24a57efbefdeecd5e2db181 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Sun, 28 Aug 2022 22:57:41 -0400 Subject: [PATCH 01/11] Fixes keys, maps, and compasses on develop-zhora rando. --- .../Enhancements/randomizer/randomizer.cpp | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 8f4ef7d3b..a6d6b0e4b 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -1619,6 +1619,41 @@ bool Randomizer::IsItemVanilla(RandomizerGet randoGet) { case RG_BUY_BOMBS_535: case RG_BUY_RED_POTION_40: case RG_BUY_RED_POTION_50: + case RG_FOREST_TEMPLE_SMALL_KEY: + case RG_FIRE_TEMPLE_SMALL_KEY: + case RG_WATER_TEMPLE_SMALL_KEY: + case RG_SPIRIT_TEMPLE_SMALL_KEY: + case RG_SHADOW_TEMPLE_SMALL_KEY: + case RG_BOTTOM_OF_THE_WELL_SMALL_KEY: + case RG_GERUDO_TRAINING_GROUNDS_SMALL_KEY: + case RG_GERUDO_FORTRESS_SMALL_KEY: + case RG_GANONS_CASTLE_SMALL_KEY: + case RG_FOREST_TEMPLE_BOSS_KEY: + case RG_FIRE_TEMPLE_BOSS_KEY: + case RG_WATER_TEMPLE_BOSS_KEY: + case RG_SPIRIT_TEMPLE_BOSS_KEY: + case RG_SHADOW_TEMPLE_BOSS_KEY: + case RG_GANONS_CASTLE_BOSS_KEY: + case RG_DEKU_TREE_COMPASS: + case RG_DODONGOS_CAVERN_COMPASS: + case RG_JABU_JABUS_BELLY_COMPASS: + case RG_FOREST_TEMPLE_COMPASS: + case RG_FIRE_TEMPLE_COMPASS: + case RG_WATER_TEMPLE_COMPASS: + case RG_SPIRIT_TEMPLE_COMPASS: + case RG_SHADOW_TEMPLE_COMPASS: + case RG_BOTTOM_OF_THE_WELL_COMPASS: + case RG_ICE_CAVERN_COMPASS: + case RG_DEKU_TREE_MAP: + case RG_DODONGOS_CAVERN_MAP: + case RG_JABU_JABUS_BELLY_MAP: + case RG_FOREST_TEMPLE_MAP: + case RG_FIRE_TEMPLE_MAP: + case RG_WATER_TEMPLE_MAP: + case RG_SPIRIT_TEMPLE_MAP: + case RG_SHADOW_TEMPLE_MAP: + case RG_BOTTOM_OF_THE_WELL_MAP: + case RG_ICE_CAVERN_MAP: return true; default: return false; From 760eaa4d97de5ebaa38ad9213f4301f73f6dd08d Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Sun, 28 Aug 2022 23:01:21 -0400 Subject: [PATCH 02/11] Adds randotodo comment as a note to adapt for the keysanity situation. --- soh/soh/Enhancements/randomizer/randomizer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index a6d6b0e4b..1bb2a1ab9 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -1619,6 +1619,7 @@ bool Randomizer::IsItemVanilla(RandomizerGet randoGet) { case RG_BUY_BOMBS_535: case RG_BUY_RED_POTION_40: case RG_BUY_RED_POTION_50: + //RANDO TODO: Fix this to return false if keysanity is on. case RG_FOREST_TEMPLE_SMALL_KEY: case RG_FIRE_TEMPLE_SMALL_KEY: case RG_WATER_TEMPLE_SMALL_KEY: From 35d651f06e62149768397a2f53078a0ef01a8293 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Sun, 28 Aug 2022 23:54:13 -0400 Subject: [PATCH 03/11] When shuffled to Own Dungeon or below, give vanilla keys, maps, and compasses. --- .../Enhancements/randomizer/randomizer.cpp | 78 ++++++++++++++++++- 1 file changed, 76 insertions(+), 2 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 1bb2a1ab9..a9fe62d9a 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -1409,7 +1409,66 @@ s16 Randomizer::GetItemFromGet(RandomizerGet randoGet, GetItemID ogItemId) { return GI_BOTTLE; case RG_BOTTLE_WITH_MILK: return GI_MILK_BOTTLE; - + + case RG_DEKU_TREE_MAP: + case RG_DODONGOS_CAVERN_MAP: + case RG_JABU_JABUS_BELLY_MAP: + case RG_FOREST_TEMPLE_MAP: + case RG_FIRE_TEMPLE_MAP: + case RG_WATER_TEMPLE_MAP: + case RG_SPIRIT_TEMPLE_MAP: + case RG_SHADOW_TEMPLE_MAP: + case RG_BOTTOM_OF_THE_WELL_MAP: + case RG_ICE_CAVERN_MAP: + if (GetRandoSettingValue(RSK_STARTING_MAPS_COMPASSES) < 3) { + return GI_MAP; + } else { + return randoGet; + } + + case RG_DEKU_TREE_COMPASS: + case RG_DODONGOS_CAVERN_COMPASS: + case RG_JABU_JABUS_BELLY_COMPASS: + case RG_FOREST_TEMPLE_COMPASS: + case RG_FIRE_TEMPLE_COMPASS: + case RG_WATER_TEMPLE_COMPASS: + case RG_SPIRIT_TEMPLE_COMPASS: + case RG_SHADOW_TEMPLE_COMPASS: + case RG_BOTTOM_OF_THE_WELL_COMPASS: + case RG_ICE_CAVERN_COMPASS: + if (GetRandoSettingValue(RSK_STARTING_MAPS_COMPASSES) < 3) { + return GI_COMPASS; + } else { + return randoGet; + } + + case RG_FOREST_TEMPLE_BOSS_KEY: + case RG_FIRE_TEMPLE_BOSS_KEY: + case RG_WATER_TEMPLE_BOSS_KEY: + case RG_SPIRIT_TEMPLE_BOSS_KEY: + case RG_SHADOW_TEMPLE_BOSS_KEY: + case RG_GANONS_CASTLE_BOSS_KEY: + if (GetRandoSettingValue(RSK_BOSS_KEYSANITY) < 3) { + return GI_KEY_BOSS; + } else { + return randoGet; + } + + case RG_FOREST_TEMPLE_SMALL_KEY: + case RG_FIRE_TEMPLE_SMALL_KEY: + case RG_WATER_TEMPLE_SMALL_KEY: + case RG_SPIRIT_TEMPLE_SMALL_KEY: + case RG_SHADOW_TEMPLE_SMALL_KEY: + case RG_BOTTOM_OF_THE_WELL_SMALL_KEY: + case RG_GERUDO_TRAINING_GROUNDS_SMALL_KEY: + case RG_GERUDO_FORTRESS_SMALL_KEY: + case RG_GANONS_CASTLE_SMALL_KEY: + if (GetRandoSettingValue(RSK_KEYSANITY) < 3) { + return GI_KEY_SMALL; + } else { + return randoGet; + } + // todo test this with keys in own dungeon case RG_TREASURE_GAME_SMALL_KEY: return GI_DOOR_KEY; @@ -1619,7 +1678,7 @@ bool Randomizer::IsItemVanilla(RandomizerGet randoGet) { case RG_BUY_BOMBS_535: case RG_BUY_RED_POTION_40: case RG_BUY_RED_POTION_50: - //RANDO TODO: Fix this to return false if keysanity is on. + return true; case RG_FOREST_TEMPLE_SMALL_KEY: case RG_FIRE_TEMPLE_SMALL_KEY: case RG_WATER_TEMPLE_SMALL_KEY: @@ -1629,12 +1688,24 @@ bool Randomizer::IsItemVanilla(RandomizerGet randoGet) { case RG_GERUDO_TRAINING_GROUNDS_SMALL_KEY: case RG_GERUDO_FORTRESS_SMALL_KEY: case RG_GANONS_CASTLE_SMALL_KEY: + if (GetRandoSettingValue(RSK_KEYSANITY) > 2) { + return false; + } + return true; case RG_FOREST_TEMPLE_BOSS_KEY: case RG_FIRE_TEMPLE_BOSS_KEY: case RG_WATER_TEMPLE_BOSS_KEY: case RG_SPIRIT_TEMPLE_BOSS_KEY: case RG_SHADOW_TEMPLE_BOSS_KEY: + if (GetRandoSettingValue(RSK_BOSS_KEYSANITY) > 2) { + return false; + } + return true; case RG_GANONS_CASTLE_BOSS_KEY: + if (GetRandoSettingValue(RSK_GANONS_BOSS_KEY) > 2) { + return false; + } + return true; case RG_DEKU_TREE_COMPASS: case RG_DODONGOS_CAVERN_COMPASS: case RG_JABU_JABUS_BELLY_COMPASS: @@ -1655,6 +1726,9 @@ bool Randomizer::IsItemVanilla(RandomizerGet randoGet) { case RG_SHADOW_TEMPLE_MAP: case RG_BOTTOM_OF_THE_WELL_MAP: case RG_ICE_CAVERN_MAP: + if (GetRandoSettingValue(RSK_STARTING_MAPS_COMPASSES) > 2) { + return false; + } return true; default: return false; From 0a27714b8edb65775d4989e170a472fd3ab348f2 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Mon, 29 Aug 2022 00:09:44 -0400 Subject: [PATCH 04/11] Adds missing case for RSK_GERUDO_KEYS from spoilerfile parsing. --- .../Enhancements/randomizer/randomizer.cpp | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index a9fe62d9a..2ed1888e4 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -875,6 +875,19 @@ void Randomizer::ParseRandomizerSettingsFile(const char* spoilerFileName) { gSaveContext.randoSettings[index].value = 3; } break; + case RSK_GERUDO_KEYS: + if (it.value() == "Vanilla") { + gSaveContext.randoSettings[index].value = 0; + } + if (it.value() == "Any Dungeon") { + gSaveContext.randoSettings[index].value = 1; + } + if (it.value() == "Overworld") { + gSaveContext.randoSettings[index].value = 2; + } + if (it.value() == "Anywhere") { + gSaveContext.randoSettings[index].value = 3; + } case RSK_KEYSANITY: if(it.value() == "Start With") { gSaveContext.randoSettings[index].value = 0; @@ -1461,13 +1474,18 @@ s16 Randomizer::GetItemFromGet(RandomizerGet randoGet, GetItemID ogItemId) { case RG_SHADOW_TEMPLE_SMALL_KEY: case RG_BOTTOM_OF_THE_WELL_SMALL_KEY: case RG_GERUDO_TRAINING_GROUNDS_SMALL_KEY: - case RG_GERUDO_FORTRESS_SMALL_KEY: case RG_GANONS_CASTLE_SMALL_KEY: if (GetRandoSettingValue(RSK_KEYSANITY) < 3) { return GI_KEY_SMALL; } else { return randoGet; } + case RG_GERUDO_FORTRESS_SMALL_KEY: + if (GetRandoSettingValue(RSK_GERUDO_KEYS) == 0) { + return GI_KEY_SMALL; + } else { + return randoGet; + } // todo test this with keys in own dungeon case RG_TREASURE_GAME_SMALL_KEY: @@ -1686,12 +1704,16 @@ bool Randomizer::IsItemVanilla(RandomizerGet randoGet) { case RG_SHADOW_TEMPLE_SMALL_KEY: case RG_BOTTOM_OF_THE_WELL_SMALL_KEY: case RG_GERUDO_TRAINING_GROUNDS_SMALL_KEY: - case RG_GERUDO_FORTRESS_SMALL_KEY: case RG_GANONS_CASTLE_SMALL_KEY: if (GetRandoSettingValue(RSK_KEYSANITY) > 2) { return false; } return true; + case RG_GERUDO_FORTRESS_SMALL_KEY: + if (GetRandoSettingValue(RSK_GERUDO_KEYS != 0)) { + return false + } + return true; case RG_FOREST_TEMPLE_BOSS_KEY: case RG_FIRE_TEMPLE_BOSS_KEY: case RG_WATER_TEMPLE_BOSS_KEY: From a84262dbf7a9bd8658bd027e31f13c8a6aac5b43 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Mon, 29 Aug 2022 00:11:10 -0400 Subject: [PATCH 05/11] Bit of cleanup --- soh/soh/Enhancements/randomizer/randomizer.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 2ed1888e4..7d552ce90 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -878,14 +878,11 @@ void Randomizer::ParseRandomizerSettingsFile(const char* spoilerFileName) { case RSK_GERUDO_KEYS: if (it.value() == "Vanilla") { gSaveContext.randoSettings[index].value = 0; - } - if (it.value() == "Any Dungeon") { + } else if (it.value() == "Any Dungeon") { gSaveContext.randoSettings[index].value = 1; - } - if (it.value() == "Overworld") { + } else if (it.value() == "Overworld") { gSaveContext.randoSettings[index].value = 2; - } - if (it.value() == "Anywhere") { + } else if (it.value() == "Anywhere") { gSaveContext.randoSettings[index].value = 3; } case RSK_KEYSANITY: From f44c588a2c24aa3ffc2de533b1553bd6c595d821 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Mon, 29 Aug 2022 01:03:21 -0400 Subject: [PATCH 06/11] Oops --- soh/soh/Enhancements/randomizer/randomizer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 7d552ce90..01bb06175 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -1708,7 +1708,7 @@ bool Randomizer::IsItemVanilla(RandomizerGet randoGet) { return true; case RG_GERUDO_FORTRESS_SMALL_KEY: if (GetRandoSettingValue(RSK_GERUDO_KEYS != 0)) { - return false + return false; } return true; case RG_FOREST_TEMPLE_BOSS_KEY: From 51dbee365a6c3efd366a15c79e0814e242756a45 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Mon, 29 Aug 2022 01:04:13 -0400 Subject: [PATCH 07/11] Oops part 2 --- soh/soh/Enhancements/randomizer/randomizer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 01bb06175..b4129eba1 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -1707,7 +1707,7 @@ bool Randomizer::IsItemVanilla(RandomizerGet randoGet) { } return true; case RG_GERUDO_FORTRESS_SMALL_KEY: - if (GetRandoSettingValue(RSK_GERUDO_KEYS != 0)) { + if (GetRandoSettingValue(RSK_GERUDO_KEYS) != 0) { return false; } return true; From b9aee7085edda009c07e9876e3ed88994e6b0e20 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Mon, 29 Aug 2022 19:12:19 -0400 Subject: [PATCH 08/11] Adds note to key colors enhancement about this change. --- libultraship/libultraship/ImGuiImpl.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index d430bc769..c74d126fb 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -2011,7 +2011,9 @@ namespace SohImGui { ); PaddedEnhancementCheckbox("Key Colors Match Dungeon", "gRandoMatchKeyColors", true, false); Tooltip( - "Matches the color of small keys and boss keys to the dungeon they belong to. This helps identify keys from afar and adds a little bit of flair."); + "Matches the color of small keys and boss keys to the dungeon they belong to. " + "This helps identify keys from afar and adds a little bit of flair.\n\nThis only " + "applies to seeds with keys and boss keys shuffled to Any Dungeon, Overworld, or Anywhere."); PaddedEnhancementCheckbox("Quest Item Fanfares", "gRandoQuestItemFanfares", true, false); Tooltip( "Play unique fanfares when obtaining quest items " From 99674ff88c0ef9669d3782a7003d533a7d5e2f1b Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Mon, 29 Aug 2022 19:19:01 -0400 Subject: [PATCH 09/11] Readds missing workaround for spirit temple and ganon's castle keys. --- soh/src/code/z_parameter.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 73044df27..265c69ace 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -1690,12 +1690,35 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { } return ITEM_NONE; } else if (item == ITEM_KEY_SMALL) { - if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] < 0) { - gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] = 1; - return ITEM_NONE; + // Small key exceptions for rando with keysanity off. + if (gSaveContext.n64ddFlag) { + if (globalCtx->sceneNum == 10) { // ganon's tower -> ganon's castle + if (gSaveContext.inventory.dungeonKeys[13] < 0) { + gSaveContext.inventory.dungeonKeys[13] = 1; + return ITEM_NONE; + } else { + gSaveContext.inventory.dungeonKeys[13]++; + return ITEM_NONE; + } + } + + if (globalCtx->sceneNum == 92) { // Desert Colossus -> Spirit Temple. + if (gSaveContext.inventory.dungeonKeys[6] < 0) { + gSaveContext.inventory.dungeonKeys[6] = 1; + return ITEM_NONE; + } else { + gSaveContext.inventory.dungeonKeys[6]++; + return ITEM_NONE; + } + } } else { - gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex]++; - return ITEM_NONE; + if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] < 0) { + gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] = 1; + return ITEM_NONE; + } else { + gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex]++; + return ITEM_NONE; + } } } else if ((item == ITEM_QUIVER_30) || (item == ITEM_BOW)) { if (CUR_UPG_VALUE(UPG_QUIVER) == 0) { From 3856d1b0a745aede9f6e1ce409d31ee66cc3bdf3 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Tue, 30 Aug 2022 11:00:47 -0400 Subject: [PATCH 10/11] Fixed small key case that was behind an else and shouldn't have been --- soh/src/code/z_parameter.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 265c69ace..f8df81f34 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -1711,14 +1711,12 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { return ITEM_NONE; } } + if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] < 0) { + gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] = 1; + return ITEM_NONE; } else { - if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] < 0) { - gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] = 1; - return ITEM_NONE; - } else { - gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex]++; - return ITEM_NONE; - } + gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex]++; + return ITEM_NONE; } } else if ((item == ITEM_QUIVER_30) || (item == ITEM_BOW)) { if (CUR_UPG_VALUE(UPG_QUIVER) == 0) { From 60257b98a4ae4e392ef2c049255b367a6ef34ee8 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Tue, 30 Aug 2022 11:21:29 -0400 Subject: [PATCH 11/11] Oops. Missed closing bracket. --- soh/src/code/z_parameter.c | 1 + 1 file changed, 1 insertion(+) diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index f8df81f34..8d26f3658 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -1711,6 +1711,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { return ITEM_NONE; } } + } if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] < 0) { gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] = 1; return ITEM_NONE;