From 6d10e6b9f88af348fb45decc2a0ad00fb2f452e9 Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Sat, 5 Nov 2022 08:31:25 -0500 Subject: [PATCH] [rando] Pull gamestabled/OoT3D_Randomizer #540 fixes (#1917) --- soh/soh/Enhancements/randomizer/3drando/fill.cpp | 10 +++++----- soh/soh/Enhancements/randomizer/3drando/menu.cpp | 2 +- soh/soh/Enhancements/randomizer/3drando/preset.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.cpp b/soh/soh/Enhancements/randomizer/3drando/fill.cpp index cbd636022..380d761c4 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.cpp @@ -163,8 +163,8 @@ static int GetMaxGSCount() { else if (Location(KAK_10_GOLD_SKULLTULA_REWARD)->GetPlacedItem().IsAdvancement() && Location(KAK_10_GOLD_SKULLTULA_REWARD)->GetPlacedItem().GetItemType() != ITEMTYPE_TOKEN) { maxUseful = 10; } - //Return max of the two possible reasons tokens could be important - return std::max(maxUseful, maxBridge); + //Return max of the two possible reasons tokens could be important, minus the tokens in the starting inventory + return std::max(maxUseful, maxBridge) - StartingSkulltulaToken.Value(); } std::string GetShopItemBaseName(std::string itemName) { @@ -772,7 +772,7 @@ static void RandomizeOwnDungeon(const Dungeon::DungeonInfo* dungeon) { //Add specific items that need be randomized within this dungeon if (Keysanity.Is(KEYSANITY_OWN_DUNGEON) && dungeon->GetSmallKey() != NONE) { - std::vector dungeonSmallKeys = FilterAndEraseFromPool(ItemPool, [dungeon](const uint32_t i){ return i == dungeon->GetSmallKey();}); + std::vector dungeonSmallKeys = FilterAndEraseFromPool(ItemPool, [dungeon](const uint32_t i){ return (i == dungeon->GetSmallKey()) || (i == dungeon->GetKeyRing());}); AddElementsToPool(dungeonItems, dungeonSmallKeys); } @@ -813,10 +813,10 @@ static void RandomizeDungeonItems() { for (auto dungeon : dungeonList) { if (Keysanity.Is(KEYSANITY_ANY_DUNGEON)) { - auto dungeonKeys = FilterAndEraseFromPool(ItemPool, [dungeon](const uint32_t i){return i == dungeon->GetSmallKey();}); + auto dungeonKeys = FilterAndEraseFromPool(ItemPool, [dungeon](const uint32_t i){return (i == dungeon->GetSmallKey()) || (i == dungeon->GetKeyRing());}); AddElementsToPool(anyDungeonItems, dungeonKeys); } else if (Keysanity.Is(KEYSANITY_OVERWORLD)) { - auto dungeonKeys = FilterAndEraseFromPool(ItemPool, [dungeon](const uint32_t i){return i == dungeon->GetSmallKey();}); + auto dungeonKeys = FilterAndEraseFromPool(ItemPool, [dungeon](const uint32_t i){return (i == dungeon->GetSmallKey()) || (i == dungeon->GetKeyRing());}); AddElementsToPool(overworldItems, dungeonKeys); } diff --git a/soh/soh/Enhancements/randomizer/3drando/menu.cpp b/soh/soh/Enhancements/randomizer/3drando/menu.cpp index d566dd64a..28e43c175 100644 --- a/soh/soh/Enhancements/randomizer/3drando/menu.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/menu.cpp @@ -187,7 +187,7 @@ void MenuUpdate(uint32_t kDown, bool updatedByHeld) { kDown = 0; } - if (currentMenu->mode != GENERATE_MODE) { + if (currentMenu->mode != POST_GENERATE) { // New Random Seed if (kDown & KEY_Y) { diff --git a/soh/soh/Enhancements/randomizer/3drando/preset.cpp b/soh/soh/Enhancements/randomizer/3drando/preset.cpp index ab036ab14..57606e6f1 100644 --- a/soh/soh/Enhancements/randomizer/3drando/preset.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/preset.cpp @@ -53,7 +53,7 @@ bool CreatePresetDirectories() { std::vector GetSettingsPresets() { std::vector presetEntries = {}; for (const auto& entry : fs::directory_iterator(GetBasePath(OptionCategory::Setting))) { - if(entry.path().stem().string() != CACHED_SETTINGS_FILENAME) { + if(entry.is_regular_file() && entry.path().stem().string() != CACHED_SETTINGS_FILENAME) { presetEntries.push_back(entry.path().stem().string()); } }