Skip to content

Commit

Permalink
OoS: Fixed critical patching crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinopony committed Jul 19, 2024
1 parent ddb5a62 commit 022a3f3
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
2 changes: 1 addition & 1 deletion worlds/tloz_oos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def location_is_active(self, location_name, location_data):
region_id = location_data["region_id"]
if region_id == "advance shop":
return self.options.advance_shop.value
if region_id.startswith("subrosia") and region_id.endswith("digging spot"):
if location_name in SUBROSIA_HIDDEN_DIGGING_SPOTS_LOCATIONS:
return self.options.shuffle_golden_ore_spots
if location_name in RUPEE_OLD_MAN_LOCATIONS:
return self.options.shuffle_old_men == OracleOfSeasonsOldMenShuffle.option_turn_into_locations
Expand Down
10 changes: 10 additions & 0 deletions worlds/tloz_oos/data/Constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@
"Tarm Ruins: Old Man Near D6"
]

SUBROSIA_HIDDEN_DIGGING_SPOTS_LOCATIONS = [
"Subrosia: Hot Bath Digging Spot",
"Subrosia: Market Portal Digging Spot",
"Subrosia: Hard-Working Subrosian Digging Spot",
"Subrosia: Temple of Seasons Digging Spot",
"Subrosia: Northern Volcanoes Digging Spot",
"Subrosia: D8 Portal Digging Spot",
"Subrosia: Western Volcanoes Digging Spot"
]

SAMASA_GATE_CODE = [2, 2, 1, 0, 0, 3, 3, 3]

SHOP_PRICES_DIVIDERS = {
Expand Down
8 changes: 8 additions & 0 deletions worlds/tloz_oos/data/Locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1919,55 +1919,63 @@
"Gnarled Root Dungeon: Essence": {
"region_id": "d1 boss",
"flag_byte": 0xc913,
"room": 0x0413,
"vanilla_item": "Fertile Soil",
"essence": True,
"symbolic_name": "essenceD1",
},
"Snake's Remains: Essence": {
"region_id": "d2 boss",
"flag_byte": 0xc92c,
"room": 0x042c,
"vanilla_item": "Gift of Time",
"essence": True,
"symbolic_name": "essenceD2",
},
"Poison Moth's Lair: Essence": {
"region_id": "d3 boss",
"flag_byte": 0xc940,
"room": 0x0440,
"vanilla_item": "Bright Sun",
"essence": True,
"symbolic_name": "essenceD3",
},
"Dancing Dragon Dungeon: Essence": {
"region_id": "d4 boss",
"flag_byte": 0xc960,
"room": 0x0460,
"vanilla_item": "Soothing Rain",
"essence": True,
"symbolic_name": "essenceD4",
},
"Unicorn's Cave: Essence": {
"region_id": "d5 boss",
"flag_byte": 0xc988,
"room": 0x0488,
"vanilla_item": "Nurturing Warmth",
"essence": True,
"symbolic_name": "essenceD5",
},
"Ancient Ruins: Essence": {
"region_id": "d6 boss",
"flag_byte": 0xc898,
"room": 0x0398,
"vanilla_item": "Blowing Wind",
"essence": True,
"symbolic_name": "essenceD6",
},
"Explorer's Crypt: Essence": {
"region_id": "d7 boss",
"flag_byte": 0xca4f,
"room": 0x054f,
"vanilla_item": "Seed of Life",
"essence": True,
"symbolic_name": "essenceD7",
},
"Sword & Shield Dungeon: Essence": {
"region_id": "d8 boss",
"flag_byte": 0xca5f,
"room": 0x055f,
"vanilla_item": "Changing Seasons",
"essence": True,
"symbolic_name": "essenceD8",
Expand Down
17 changes: 12 additions & 5 deletions worlds/tloz_oos/patching/Functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,17 @@ def define_additional_tile_replacements(assembler: Z80Assembler, patch_data):
])
assembler.add_floating_chunk("additionalTileReplacements", table)


def define_location_constants(assembler: Z80Assembler, patch_data):
# If "Enforce potion in shop" is enabled, put a Potion in a specific location in Horon Shop that was
# disabled at generation time to prevent trackers from tracking it
if patch_data["options"]["enforce_potion_in_shop"]:
patch_data["locations"]["Horon Village: Shop #3"] = "Potion"
# If golden ore spots are not shuffled, they are still reachable nonetheless, so we need to enforce their
# vanilla item for systems to work
if not patch_data["options"]["shuffle_golden_ore_spots"]:
for location_name in SUBROSIA_HIDDEN_DIGGING_SPOTS_LOCATIONS:
patch_data["locations"][location_name] = {"item": "Ore Chunks (50)"}

# Define shop prices as constants
for symbolic_name, price in patch_data["shop_prices"].items():
Expand All @@ -219,12 +225,13 @@ def define_location_constants(assembler: Z80Assembler, patch_data):
for location_name, location_data in LOCATIONS_DATA.items():
if "symbolic_name" not in location_data:
continue
symbolic_name = location_data["symbolic_name"]

symbolic_name = location_data["symbolic_name"]
if location_name in patch_data["locations"]:
item = patch_data["locations"][location_name]
else:
item = {"item": location_data["vanilla_item"]}
# Put a fake item for disabled locations, since they are unreachable anwyway
item = {"item": "Friendship Ring"}

item_id, item_subid = get_item_id_and_subid(item)
assembler.define_byte(f"locations.{symbolic_name}.id", item_id)
Expand Down Expand Up @@ -490,9 +497,9 @@ def define_text_constants(assembler: Z80Assembler, patch_data):
for i in range(1, 4):
location_name = f"{shop_name} #{i}"
symbolic_name = LOCATIONS_DATA[location_name]["symbolic_name"]
if location_name not in patch_data["locations"]:
continue
item_name_bytes = process_item_name_for_shop_text(patch_data["locations"][location_name])
item_name_bytes = []
if location_name in patch_data["locations"]:
item_name_bytes = process_item_name_for_shop_text(patch_data["locations"][location_name])

text_bytes = [0x09, 0x01] + item_name_bytes + [0x03, 0xe2] # Item name
text_bytes.extend([0x20, 0x0c, 0x08, 0x02, 0x8f, 0x01]) # Price
Expand Down

0 comments on commit 022a3f3

Please sign in to comment.