diff options
| author | Garrett Cox <garrettjcox@gmail.com> | 2026-01-19 23:13:19 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-19 23:13:19 -0600 |
| commit | c0c74633476c9955b1d0c1fd68fef5a7ae7e0825 (patch) | |
| tree | b1b705224a9c7cc910bff283541166290567354f | |
| parent | c39869b70f73057b9dd5ef02130a18376b9b2e01 (diff) | |
Use computed starting items for pool removal (#1472)
| -rw-r--r-- | mm/2s2h/Rando/Logic/GeneratePools.cpp | 15 | ||||
| -rw-r--r-- | mm/2s2h/Rando/Rando.h | 1 | ||||
| -rw-r--r-- | mm/2s2h/Rando/StartingItems.cpp | 27 |
3 files changed, 21 insertions, 22 deletions
diff --git a/mm/2s2h/Rando/Logic/GeneratePools.cpp b/mm/2s2h/Rando/Logic/GeneratePools.cpp index bfa3d638b..ad94fac95 100644 --- a/mm/2s2h/Rando/Logic/GeneratePools.cpp +++ b/mm/2s2h/Rando/Logic/GeneratePools.cpp @@ -14,19 +14,8 @@ namespace Logic { void GeneratePools(RandoSaveInfo& saveInfo, std::vector<RandoCheckId>& checkPool, std::vector<RandoItemId>& itemPool) { std::vector<RandoItemId> startingItems = Rando::GetStartingItemsFromSave(saveInfo); - - if (saveInfo.randoSaveOptions[RO_STARTING_MAPS_AND_COMPASSES]) { - std::vector<RandoItemId> MapsAndCompasses = { - RI_GREAT_BAY_COMPASS, RI_GREAT_BAY_MAP, RI_SNOWHEAD_COMPASS, RI_SNOWHEAD_MAP, - RI_STONE_TOWER_COMPASS, RI_STONE_TOWER_MAP, RI_TINGLE_MAP_CLOCK_TOWN, RI_TINGLE_MAP_GREAT_BAY, - RI_TINGLE_MAP_ROMANI_RANCH, RI_TINGLE_MAP_SNOWHEAD, RI_TINGLE_MAP_STONE_TOWER, RI_TINGLE_MAP_WOODFALL, - RI_WOODFALL_COMPASS, RI_WOODFALL_MAP, - }; - - for (RandoItemId itemId : MapsAndCompasses) { - startingItems.push_back(itemId); - } - } + std::vector<RandoItemId> computedStartingItems = Rando::GetComputedStartingItems(saveInfo); + startingItems.insert(startingItems.end(), computedStartingItems.begin(), computedStartingItems.end()); std::vector<RandoCheckId> excludedChecks; std::string excludedChecksList = CVarGetString("gRando.ExcludedChecks", ""); diff --git a/mm/2s2h/Rando/Rando.h b/mm/2s2h/Rando/Rando.h index bff875499..03b542173 100644 --- a/mm/2s2h/Rando/Rando.h +++ b/mm/2s2h/Rando/Rando.h @@ -23,6 +23,7 @@ RandoItemId ConvertItem(RandoItemId randoItemId, RandoCheckId randoCheckId = RC_ RandoCheckId FindItemPlacement(RandoItemId randoItemId); void RegisterMenu(); +std::vector<RandoItemId> GetComputedStartingItems(RandoSaveInfo& randoSaveInfo); void GrantStartingItems(); std::vector<RandoItemId> GetStartingItemsFromSpoiler(nlohmann::json& spoiler); void SetStartingItemsInSpoiler(nlohmann::json& spoiler, std::vector<RandoItemId>& startingItems); diff --git a/mm/2s2h/Rando/StartingItems.cpp b/mm/2s2h/Rando/StartingItems.cpp index bbe850100..13a41a472 100644 --- a/mm/2s2h/Rando/StartingItems.cpp +++ b/mm/2s2h/Rando/StartingItems.cpp @@ -12,10 +12,10 @@ namespace Rando { -void GrantStartingItems() { - std::vector<RandoItemId> startingItems = Rando::GetStartingItemsFromSave(gSaveContext.save.shipSaveInfo.rando); +std::vector<RandoItemId> GetComputedStartingItems(RandoSaveInfo& randoSaveInfo) { + std::vector<RandoItemId> startingItems; - if (RANDO_SAVE_OPTIONS[RO_STARTING_MAPS_AND_COMPASSES]) { + if (randoSaveInfo.randoSaveOptions[RO_STARTING_MAPS_AND_COMPASSES]) { std::vector<RandoItemId> MapsAndCompasses = { RI_GREAT_BAY_COMPASS, RI_GREAT_BAY_MAP, RI_SNOWHEAD_COMPASS, RI_SNOWHEAD_MAP, RI_STONE_TOWER_COMPASS, RI_STONE_TOWER_MAP, RI_TINGLE_MAP_CLOCK_TOWN, RI_TINGLE_MAP_GREAT_BAY, @@ -28,24 +28,24 @@ void GrantStartingItems() { } } - if (RANDO_SAVE_OPTIONS[RO_SHUFFLE_SWIM] != RO_GENERIC_YES) { + if (randoSaveInfo.randoSaveOptions[RO_SHUFFLE_SWIM] != RO_GENERIC_YES) { startingItems.push_back(RI_ABILITY_SWIM); } - if (RANDO_SAVE_OPTIONS[RO_SHUFFLE_ENEMY_SOULS] != RO_GENERIC_YES) { + if (randoSaveInfo.randoSaveOptions[RO_SHUFFLE_ENEMY_SOULS] != RO_GENERIC_YES) { for (int i = RI_SOUL_ENEMY_ALIEN; i <= RI_SOUL_ENEMY_WOLFOS; i++) { startingItems.push_back((RandoItemId)i); } } - if (RANDO_SAVE_OPTIONS[RO_SHUFFLE_OCARINA_BUTTONS] != RO_GENERIC_YES) { + if (randoSaveInfo.randoSaveOptions[RO_SHUFFLE_OCARINA_BUTTONS] != RO_GENERIC_YES) { for (int i = RI_OCARINA_BUTTON_A; i <= RI_OCARINA_BUTTON_C_UP; i++) { startingItems.push_back((RandoItemId)i); } } // When shuffling time, if the player did not choose any starting time items, we need to give them at least one. - if (RANDO_SAVE_OPTIONS[RO_CLOCK_SHUFFLE] == RO_GENERIC_YES) { + if (randoSaveInfo.randoSaveOptions[RO_CLOCK_SHUFFLE] == RO_GENERIC_YES) { bool hasTimeItem = false; for (RandoItemId randoItemId : startingItems) { if (randoItemId >= RI_TIME_DAY_1 && randoItemId <= RI_TIME_PROGRESSIVE) { @@ -54,8 +54,8 @@ void GrantStartingItems() { } } if (!hasTimeItem) { - if (RANDO_SAVE_OPTIONS[RO_CLOCK_SHUFFLE_PROGRESSIVE] == RO_CLOCK_SHUFFLE_RANDOM) { - Ship_Random_Seed(gSaveContext.save.shipSaveInfo.rando.finalSeed); + if (randoSaveInfo.randoSaveOptions[RO_CLOCK_SHUFFLE_PROGRESSIVE] == RO_CLOCK_SHUFFLE_RANDOM) { + Ship_Random_Seed(randoSaveInfo.finalSeed); startingItems.push_back((RandoItemId)(RI_TIME_DAY_1 + Ship_Random(0, 5))); } else { startingItems.push_back(RI_TIME_PROGRESSIVE); @@ -63,6 +63,15 @@ void GrantStartingItems() { } } + return startingItems; +} + +void GrantStartingItems() { + std::vector<RandoItemId> startingItems = Rando::GetStartingItemsFromSave(gSaveContext.save.shipSaveInfo.rando); + std::vector<RandoItemId> computedStartingItems = + Rando::GetComputedStartingItems(gSaveContext.save.shipSaveInfo.rando); + startingItems.insert(startingItems.end(), computedStartingItems.begin(), computedStartingItems.end()); + for (RandoItemId startingItem : startingItems) { Rando::GiveItem(Rando::ConvertItem(startingItem)); } |
