From 0ff615f99108445a33f478b9061d3a66c6364eeb Mon Sep 17 00:00:00 2001 From: gymnast86 Date: Tue, 4 Aug 2026 07:56:05 -0700 Subject: [PATCH] more code -> flow changes --- .../generator/data/flow_patches.yaml | 116 ++++++++++++++++-- mods/randomizer/generator/data/locations.yaml | 30 +++++ .../randomizer/generator/data/startflags.yaml | 2 + .../generator/data/text/text_overrides.yaml | 72 +++++++---- mods/randomizer/generator/generator_only.cpp | 3 + mods/randomizer/generator/logic/item_pool.cpp | 1 + mods/randomizer/generator/test/test.cpp | 1 + mods/randomizer/src/randomizer_context.cpp | 16 +++ 8 files changed, 204 insertions(+), 37 deletions(-) diff --git a/mods/randomizer/generator/data/flow_patches.yaml b/mods/randomizer/generator/data/flow_patches.yaml index 43eb86aff5..d062f43528 100644 --- a/mods/randomizer/generator/data/flow_patches.yaml +++ b/mods/randomizer/generator/data/flow_patches.yaml @@ -7,22 +7,35 @@ # instead. These are all the flow jumps that normally determine which "Talk to Midna" # text is displayed. - index: - - 0x1 - - 0x9 - - 0xC - - 0x8F - - 0x192 - - 0x1A4 - - 0x18F - - 0x197 - - 0x1BC - - 0x1C9 + - 0x1 + - 0x9 + - 0xC + - 0x8F + - 0x192 + - 0x1A4 + - 0x18F + - 0x197 + - 0x1BC + - 0x1C9 type: event event: 42 parameters: 0x00000000 next node index: Custom Midna Call Begin -#1: # zel_01.bmg +1: # zel_01.bmg - Ordon Village + # Patch the flow in Bo's house that normally prevents us from leaving without + # Having the iron boots. Patch it so we take the flow which allows us to leave + # no matter what + - index: 0x8F + type: branch + num results: 2 + query: 21 + parameters: 0x0045 + next node index: 0x4B + results: + - 0x90 + - 0x90 + 2: # zel_02.bmg # Patch Barnes branch to see if you can buy the bomb bag to use # query 54 (custom event check) instead of query 22 (how many bomb bags the player has) @@ -33,6 +46,37 @@ parameters: 0x004D next node index: 0x340 + # Change the flow of buying the red potion item in Kak Malo Mart to not check for an empty bottle first + # if the item is randomized. Change both branch paths to lead to the same next node + - only if: Shop_Items == On + index: 0x43F + type: branch + num results: 2 + query: 24 + parameters: 0x00000001 + next node index: 0x2EA + results: + - 0x440 + - 0x440 + + # Change the flow of buying the red potion item in Kak Malo Mart to set the sold out flag if shop + # items are randomized + - only if: Shop_Items == On + index: 0x445 + type: event + event: 3 + parameters: 0x0000001E + next node index: Kakariko Malo Mart Red Potion Sold Out + + # Change the flow of buying the wooden shield in Kak Malo Mart to set the sold out flag if shop + # items are randomized + - only if: Shop_Items == On + index: 0x417 + type: event + event: 3 + parameters: 0x00000032 + next node index: Kakariko Malo Mart Wooden Shield Sold Out + #3: # zel_03.bmg 4: # zel_04.bmg - Castle Town # Patch Charlo to check for 100 rupees instead of 30 @@ -66,6 +110,17 @@ parameters: 0x00000000 next node index: 0x10C + # Patch Jovani flow so that we can turn in poe souls before completing MDH + - index: 0x832 + type: branch + num results: 2 + query: 1 + parameters: 0x01C8 + next node index: 0x763 + results: + - 0x834 # Skip over 0x833 and go directly to 0x834 + - 0x84E + # Patch Jovani to skip checking whether we've received the first # or second reward and skip straight to the second reward if we're # talking to him for the first time with 60 souls @@ -82,6 +137,14 @@ parameters: 0x00000063 next node index: Jovani Check 20 Reward Obtained + # Patch the flow of showing the Doctor the Invoice to call our custom + # event which calls offWarashibeItem instead of setWarashibeItem + - index: 0x2D7 + type: event + event: 47 + parameters: 0x00000081 + next node index: 0x1D3 + 5: # zel_05.bmg # Patch Yeta flow to always give the map check even if the player has obtained the Ordon Cheese - index: 0x8 @@ -114,7 +177,12 @@ #6: # zel_06.bmg #7: # zel_07.bmg -#8: # zel_08.bmg +8: # zel_08.bmg - HF, Outside CT, LH, UZR, Zora's River, KB2, Title Screen + # Skip over the node which deletes auru's memo from the inventory after showing it to Fyer + - index: 0x53 + type: message + inf index: 0xA7 + next flow index: 0x54 # Go directly to 0x54 instead of 0x5D # Custom Flow Nodes 9: @@ -303,6 +371,28 @@ parameters: 0x00000000 next node index: 0x116 + ################################################# + # KAKARIKO MALO MART # + ################################################# + + # Run event 24 which sets the shop sold out flag + - name: Kakariko Malo Mart Red Potion Sold Out + type: event + event: 24 + parameters: 0x00000000 + next node index: 0x2F2 + + # Run event 24 which sets the shop sold out flag + - name: Kakariko Malo Mart Wooden Shield Sold Out + type: event + event: 24 + parameters: 0x00000000 + next node index: 0x2D0 + + ################################################# + # JOVANI # + ################################################# + # Check to see if we've obtained the 20 Poe Soul Reward. # If we haven't then branch to giving the reward - name: Jovani Check 20 Reward Obtained @@ -521,4 +611,4 @@ index: 21133 type: message inf index: Cave of Ordeals Hint Sign Text - next flow index: 0xFFFF + next flow index: 0xFFFF \ No newline at end of file diff --git a/mods/randomizer/generator/data/locations.yaml b/mods/randomizer/generator/data/locations.yaml index 6af1a39957..7dede794c8 100644 --- a/mods/randomizer/generator/data/locations.yaml +++ b/mods/randomizer/generator/data/locations.yaml @@ -64,6 +64,11 @@ - Overworld - Ordona Province Metadata: + FLW Event: + - Group: 1 + Index: 0x4D2 + Next Node Index: 0x2FA + Parameters: 0x0001004B Shop: - Stage: 65 Item: 0x4B @@ -1342,6 +1347,11 @@ - Kakariko Village - ARC Metadata: + FLW Event: + - Group: 2 + Index: 0x439 + Next Node Index: 0x2E8 + Parameters: 0x0001003E Shop: - Stage: 68 Item: 0x3E @@ -1356,6 +1366,11 @@ - Kakariko Village - ARC Metadata: + FLW Event: + - Group: 2 + Index: 0x427 + Next Node Index: 0x2DB + Parameters: 0x0001002C Shop: - Stage: 68 Item: 0x2C @@ -1370,6 +1385,11 @@ - Kakariko Village - ARC Metadata: + FLW Event: + - Group: 2 + Index: 0x449 + Next Node Index: 0x2F3 + Parameters: 0x00010061 Shop: - Stage: 68 Item: 0x61 @@ -1384,6 +1404,11 @@ - Kakariko Village - ARC Metadata: + FLW Event: + - Group: 2 + Index: 0x41C + Next Node Index: 0x2D3 + Parameters: 0x0001002B Shop: - Stage: 68 Item: 0x2B @@ -2479,6 +2504,11 @@ - Castle Town - ARC Metadata: + FLW Event: + - Group: 4 + Index: 0x610 + Next Node Index: 0x5AE + Parameters: 0x00010030 Shop: - Stage: 73 Item: 0x30 diff --git a/mods/randomizer/generator/data/startflags.yaml b/mods/randomizer/generator/data/startflags.yaml index 08b38a996e..b58890e45d 100644 --- a/mods/randomizer/generator/data/startflags.yaml +++ b/mods/randomizer/generator/data/startflags.yaml @@ -317,6 +317,8 @@ RegionFlags: - 0x99 # Desert Entrance CS. - 0x20 # Set Freestanding key flag. - 0x7F # Mirror Raised Cutscene Flag (Places Boar at desert entrance) + - Small_Keys == Keysy: + - 0x5F # Gate to King Bulblin Tent unlocked - Skip_Minor_Cutscenes == On: - 0x53 # Mirror Chamber Intro CS. - Arbiters_Does_Not_Require_Bulblin_Camp == On: diff --git a/mods/randomizer/generator/data/text/text_overrides.yaml b/mods/randomizer/generator/data/text/text_overrides.yaml index f12f27f882..4cb6ae019f 100644 --- a/mods/randomizer/generator/data/text/text_overrides.yaml +++ b/mods/randomizer/generator/data/text/text_overrides.yaml @@ -243,19 +243,23 @@ Group: 0 Message Id: 2041 -- Name: Slingshot Shop Text +- Only If: Shop_Items == On + Name: Slingshot Shop Text Group: 1 Message Id: 7009 -- Name: Slingshot Shop Too Expensive Text +- Only If: Shop_Items == On + Name: Slingshot Shop Too Expensive Text Group: 1 Message Id: 7014 -- Name: Slingshot Shop Purchase Confirmation Text +- Only If: Shop_Items == On + Name: Slingshot Shop Purchase Confirmation Text Group: 1 Message Id: 7015 -- Name: Slingshot Shop After Purchase Text +- Only If: Shop_Items == On + Name: Slingshot Shop After Purchase Text Group: 1 Message Id: 7016 @@ -267,83 +271,103 @@ Group: 2 Message Id: 5155 -- Name: Kakariko Malo Mart Wooden Shield Purchase Confirmation Text +- Only If: Shop_Items == On + Name: Kakariko Malo Mart Wooden Shield Purchase Confirmation Text Group: 2 Message Id: 5809 -- Name: Kakariko Malo Mart Wooden Shield Too Expensive Text +- Only If: Shop_Items == On + Name: Kakariko Malo Mart Wooden Shield Too Expensive Text Group: 2 Message Id: 5810 -- Name: Kakariko Malo Mart Hylian Shield Purchase Confirmation Text +- Only If: Shop_Items == On + Name: Kakariko Malo Mart Hylian Shield Purchase Confirmation Text Group: 2 Message Id: 5813 -- Name: Kakariko Malo Mart Hylian Shield Too Expensive Text +- Only If: Shop_Items == On + Name: Kakariko Malo Mart Hylian Shield Too Expensive Text Group: 2 Message Id: 5814 -- Name: Kakariko Malo Mart Hylian Shield After Purchase Text +- Only If: Shop_Items == On + Name: Kakariko Malo Mart Hylian Shield After Purchase Text Group: 2 Message Id: 5818 -- Name: Kakariko Malo Mart Hawkeye Purchase Confirmation Text +- Only If: Shop_Items == On + Name: Kakariko Malo Mart Hawkeye Purchase Confirmation Text Group: 2 Message Id: 5820 -- Name: Kakariko Malo Mart Hawkeye Too Expensive Text +- Only If: Shop_Items == On + Name: Kakariko Malo Mart Hawkeye Too Expensive Text Group: 2 Message Id: 5821 -- Name: Kakariko Malo Mart Hawkeye After Purchase Text +- Only If: Shop_Items == On + Name: Kakariko Malo Mart Hawkeye After Purchase Text Group: 2 Message Id: 5822 -- Name: Kakariko Malo Mart Red Potion Too Expensive Text +- Only If: Shop_Items == On + Name: Kakariko Malo Mart Red Potion Too Expensive Text Group: 2 Message Id: 5824 -- Name: Kakariko Malo Mart Red Potion Purchase Confirmation Text +- Only If: Shop_Items == On + Name: Kakariko Malo Mart Red Potion Purchase Confirmation Text Group: 2 Message Id: 5825 -- Name: Kakariko Malo Mart Red Potion Text +- Only If: Shop_Items == On + Name: Kakariko Malo Mart Red Potion Text Group: 2 Message Id: 5990 -- Name: Kakariko Malo Mart Hawkeye Coming Soon Text +- Only If: Shop_Items == On + Name: Kakariko Malo Mart Hawkeye Coming Soon Text Group: 2 Message Id: 5991 -- Name: Kakariko Malo Mart Hawkeye Text +- Only If: Shop_Items == On + Name: Kakariko Malo Mart Hawkeye Text Group: 2 Message Id: 5992 -- Name: Kakariko Malo Mart Sold Out Text +- Only If: Shop_Items == On + Name: Kakariko Malo Mart Sold Out Text Group: 2 Message Id: 5996 -- Name: Kakariko Malo Mart Wooden Shield Text +- Only If: Shop_Items == On + Name: Kakariko Malo Mart Wooden Shield Text Group: 2 Message Id: 5998 -- Name: Kakariko Malo Mart Hylian Shield Text +- Only If: Shop_Items == On + Name: Kakariko Malo Mart Hylian Shield Text Group: 2 Message Id: 5999 -- Name: Chudleys Shop Magic Armor Text +- Only If: Shop_Items == On + Name: Chudleys Shop Magic Armor Text Group: 4 Message Id: 5413 -- Name: Castle Town Malo Mart Magic Armor After Purchase Text +- Only If: Shop_Items == On + Name: Castle Town Malo Mart Magic Armor After Purchase Text Group: 4 Message Id: 5433 -- Name: Castle Town Malo Mart Magic Armor Text +- Only If: Shop_Items == On + Name: Castle Town Malo Mart Magic Armor Text Group: 4 Message Id: 5440 -- Name: Castle Town Malo Mart Magic Armor Sold Out Text +- Only If: Shop_Items == On + Name: Castle Town Malo Mart Magic Armor Sold Out Text Group: 4 Message Id: 5451 diff --git a/mods/randomizer/generator/generator_only.cpp b/mods/randomizer/generator/generator_only.cpp index 12f5ae52bb..cc3294f2cd 100644 --- a/mods/randomizer/generator/generator_only.cpp +++ b/mods/randomizer/generator/generator_only.cpp @@ -1,6 +1,9 @@ #include "randomizer.hpp" +#include + int main() { + std::filesystem::create_directories(RANDO_SAVE_PATH); randomizer::Randomizer rando{RANDO_SAVE_PATH}; rando.Generate(); diff --git a/mods/randomizer/generator/logic/item_pool.cpp b/mods/randomizer/generator/logic/item_pool.cpp index 498aaf5798..8eb2d31048 100644 --- a/mods/randomizer/generator/logic/item_pool.cpp +++ b/mods/randomizer/generator/logic/item_pool.cpp @@ -310,6 +310,7 @@ namespace randomizer::logic::item_pool { std::list smallKeys = { {"Gate Keys"}, + {"Gerudo Desert Bulblin Camp Key"}, {"Forest Temple Small Key"}, {"Goron Mines Small Key"}, {"Lakebed Temple Small Key"}, diff --git a/mods/randomizer/generator/test/test.cpp b/mods/randomizer/generator/test/test.cpp index cc652cd84a..764082b157 100644 --- a/mods/randomizer/generator/test/test.cpp +++ b/mods/randomizer/generator/test/test.cpp @@ -6,6 +6,7 @@ int main() { + std::filesystem::create_directories(RANDO_SAVE_PATH); for (const auto& entry : std::filesystem::recursive_directory_iterator(RANDO_LOGIC_TESTS_PATH)) { if (entry.path().generic_string().ends_with("settings.yaml")) diff --git a/mods/randomizer/src/randomizer_context.cpp b/mods/randomizer/src/randomizer_context.cpp index 244d16995b..1c34958465 100644 --- a/mods/randomizer/src/randomizer_context.cpp +++ b/mods/randomizer/src/randomizer_context.cpp @@ -1501,6 +1501,14 @@ RandomizerContext WriteSeedData(randomizer::logic::world::World* world) { for (const auto& groupNode : flowPatches) { u8 groupNo = groupNode.first.as(); for (const auto& flowNode : groupNode.second) { + // Check to see if this patch is contingent on a specific setting + if (flowNode["only if"]) { + const auto& condition = flowNode["only if"].as(); + // If the required condition isn't set, then skip this one + if (!world->EvaluateSettingCondition(condition)) { + continue; + } + } std::string name{}; std::list indices{}; if (flowNode["index"]) { @@ -1665,6 +1673,14 @@ RandomizerContext WriteSeedData(randomizer::logic::world::World* world) { // Text Overrides auto textOverrides = LOAD_EMBED_YAML(RANDO_DATA_PATH "text/text_overrides.yaml"); for (const auto& overrideNode : textOverrides) { + // Check to see if this override is contingent on a specific setting + if (overrideNode["Only If"]) { + const auto& condition = overrideNode["Only If"].as(); + // If the required condition isn't set, then skip this one + if (!world->EvaluateSettingCondition(condition)) { + continue; + } + } const auto& name = overrideNode["Name"].as(); u8 group; u16 messageId;