summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett Cox <garrettjcox@gmail.com>2026-01-21 22:55:02 -0600
committerGitHub <noreply@github.com>2026-01-21 22:55:02 -0600
commit58eef5d931e437ca828bdf2387616b1d7bd63c06 (patch)
tree91a001f95b0b19d06c22549ac29743059cbc1a21
parent8ec3b515489360d91025ba49650fe65a2f2fc3e6 (diff)
Add static trap option (#1489)
-rw-r--r--mm/2s2h/Rando/ConvertItem.cpp32
-rw-r--r--mm/2s2h/Rando/Menu.cpp13
-rw-r--r--mm/2s2h/Rando/StaticData/Items.cpp1
3 files changed, 41 insertions, 5 deletions
diff --git a/mm/2s2h/Rando/ConvertItem.cpp b/mm/2s2h/Rando/ConvertItem.cpp
index e0a72c377..faba39b3e 100644
--- a/mm/2s2h/Rando/ConvertItem.cpp
+++ b/mm/2s2h/Rando/ConvertItem.cpp
@@ -80,6 +80,7 @@ static std::vector<RandoItemId> junkItems = {
static std::vector<RandoItemId> obtainableJunkItems;
static std::vector<RandoItemId> obtainableTrapItems;
+static std::vector<RandoItemId> allTrapItems;
void RefreshObtainableJunkItems() {
obtainableJunkItems.clear();
@@ -144,6 +145,17 @@ static RegisterShipInitFunc refreshInitFunc(
RefreshObtainableJunkItems();
RefreshObtainableTrapItems();
});
+
+ if (IS_RANDO) {
+ for (auto& [randoCheckId, _] : Rando::StaticData::Checks) {
+ RandoSaveCheck saveCheck = RANDO_SAVE_CHECKS[randoCheckId];
+ if (saveCheck.shuffled &&
+ (Rando::StaticData::Items[saveCheck.randoItemId].randoItemType == RITYPE_MAJOR ||
+ Rando::StaticData::Items[saveCheck.randoItemId].randoItemType == RITYPE_MASK)) {
+ allTrapItems.push_back(saveCheck.randoItemId);
+ }
+ }
+ }
},
{ "IS_RANDO" });
@@ -159,13 +171,23 @@ RandoItemId Rando::CurrentJunkItem(RandoCheckId randoCheckId) {
}
RandoItemId Rando::CurrentTrapItem(RandoCheckId randoCheckId) {
- if (obtainableTrapItems.size() == 0) {
- return RI_RUPEE_SILVER;
- }
+ if (CVarGetInteger("gRando.TrapItems", 0) == 0) {
+ if (obtainableTrapItems.size() == 0) {
+ return RI_RUPEE_SILVER;
+ }
- Ship_Random_Seed(gSaveContext.save.shipSaveInfo.rando.finalSeed + randoCheckId);
+ Ship_Random_Seed(gSaveContext.save.shipSaveInfo.rando.finalSeed + randoCheckId);
- return obtainableTrapItems[Ship_Random(0, obtainableTrapItems.size() - 1)];
+ return obtainableTrapItems[Ship_Random(0, obtainableTrapItems.size() - 1)];
+ } else {
+ if (allTrapItems.size() == 0) {
+ return RI_RUPEE_SILVER;
+ }
+
+ Ship_Random_Seed(gSaveContext.save.shipSaveInfo.rando.finalSeed + randoCheckId);
+
+ return allTrapItems[Ship_Random(0, allTrapItems.size() - 1)];
+ }
}
bool Rando::IsItemObtainable(RandoItemId randoItemId, RandoCheckId randoCheckId) {
diff --git a/mm/2s2h/Rando/Menu.cpp b/mm/2s2h/Rando/Menu.cpp
index f8136bd37..e25d052ad 100644
--- a/mm/2s2h/Rando/Menu.cpp
+++ b/mm/2s2h/Rando/Menu.cpp
@@ -41,6 +41,11 @@ std::unordered_map<int32_t, const char*> junkItemsOptions = {
{ 1, "Static" },
};
+std::unordered_map<int32_t, const char*> trapItemsOptions = {
+ { 0, "Default (Dynamic)" },
+ { 1, "Static" },
+};
+
// clang-format off
std::vector<int32_t> incompatibleWithVanilla = {
RO_SHUFFLE_BOSS_SOULS,
@@ -325,6 +330,14 @@ static void DrawGeneralTab() {
"Note: For both Options, junk items will be randomly rolled from a pool of obtainable "
"items.\n\nDefault (Cycle): Junk items will cycle every few seconds, allowing you to choose which item "
"to pick up\n\nStatic: Junk items will be static, only changing when obtainability status changes."));
+ UIWidgets::CVarCombobox(
+ "Trap Items", "gRando.TrapItems", &trapItemsOptions,
+ UIWidgets::ComboboxOptions()
+ .ComponentAlignment(UIWidgets::ComponentAlignment::Right)
+ .LabelPosition(UIWidgets::LabelPosition::Near)
+ .Tooltip("Default (Dynamic): Trap items will change dynamically as you progress, ensuring they are an item "
+ "you have not obtained yet for maximum trickery.\n\nStatic: Trap items will be static, according "
+ "to the randomizer seed."));
ImGui::EndChild();
ImGui::SameLine();
}
diff --git a/mm/2s2h/Rando/StaticData/Items.cpp b/mm/2s2h/Rando/StaticData/Items.cpp
index 441388cdb..204e88a8c 100644
--- a/mm/2s2h/Rando/StaticData/Items.cpp
+++ b/mm/2s2h/Rando/StaticData/Items.cpp
@@ -293,6 +293,7 @@ std::map<StartingItemCategory, std::vector<RandoItemId>> StartingItemsMap = {
{ RI_SOUL_BOSS_GOHT, RI_SOUL_BOSS_GYORG, RI_SOUL_BOSS_MAJORA, RI_SOUL_BOSS_ODOLWA, RI_SOUL_BOSS_TWINMOLD,
RI_FROG_BLUE, RI_FROG_CYAN, RI_FROG_PINK, RI_FROG_WHITE,
RI_TIME_DAY_1, RI_TIME_DAY_2, RI_TIME_DAY_3, RI_TIME_NIGHT_1, RI_TIME_NIGHT_2, RI_TIME_NIGHT_3, RI_TIME_PROGRESSIVE,
+ RI_OCARINA_BUTTON_A, RI_OCARINA_BUTTON_C_DOWN, RI_OCARINA_BUTTON_C_RIGHT, RI_OCARINA_BUTTON_C_LEFT, RI_OCARINA_BUTTON_C_UP,
} },
};