From 6acad0c03781cafe1993e020f9d15d4a63562867 Mon Sep 17 00:00:00 2001 From: Kevin Cathcart Date: Tue, 16 Jan 2018 20:56:35 -0500 Subject: [PATCH] Re-implement multi-entrance cave patching Make it function in a way that will be compatible with placing them in single entrance doorways. --- EntranceShuffle.py | 422 +++++++++++++++++++++++---------------------- Rom.py | 60 +++++-- 2 files changed, 256 insertions(+), 226 deletions(-) diff --git a/EntranceShuffle.py b/EntranceShuffle.py index 3ebf82cb..a349373b 100644 --- a/EntranceShuffle.py +++ b/EntranceShuffle.py @@ -670,15 +670,11 @@ def connect_entrance(world, entrancename, exitname): if entrance.connected_region is not None: entrance.connected_region.entrances.remove(entrance) + target = exit_ids[exit.name] if exit is not None else exit_ids.get(region.name, None) target = exit_ids[exit.name][0] if exit is not None else exit_ids.get(region.name, None) - addresses = door_addresses[entrance.name][0][0] if exit is not None else door_addresses[entrance.name][0] - try: - vanilla_ref = door_addresses[entrance.name][1] - vanilla = exit_ids[vanilla_ref] - except IndexError: - vanilla = None + addresses = door_addresses[entrance.name][0] - entrance.connect(region, addresses, target, vanilla) + entrance.connect(region, addresses, target) world.spoiler.set_entrance(entrance.name, exit.name if exit is not None else region.name, 'entrance') @@ -690,7 +686,7 @@ def connect_exit(world, exitname, entrancename): if exit.connected_region is not None: exit.connected_region.entrances.remove(exit) - exit.connect(entrance.parent_region, door_addresses[entrance.name][0][1], exit_ids[exit.name][1]) + exit.connect(entrance.parent_region, door_addresses[entrance.name][1], exit_ids[exit.name][1]) world.spoiler.set_entrance(entrance.name, exit.name, 'exit') @@ -704,8 +700,8 @@ def connect_two_way(world, entrancename, exitname): if exit.connected_region is not None: exit.connected_region.entrances.remove(exit) - entrance.connect(exit.parent_region, door_addresses[entrance.name][0][0], exit_ids[exit.name][0]) - exit.connect(entrance.parent_region, door_addresses[entrance.name][0][1], exit_ids[exit.name][1]) + entrance.connect(exit.parent_region, door_addresses[entrance.name][0], exit_ids[exit.name][0]) + exit.connect(entrance.parent_region, door_addresses[entrance.name][1], exit_ids[exit.name][1]) world.spoiler.set_entrance(entrance.name, exit.name, 'both') @@ -1517,205 +1513,215 @@ default_dungeon_connections = [('Desert Palace Entrance (South)', 'Desert Palace ] -# ToDo somehow merge this with creation of the locations -door_addresses = {'Desert Palace Entrance (South)': ((0xDBB7B, 0x15B02),), - 'Desert Palace Entrance (West)': ((0xDBB7D, 0x15B06),), - 'Desert Palace Entrance (North)': ((0xDBB7E, 0x15B08),), - 'Desert Palace Entrance (East)': ((0xDBB7C, 0x15B04),), - 'Eastern Palace': ((0xDBB7A, 0x15B00),), - 'Tower of Hera': ((0xDBBA5, 0x15B48),), - 'Hyrule Castle Entrance (South)': ((0xDBB76, 0x15AF4),), - 'Hyrule Castle Entrance (West)': ((0xDBB75, 0x15AF2),), - 'Hyrule Castle Entrance (East)': ((0xDBB77, 0x15AF6),), - 'Agahnims Tower': ((0xDBB96, 0x15B38),), - 'Thieves Town': ((0xDBBA6, 0x15B58),), - 'Skull Woods First Section Door': ((0xDBB9C, 0x15B44),), - 'Skull Woods Second Section Door (East)': ((0xDBB9B, 0x15B42),), - 'Skull Woods Second Section Door (West)': ((0xDBB9A, 0x15B40),), - 'Skull Woods Final Section': ((0xDBB9D, 0x15B46),), - 'Ice Palace': ((0xDBB9F, 0x15B4A),), - 'Misery Mire': ((0xDBB99, 0x15B3E),), - 'Palace of Darkness': ((0xDBB98, 0x15B3C),), - 'Swamp Palace': ((0xDBB97, 0x15B3A),), - 'Turtle Rock': ((0xDBBA7, 0x15B56),), - 'Dark Death Mountain Ledge (West)': ((0xDBB87, 0x15B1A),), - 'Dark Death Mountain Ledge (East)': ((0xDBB8B, 0x15B22),), - 'Turtle Rock Isolated Ledge Entrance': ((0xDBB8A, 0x15B20),), - 'Hyrule Castle Secret Entrance Stairs': ((0xDBBA4, 0x15B54),), - 'Kakariko Well Cave': ((0xDBBAB, 0x15B62),), - 'Bat Cave Cave': ((0xDBB83, 0x15B12),), - 'Elder House (East)': ((0xDBB80, 0x15B0C),), - 'Elder House (West)': ((0xDBB7F, 0x15B0A),), - 'North Fairy Cave': ((0xDBBAA, 0x15B60),), - 'Lost Woods Hideout Stump': ((0xDBB9E, 0x15B5A),), - 'Lumberjack Tree Cave': ((0xDBB84, 0x15B14),), - 'Two Brothers House (East)': ((0xDBB82, 0x15B10),), - 'Two Brothers House (West)': ((0xDBB81, 0x15B0E),), - 'Sanctuary': ((0xDBB74, 0x15AF0),), - 'Old Man Cave (West)': ((0xDBB78, 0x15AFC),), - 'Old Man Cave (East)': ((0xDBB79, 0x15AFE),), - 'Old Man House (Bottom)': ((0xDBBA2, 0x15B50),), - 'Old Man House (Top)': ((0xDBBA3, 0x15B52),), - 'Death Mountain Return Cave (East)': ((0xDBBA1, 0x15B4E),), - 'Death Mountain Return Cave (West)': ((0xDBBA0, 0x15B4C),), - 'Spectacle Rock Cave Peak': ((0xDBB95, 0x15B36),), - 'Spectacle Rock Cave': ((0xDBB94, 0x15B34),), - 'Spectacle Rock Cave (Bottom)': ((0xDBB93, 0x15B32),), - 'Paradox Cave (Bottom)': ((0xDBB90, 0x15B2C),), - 'Paradox Cave (Middle)': ((0xDBB91, 0x15B2E),), - 'Paradox Cave (Top)': ((0xDBB92, 0x15B30),), - 'Fairy Ascension Cave (Bottom)': ((0xDBB8C, 0x15B24),), - 'Fairy Ascension Cave (Top)': ((0xDBB8D, 0x15B26),), - 'Spiral Cave': ((0xDBB8F, 0x15B2A),), - 'Spiral Cave (Bottom)': ((0xDBB8E, 0x15B28),), - 'Bumper Cave (Bottom)': ((0xDBB88, 0x15B1C),), - 'Bumper Cave (Top)': ((0xDBB89, 0x15B1E),), - 'Superbunny Cave (Top)': ((0xDBB86, 0x15B18),), - 'Superbunny Cave (Bottom)': ((0xDBB85, 0x15B16),), - 'Hookshot Cave': ((0xDBBAC, 0x15B64),), - 'Hookshot Cave Back Entrance': ((0xDBBAD, 0x15B66),), - 'Ganons Tower': ((0xDBBA9, 0x15B5E),), - 'Pyramid Entrance': ((0xDBBA8, 0x15B5C),), - 'Skull Woods First Section Hole (East)': ((0xDB84D, 0xDB84E),), - 'Skull Woods First Section Hole (West)': ((0xDB84F, 0xDB850),), - 'Skull Woods First Section Hole (North)': (0xDB84C,), - 'Skull Woods Second Section Hole': ((0xDB851, 0xDB852),), - 'Pyramid Hole': ((0xDB854, 0xDB855, 0xDB856),), - 'Waterfall of Wishing': (0xDBBCE, 'Waterfall of Wishing'), - 'Dam': (0xDBBC0, 'Dam'), - 'Blinds Hideout': (0xDBBD3, 'Blinds Hideout'), - 'Hyrule Castle Secret Entrance Drop': (0xDB858,), - 'Bonk Fairy (Light)': (0xDBBE9, 'Bonk Fairy'), - 'Lake Hylia Fairy': (0xDBBD0, 'Healer Fairy'), - 'Swamp Fairy': (0xDBBDE, 'Healer Fairy'), - 'Desert Fairy': (0xDBBE4, 'Healer Fairy'), - 'Kings Grave': (0xDBBCD, 'Kings Grave'), - 'Tavern North': (0xDBBB5, 'Tavern'), # do not use, buggy - 'Chicken House': (0xDBBBD, 'Chicken House'), - 'Aginahs Cave': (0xDBBE3, 'Aginahs Cave'), - 'Sahasrahlas Hut': (0xDBBB7, 'Sahasrahlas Hut'), - 'Cave Shop (Lake Hylia)': (0xDBBCA, 'Cave Shop'), - 'Capacity Upgrade': (0xDBBCF, 'Capacity Upgrade'), - 'Kakariko Well Drop': ((0xDB85C, 0xDB85D),), - 'Blacksmiths Hut': (0xDBBD6, 'Blacksmiths Hut'), - 'Bat Cave Drop': ((0xDB859, 0xDB85A),), - 'Sick Kids House': (0xDBBB2, 'Sick Kids House'), - 'North Fairy Cave Drop': (0xDB857,), - 'Lost Woods Gamble': (0xDBBAE, 'Lost Woods Gamble'), - 'Fortune Teller (Light)': (0xDBBD7, 'Fortune Teller (Light)'), - 'Snitch Lady (East)': (0xDBBB0, 'Snitch Lady (East)'), - 'Snitch Lady (West)': (0xDBBB1, 'Snitch Lady (West)'), - 'Bush Covered House': (0xDBBB6, 'Bush Covered House'), - 'Tavern (Front)': (0xDBBB4, 'Tavern (Front)'), - 'Light World Bomb Hut': (0xDBBBC, 'Light World Bomb Hut'), - 'Kakariko Shop': (0xDBBB8, 'Kakariko Shop'), - 'Lost Woods Hideout Drop': (0xDB853,), - 'Lumberjack Tree Tree': (0xDB85B,), - 'Cave 45': (0xDBBC3, 'Cave 45'), - 'Graveyard Cave': (0xDBBC4, 'Graveyard Cave'), - 'Checkerboard Cave': (0xDBBF0, 'Checkerboard Cave'), - 'Mini Moldorm Cave': (0xDBBEF, 'Mini Moldorm Cave'), - 'Long Fairy Cave': (0xDBBC7, 'Long Fairy Cave'), - 'Good Bee Cave': (0xDBBDD, 'Good Bee Cave'), - '20 Rupee Cave': (0xDBBED, '20 Rupee Cave'), - '50 Rupee Cave': (0xDBBEB, '50 Rupee Cave'), - 'Ice Rod Cave': (0xDBBF2, 'Ice Rod Cave'), - 'Bonk Rock Cave': (0xDBBEC, 'Bonk Rock Cave'), - 'Library': (0xDBBBB, 'Library'), - 'Potion Shop': (0xDBBBE, 'Potion Shop'), - 'Sanctuary Grave': (0xDB85E,), - 'Hookshot Fairy': (0xDBBC2, 'Hookshot Fairy'), - 'Pyramid Fairy': (0xDBBD5, 'Pyramid Fairy'), - 'East Dark World Hint': (0xDBBDB, 'East Dark World Hint'), - 'Palace of Darkness Hint': (0xDBBDA, 'Palace of Darkness Hint'), - 'Dark Lake Hylia Fairy': (0xDBBDF, 'Healer Fairy'), - 'Dark Lake Hylia Ledge Fairy': (0xDBBF3, 'Healer Fairy'), - 'Dark Lake Hylia Ledge Spike Cave': (0xDBBEE, 'Dark Lake Hylia Ledge Spike Cave'), - 'Dark Lake Hylia Ledge Hint': (0xDBBDC, 'Dark Lake Hylia Ledge Hint'), - 'Hype Cave': (0xDBBAF, 'Hype Cave'), - 'Bonk Fairy (Dark)': (0xDBBEA, 'Bonk Fairy'), - 'Brewery': (0xDBBBA, 'Brewery'), - 'C-Shaped House': (0xDBBC6, 'C-Shaped House'), - 'Chest Game': (0xDBBB9, 'Chest Game'), - 'Dark World Hammer Peg Cave': (0xDBBF1, 'Dark World Hammer Peg Cave'), - 'Red Shield Shop': (0xDBBE7, 'Red Shield Shop'), - 'Dark Sanctuary Hint': (0xDBBCC, 'Dark Sanctuary Hint'), - 'Fortune Teller (Dark)': (0xDBBD8, 'Fortune Teller (Dark)'), - 'Dark World Shop': (0xDBBD2, 'Dark World Shop'), - 'Dark World Lumberjack Shop': (0xDBBC9, 'Dark World Shop'), - 'Dark World Potion Shop': (0xDBBE1, 'Dark World Shop'), - 'Archery Game': (0xDBBCB, 'Archery Game'), - 'Mire Shed': (0xDBBD1, 'Mire Shed'), - 'Dark Desert Hint': (0xDBBD4, 'Dark Desert Hint'), - 'Dark Desert Fairy': (0xDBBC8, 'Healer Fairy'), - 'Spike Cave': (0xDBBB3, 'Spike Cave'), - 'Cave Shop (Dark Death Mountain)': (0xDBBE0, 'Cave Shop'), - 'Dark Death Mountain Fairy': (0xDBBE2, 'Healer Fairy'), - 'Mimic Cave': (0xDBBC1, 'Mimic Cave'), - 'Big Bomb Shop': (0xDBBC5, 'Big Bomb Shop'), - 'Dark Lake Hylia Shop': (0xDBBE6, 'Dark World Shop'), - 'Lumberjack House': (0xDBBE8, 'Lumberjack House'), - 'Lake Hylia Fortune Teller': (0xDBBE5, 'Fortune Teller (Light)'), - 'Kakariko Gamble Game': (0xDBBD9, 'Kakariko Gamble Game')} +# format: +# Key=Name +# addr = Door_addr #single exit (temporary) +# | (door_index, exitdata) # multiexit +# | [addr] # holes -exit_ids = {'Desert Palace Exit (South)': (0x09, 0x84), - 'Desert Palace Exit (West)': (0x0B, 0x83), - 'Desert Palace Exit (East)': (0x0A, 0x85), - 'Desert Palace Exit (North)': (0x0C, 0x63), - 'Eastern Palace Exit': (0x08, 0xC9), - 'Tower of Hera Exit': (0x33, 0x77), - 'Hyrule Castle Exit (South)': (0x04, 0x61), - 'Hyrule Castle Exit (West)': (0x03, 0x60), - 'Hyrule Castle Exit (East)': (0x05, 0x62), - 'Agahnims Tower Exit': (0x24, 0xE0), - 'Thieves Town Exit': (0x34, 0xDB), - 'Skull Woods First Section Exit': (0x2A, 0x58), - 'Skull Woods Second Section Exit (East)': (0x29, 0x57), - 'Skull Woods Second Section Exit (West)': (0x28, 0x56), - 'Skull Woods Final Section Exit': (0x2B, 0x59), - 'Ice Palace Exit': (0x2D, 0x0E), - 'Misery Mire Exit': (0x27, 0x98), - 'Palace of Darkness Exit': (0x26, 0x4A), - 'Swamp Palace Exit': (0x25, 0x28), - 'Turtle Rock Exit (Front)': (0x35, 0xD6), - 'Turtle Rock Ledge Exit (West)': (0x15, 0x23), - 'Turtle Rock Ledge Exit (East)': (0x19, 0x24), - 'Turtle Rock Isolated Ledge Exit': (0x18, 0xD5), - 'Hyrule Castle Secret Entrance Exit': (0x32, 0x55), - 'Kakariko Well Exit': (0x39, 0x2F), - 'Bat Cave Exit': (0x11, 0xE3), - 'Elder House Exit (East)': (0x0E, 0xF3), - 'Elder House Exit (West)': (0x0D, 0xF2), - 'North Fairy Cave Exit': (0x38, 0x08), - 'Lost Woods Hideout Exit': (0x2C, 0xE1), - 'Lumberjack Tree Exit': (0x12, 0xE2), - 'Two Brothers House Exit (East)': (0x10, 0xF5), - 'Two Brothers House Exit (West)': (0x0F, 0xF4), - 'Sanctuary Exit': (0x02, 0x12), - 'Old Man Cave Exit (East)': (0x07, 0xF1), - 'Old Man Cave Exit (West)': (0x06, 0xF0), - 'Old Man House Exit (Bottom)': (0x30, 0xE4), - 'Old Man House Exit (Top)': (0x31, 0xE5), - 'Death Mountain Return Cave Exit (West)': (0x2E, 0xE6), - 'Death Mountain Return Cave Exit (East)': (0x2F, 0xE7), - 'Spectacle Rock Cave Exit': (0x21, 0xF9), - 'Spectacle Rock Cave Exit (Top)': (0x22, 0xFA), - 'Spectacle Rock Cave Exit (Peak)': (0x23, 0xEA), - 'Paradox Cave Exit (Bottom)': (0x1E, 0xFF), - 'Paradox Cave Exit (Middle)': (0x1F, 0xEF), - 'Paradox Cave Exit (Top)': (0x20, 0xDF), - 'Fairy Ascension Cave Exit (Bottom)': (0x1A, 0xFD), - 'Fairy Ascension Cave Exit (Top)': (0x1B, 0xED), - 'Spiral Cave Exit': (0x1C, 0xFE), - 'Spiral Cave Exit (Top)': (0x1D, 0xEE), - 'Bumper Cave Exit (Top)': (0x17, 0xEB), - 'Bumper Cave Exit (Bottom)': (0x16, 0xFB), - 'Superbunny Cave Exit (Top)': (0x14, 0xE8), - 'Superbunny Cave Exit (Bottom)': (0x13, 0xF8), - 'Hookshot Cave Exit (South)': (0x3A, 0x3C), - 'Hookshot Cave Exit (North)': (0x3B, 0x2C), - 'Ganons Tower Exit': (0x37, 0x0C), - 'Pyramid Exit': (0x36, 0x10), +# ToDo somehow merge this with creation of the locations +door_addresses = {'Desert Palace Entrance (South)': (0x08, (0x0084, 0x30, 0x0314, 0x0c56, 0x00a6, 0x0ca8, 0x0128, 0x0cc3, 0x0133, 0x0a, 0xfa, 0x0000, 0x0000)), + 'Desert Palace Entrance (West)': (0x0A, (0x0083, 0x30, 0x0280, 0x0c46, 0x0003, 0x0c98, 0x0088, 0x0cb3, 0x0090, 0x0a, 0xfd, 0x0000, 0x0000)), + 'Desert Palace Entrance (North)': (0x0B, (0x0063, 0x30, 0x0016, 0x0c00, 0x00a2, 0x0c28, 0x0128, 0x0c6d, 0x012f, 0x00, 0x0e, 0x0000, 0x0000)), + 'Desert Palace Entrance (East)': (0x09, (0x0085, 0x30, 0x02a8, 0x0c4a, 0x0142, 0x0c98, 0x01c8, 0x0cb7, 0x01cf, 0x06, 0xfe, 0x0000, 0x0000)), + 'Eastern Palace': (0x07, (0x00c9, 0x1e, 0x005a, 0x0600, 0x0ed6, 0x0618, 0x0f50, 0x066d, 0x0f5b, 0x00, 0xfa, 0x0000, 0x0000)), + 'Tower of Hera': (0x32, (0x0077, 0x03, 0x0050, 0x0014, 0x087c, 0x0068, 0x08f0, 0x0083, 0x08fb, 0x0a, 0xf4, 0x0000, 0x0000)), + 'Hyrule Castle Entrance (South)': (0x03, (0x0061, 0x1b, 0x0530, 0x0692, 0x0784, 0x06cc, 0x07f8, 0x06ff, 0x0803, 0x0e, 0xfa, 0x0000, 0x87be)), + 'Hyrule Castle Entrance (West)': (0x02, (0x0060, 0x1b, 0x0016, 0x0600, 0x06ae, 0x0604, 0x0728, 0x066d, 0x0733, 0x00, 0x02, 0x0000, 0x8124)), + 'Hyrule Castle Entrance (East)': (0x04, (0x0062, 0x1b, 0x004a, 0x0600, 0x0856, 0x0604, 0x08c8, 0x066d, 0x08d3, 0x00, 0xfa, 0x0000, 0x8158)), + 'Agahnims Tower': (0x23, (0x00e0, 0x1b, 0x0032, 0x0600, 0x0784, 0x0634, 0x07f8, 0x066d, 0x0803, 0x00, 0x0a, 0x0000, 0x82be)), + 'Thieves Town': (0x33, (0x00db, 0x58, 0x0b2e, 0x075a, 0x0176, 0x07a8, 0x01f8, 0x07c7, 0x0203, 0x06, 0xfa, 0x0000, 0x0000)), + 'Skull Woods First Section Door': (0x29, (0x0058, 0x40, 0x0f4c, 0x01f6, 0x0262, 0x0248, 0x02e8, 0x0263, 0x02ef, 0x0a, 0xfe, 0x0000, 0x0000)), + 'Skull Woods Second Section Door (East)': (0x28, (0x0057, 0x40, 0x0eb8, 0x01e6, 0x01c2, 0x0238, 0x0248, 0x0253, 0x024f, 0x0a, 0xfe, 0x0000, 0x0000)), + 'Skull Woods Second Section Door (West)': (0x27, (0x0056, 0x40, 0x0c8e, 0x01a6, 0x0062, 0x01f8, 0x00e8, 0x0213, 0x00ef, 0x0a, 0x0e, 0x0000, 0x0000)), + 'Skull Woods Final Section': (0x2A, (0x0059, 0x40, 0x0282, 0x0066, 0x0016, 0x00b8, 0x0098, 0x00d3, 0x00a3, 0x0a, 0xfa, 0x0000, 0x0000)), + 'Ice Palace': (0x2C, (0x000e, 0x75, 0x0bc6, 0x0d6a, 0x0c3e, 0x0db8, 0x0cb8, 0x0dd7, 0x0cc3, 0x06, 0xf2, 0x0000, 0x0000)), + 'Misery Mire': (0x26, (0x0098, 0x70, 0x0414, 0x0c79, 0x00a6, 0x0cc7, 0x0128, 0x0ce6, 0x0133, 0x07, 0xfa, 0x0000, 0x0000)), + 'Palace of Darkness': (0x25, (0x004a, 0x5e, 0x005a, 0x0600, 0x0ed6, 0x0628, 0x0f50, 0x066d, 0x0f5b, 0x00, 0xfa, 0x0000, 0x0000)), + 'Swamp Palace': (0x24, (0x0028, 0x7b, 0x049e, 0x0e8c, 0x06f2, 0x0ed8, 0x0778, 0x0ef9, 0x077f, 0x04, 0xfe, 0x0000, 0x0000)), + 'Turtle Rock': (0x34, (0x00d6, 0x47, 0x0712, 0x00da, 0x0e96, 0x0128, 0x0f08, 0x0147, 0x0f13, 0x06, 0xfa, 0x0000, 0x0000)), + 'Dark Death Mountain Ledge (West)': (0x14, (0x0023, 0x45, 0x07ca, 0x0103, 0x0c46, 0x0157, 0x0cb8, 0x0172, 0x0cc3, 0x0b, 0x0a, 0x0000, 0x0000)), + 'Dark Death Mountain Ledge (East)': (0x18, (0x0024, 0x45, 0x07e0, 0x0103, 0x0d00, 0x0157, 0x0d78, 0x0172, 0x0d7d, 0x0b, 0x00, 0x0000, 0x0000)), + 'Turtle Rock Isolated Ledge Entrance': (0x17, (0x00d5, 0x45, 0x0ad4, 0x0164, 0x0ca6, 0x01b8, 0x0d18, 0x01d3, 0x0d23, 0x0a, 0xfa, 0x0000, 0x0000)), + 'Hyrule Castle Secret Entrance Stairs': (0x31, (0x0055, 0x1b, 0x044a, 0x067a, 0x0854, 0x06c8, 0x08c8, 0x06e7, 0x08d3, 0x06, 0xfa, 0x0000, 0x0000)), + 'Kakariko Well Cave': (0x38, (0x002f, 0x18, 0x0386, 0x0665, 0x0032, 0x06b7, 0x00b8, 0x06d2, 0x00bf, 0x0b, 0xfe, 0x0000, 0x0000)), + 'Bat Cave Cave': (0x10, (0x00e3, 0x22, 0x0412, 0x087a, 0x048e, 0x08c8, 0x0508, 0x08e7, 0x0513, 0x06, 0x02, 0x0000, 0x0000)), + 'Elder House (East)': (0x0D, (0x00f3, 0x18, 0x02c4, 0x064a, 0x0222, 0x0698, 0x02a8, 0x06b7, 0x02af, 0x06, 0xfe, 0x05d4, 0x0000)), + 'Elder House (West)': (0x0C, (0x00f2, 0x18, 0x02bc, 0x064c, 0x01e2, 0x0698, 0x0268, 0x06b9, 0x026f, 0x04, 0xfe, 0x05cc, 0x0000)), + 'North Fairy Cave': (0x37, (0x0008, 0x15, 0x0088, 0x0400, 0x0a36, 0x0448, 0x0aa8, 0x046f, 0x0ab3, 0x00, 0x0a, 0x0000, 0x0000)), + 'Lost Woods Hideout Stump': (0x2B, (0x00e1, 0x00, 0x0f4e, 0x01f6, 0x0262, 0x0248, 0x02e8, 0x0263, 0x02ef, 0x0a, 0x0e, 0x0000, 0x0000)), + 'Lumberjack Tree Cave': (0x11, (0x00e2, 0x02, 0x0118, 0x0015, 0x04c6, 0x0067, 0x0548, 0x0082, 0x0553, 0x0b, 0xfa, 0x0000, 0x0000)), + 'Two Brothers House (East)': (0x0F, (0x00f5, 0x29, 0x0880, 0x0b07, 0x0200, 0x0b58, 0x0238, 0x0b74, 0x028d, 0x09, 0x00, 0x0b86, 0x0000)), + 'Two Brothers House (West)': (0x0E, (0x00f4, 0x28, 0x08a0, 0x0b06, 0x0100, 0x0b58, 0x01b8, 0x0b73, 0x018d, 0x0a, 0x00, 0x0bb6, 0x0000)), + 'Sanctuary': (0x01, (0x0012, 0x13, 0x001c, 0x0400, 0x06de, 0x0414, 0x0758, 0x046d, 0x0763, 0x00, 0x02, 0x0000, 0x01aa)), + 'Old Man Cave (West)': (0x05, (0x00f0, 0x0a, 0x03a0, 0x0264, 0x0500, 0x02b8, 0x05a8, 0x02d3, 0x058d, 0x0a, 0x00, 0x0000, 0x0000)), + 'Old Man Cave (East)': (0x06, (0x00f1, 0x03, 0x1402, 0x0294, 0x0604, 0x02e8, 0x0678, 0x0303, 0x0683, 0x0a, 0xfc, 0x0000, 0x0000)), + 'Old Man House (Bottom)': (0x2F, (0x00e4, 0x03, 0x181a, 0x031e, 0x06b4, 0x03a7, 0x0728, 0x038d, 0x0733, 0x00, 0x0c, 0x0000, 0x0000)), + 'Old Man House (Top)': (0x30, (0x00e5, 0x03, 0x10c6, 0x0224, 0x0814, 0x0278, 0x0888, 0x0293, 0x0893, 0x0a, 0x0c, 0x0000, 0x0000)), + 'Death Mountain Return Cave (East)': (0x2E, (0x00e7, 0x03, 0x0d82, 0x01c4, 0x0600, 0x0218, 0x0648, 0x0233, 0x067f, 0x0a, 0x00, 0x0000, 0x0000)), + 'Death Mountain Return Cave (West)': (0x2D, (0x00e6, 0x0a, 0x00a0, 0x0205, 0x0500, 0x0257, 0x05b8, 0x0272, 0x058d, 0x0b, 0x00, 0x0000, 0x0000)), + 'Spectacle Rock Cave Peak': (0x22, (0x00ea, 0x03, 0x092c, 0x0133, 0x0754, 0x0187, 0x07c8, 0x01a2, 0x07d3, 0x0b, 0xfc, 0x0000, 0x0000)), + 'Spectacle Rock Cave': (0x21, (0x00fa, 0x03, 0x0eac, 0x01e3, 0x0754, 0x0237, 0x07c8, 0x0252, 0x07d3, 0x0b, 0xfc, 0x0000, 0x0000)), + 'Spectacle Rock Cave (Bottom)': (0x20, (0x00f9, 0x03, 0x0d9c, 0x01c3, 0x06d4, 0x0217, 0x0748, 0x0232, 0x0753, 0x0b, 0xfc, 0x0000, 0x0000)), + 'Paradox Cave (Bottom)': (0x1D, (0x00ff, 0x05, 0x0ee0, 0x01e3, 0x0d00, 0x0237, 0x0da8, 0x0252, 0x0d7d, 0x0b, 0x00, 0x0000, 0x0000)), + 'Paradox Cave (Middle)': (0x1E, (0x00ef, 0x05, 0x17e0, 0x0304, 0x0d00, 0x0358, 0x0dc8, 0x0373, 0x0d7d, 0x0a, 0x00, 0x0000, 0x0000)), + 'Paradox Cave (Top)': (0x1F, (0x00df, 0x05, 0x0460, 0x0093, 0x0d00, 0x00e7, 0x0db8, 0x0102, 0x0d7d, 0x0b, 0x00, 0x0000, 0x0000)), + 'Fairy Ascension Cave (Bottom)': (0x19, (0x00fd, 0x05, 0x0dd4, 0x01c4, 0x0ca6, 0x0218, 0x0d18, 0x0233, 0x0d23, 0x0a, 0xfa, 0x0000, 0x0000)), + 'Fairy Ascension Cave (Top)': (0x1A, (0x00ed, 0x05, 0x0ad4, 0x0163, 0x0ca6, 0x01b7, 0x0d18, 0x01d2, 0x0d23, 0x0b, 0xfa, 0x0000, 0x0000)), + 'Spiral Cave': (0x1C, (0x00ee, 0x05, 0x07c8, 0x0108, 0x0c46, 0x0158, 0x0cb8, 0x0177, 0x0cc3, 0x06, 0xfa, 0x0000, 0x0000)), + 'Spiral Cave (Bottom)': (0x1B, (0x00fe, 0x05, 0x0cca, 0x01a3, 0x0c56, 0x01f7, 0x0cc8, 0x0212, 0x0cd3, 0x0b, 0xfa, 0x0000, 0x0000)), + 'Bumper Cave (Bottom)': (0x15, (0x00fb, 0x4a, 0x03a0, 0x0263, 0x0500, 0x02b7, 0x05a8, 0x02d2, 0x058d, 0x0b, 0x00, 0x0000, 0x0000)), + 'Bumper Cave (Top)': (0x16, (0x00eb, 0x4a, 0x00a0, 0x020a, 0x0500, 0x0258, 0x05b8, 0x0277, 0x058d, 0x06, 0x00, 0x0000, 0x0000)), + 'Superbunny Cave (Top)': (0x13, (0x00e8, 0x45, 0x0460, 0x0093, 0x0d00, 0x00e7, 0x0db8, 0x0102, 0x0d7d, 0x0b, 0x00, 0x0000, 0x0000)), + 'Superbunny Cave (Bottom)': (0x12, (0x00f8, 0x45, 0x0ee0, 0x01e4, 0x0d00, 0x0238, 0x0d78, 0x0253, 0x0d7d, 0x0a, 0x00, 0x0000, 0x0000)), + 'Hookshot Cave': (0x39, (0x003c, 0x45, 0x04da, 0x00a3, 0x0cd6, 0x0107, 0x0d48, 0x0112, 0x0d53, 0x0b, 0xfa, 0x0000, 0x0000)), + 'Hookshot Cave Back Entrance': (0x3A, (0x002c, 0x45, 0x004c, 0x0000, 0x0c56, 0x0038, 0x0cc8, 0x006f, 0x0cd3, 0x00, 0x0a, 0x0000, 0x0000)), + 'Ganons Tower': (0x36, (0x000c, 0x43, 0x0052, 0x0000, 0x0884, 0x0028, 0x08f8, 0x006f, 0x0903, 0x00, 0xfc, 0x0000, 0x0000)), + 'Pyramid Entrance': (0x35, (0x0010, 0x5b, 0x0b0e, 0x075a, 0x0674, 0x07a8, 0x06e8, 0x07c7, 0x06f3, 0x06, 0xfa, 0x0000, 0x0000)), + 'Skull Woods First Section Hole (East)': ([0xDB84D, 0xDB84E], None), + 'Skull Woods First Section Hole (West)': ([0xDB84F, 0xDB850], None), + 'Skull Woods First Section Hole (North)': ([0xDB84C], None), + 'Skull Woods Second Section Hole': ([0xDB851, 0xDB852], None), + 'Pyramid Hole': ([0xDB854, 0xDB855, 0xDB856], None), + 'Waterfall of Wishing': (0x5B, None), + 'Dam': (0x4D, None), + 'Blinds Hideout': (0x60, None), + 'Hyrule Castle Secret Entrance Drop': ([0xDB858], None), + 'Bonk Fairy (Light)': (0x76, None), + 'Lake Hylia Fairy': (0x5D, None), + 'Swamp Fairy': (0x6B, None), + 'Desert Fairy': (0x71, None), + 'Kings Grave': (0x5A, None), + 'Tavern North': (0x42, None), # do not use, buggy + 'Chicken House': (0x4A, None), + 'Aginahs Cave': (0x70, None), + 'Sahasrahlas Hut': (0x44, None), + 'Cave Shop (Lake Hylia)': (0x57, None), + 'Capacity Upgrade': (0x5C, None), + 'Kakariko Well Drop': ([0xDB85C, 0xDB85D], None), + 'Blacksmiths Hut': (0x63, None), + 'Bat Cave Drop': ([0xDB859, 0xDB85A], None), + 'Sick Kids House': (0x3F, None), + 'North Fairy Cave Drop': ([0xDB857], None), + 'Lost Woods Gamble': (0x3B, None), + 'Fortune Teller (Light)': (0x64, None), + 'Snitch Lady (East)': (0x3D, None), + 'Snitch Lady (West)': (0x3E, None), + 'Bush Covered House': (0x43, None), + 'Tavern (Front)': (0x41, None), + 'Light World Bomb Hut': (0x49, None), + 'Kakariko Shop': (0x45, None), + 'Lost Woods Hideout Drop': ([0xDB853], None), + 'Lumberjack Tree Tree': ([0xDB85B], None), + 'Cave 45': (0x50, None), + 'Graveyard Cave': (0x51, None), + 'Checkerboard Cave': (0x7D, None), + 'Mini Moldorm Cave': (0x7C, None), + 'Long Fairy Cave': (0x54, None), + 'Good Bee Cave': (0x6A, None), + '20 Rupee Cave': (0x7A, None), + '50 Rupee Cave': (0x78, None), + 'Ice Rod Cave': (0x7F, None), + 'Bonk Rock Cave': (0x79, None), + 'Library': (0x48, None), + 'Potion Shop': (0x4B, None), + 'Sanctuary Grave': ([0xDB85E], None), + 'Hookshot Fairy': (0x4F, None), + 'Pyramid Fairy': (0x62, None), + 'East Dark World Hint': (0x68, None), + 'Palace of Darkness Hint': (0x67, None), + 'Dark Lake Hylia Fairy': (0x6C, None), + 'Dark Lake Hylia Ledge Fairy': (0x80, None), + 'Dark Lake Hylia Ledge Spike Cave': (0x7B, None), + 'Dark Lake Hylia Ledge Hint': (0x69, None), + 'Hype Cave': (0x3C, None), + 'Bonk Fairy (Dark)': (0x77, None), + 'Brewery': (0x47, None), + 'C-Shaped House': (0x53, None), + 'Chest Game': (0x46, None), + 'Dark World Hammer Peg Cave': (0x7E, None), + 'Red Shield Shop': (0x74, None), + 'Dark Sanctuary Hint': (0x59, None), + 'Fortune Teller (Dark)': (0x65, None), + 'Dark World Shop': (0x5F, None), + 'Dark World Lumberjack Shop': (0x56, None), + 'Dark World Potion Shop': (0x6E, None), + 'Archery Game': (0x58, None), + 'Mire Shed': (0x5E, None), + 'Dark Desert Hint': (0x61, None), + 'Dark Desert Fairy': (0x55, None), + 'Spike Cave': (0x40, None), + 'Cave Shop (Dark Death Mountain)': (0x6D, None), + 'Dark Death Mountain Fairy': (0x6F, None), + 'Mimic Cave': (0x4E, None), + 'Big Bomb Shop': (0x52, None), + 'Dark Lake Hylia Shop': (0x73, None), + 'Lumberjack House': (0x75, None), + 'Lake Hylia Fortune Teller': (0x72, None), + 'Kakariko Gamble Game': (0x66, None)} + +# format: +# Key=Name +# value = entrance # +# | (entrance #, exit #) +exit_ids = {'Desert Palace Exit (South)': (0x09, 0x0A), + 'Desert Palace Exit (West)': (0x0B, 0x0C), + 'Desert Palace Exit (East)': (0x0A, 0x0B), + 'Desert Palace Exit (North)': (0x0C, 0x0D), + 'Eastern Palace Exit': (0x08, 0x09), + 'Tower of Hera Exit': (0x33, 0x2D), + 'Hyrule Castle Exit (South)': (0x04, 0x03), + 'Hyrule Castle Exit (West)': (0x03, 0x02), + 'Hyrule Castle Exit (East)': (0x05, 0x04), + 'Agahnims Tower Exit': (0x24, 0x25), + 'Thieves Town Exit': (0x34, 0x35), + 'Skull Woods First Section Exit': (0x2A, 0x2B), + 'Skull Woods Second Section Exit (East)': (0x29, 0x2A), + 'Skull Woods Second Section Exit (West)': (0x28, 0x29), + 'Skull Woods Final Section Exit': (0x2B, 0x2C), + 'Ice Palace Exit': (0x2D, 0x2E), + 'Misery Mire Exit': (0x27, 0x28), + 'Palace of Darkness Exit': (0x26, 0x27), + 'Swamp Palace Exit': (0x25, 0x26), + 'Turtle Rock Exit (Front)': (0x35, 0x34), + 'Turtle Rock Ledge Exit (West)': (0x15, 0x16), + 'Turtle Rock Ledge Exit (East)': (0x19, 0x1A), + 'Turtle Rock Isolated Ledge Exit': (0x18, 0x19), + 'Hyrule Castle Secret Entrance Exit': (0x32, 0x33), + 'Kakariko Well Exit': (0x39, 0x3A), + 'Bat Cave Exit': (0x11, 0x12), + 'Elder House Exit (East)': (0x0E, 0x0F), + 'Elder House Exit (West)': (0x0D, 0x0E), + 'North Fairy Cave Exit': (0x38, 0x39), + 'Lost Woods Hideout Exit': (0x2C, 0x36), + 'Lumberjack Tree Exit': (0x12, 0x13), + 'Two Brothers House Exit (East)': (0x10, 0x11), + 'Two Brothers House Exit (West)': (0x0F, 0x10), + 'Sanctuary Exit': (0x02, 0x01), + 'Old Man Cave Exit (East)': (0x07, 0x08), + 'Old Man Cave Exit (West)': (0x06, 0x07), + 'Old Man House Exit (Bottom)': (0x30, 0x31), + 'Old Man House Exit (Top)': (0x31, 0x32), + 'Death Mountain Return Cave Exit (West)': (0x2E, 0x2F), + 'Death Mountain Return Cave Exit (East)': (0x2F, 0x30), + 'Spectacle Rock Cave Exit': (0x21, 0x22), + 'Spectacle Rock Cave Exit (Top)': (0x22, 0x23), + 'Spectacle Rock Cave Exit (Peak)': (0x23, 0x24), + 'Paradox Cave Exit (Bottom)': (0x1E, 0x1F), + 'Paradox Cave Exit (Middle)': (0x1F, 0x20), + 'Paradox Cave Exit (Top)': (0x20, 0x21), + 'Fairy Ascension Cave Exit (Bottom)': (0x1A, 0x1B), + 'Fairy Ascension Cave Exit (Top)': (0x1B, 0x1C), + 'Spiral Cave Exit': (0x1C, 0x1D), + 'Spiral Cave Exit (Top)': (0x1D, 0x1E), + 'Bumper Cave Exit (Top)': (0x17, 0x18), + 'Bumper Cave Exit (Bottom)': (0x16, 0x17), + 'Superbunny Cave Exit (Top)': (0x14, 0x15), + 'Superbunny Cave Exit (Bottom)': (0x13, 0x14), + 'Hookshot Cave Exit (South)': (0x3A, 0x3B), + 'Hookshot Cave Exit (North)': (0x3B, 0x3C), + 'Ganons Tower Exit': (0x37, 0x38), + 'Pyramid Exit': (0x36, 0x37), 'Waterfall of Wishing': 0x5C, 'Dam': 0x4E, 'Blinds Hideout': 0x61, diff --git a/Rom.py b/Rom.py index a8e2f9f7..a73b2a0c 100644 --- a/Rom.py +++ b/Rom.py @@ -297,13 +297,51 @@ def patch_rom(world, rom, hashtable, beep='normal', sprite=None): if world.keysanity: rom.write_byte(0x155C9, random.choice([0x11, 0x16])) # Randomize GT music too in keysanity mode - # patch entrances + # patch entrance/exits/holess for region in world.regions: for exit in region.exits: if exit.target is not None: - addresses = [exit.addresses] if isinstance(exit.addresses, int) else exit.addresses - for address in addresses: - rom.write_byte(address, exit.target) + if isinstance(exit.addresses, tuple): + offset = exit.target + room_id, ow_area, vram_loc, scroll_y, scroll_x, link_y, link_x, camera_y, camera_x, unknown_1, unknown_2, door_1, door_2 = exit.addresses + #room id is deliberately not written + + + rom.write_byte(0x15B8C + offset, ow_area) + rom.write_int16_to_rom(0x15BDB + 2 * offset, vram_loc) + rom.write_int16_to_rom(0x15C79 + 2 * offset, scroll_y) + rom.write_int16_to_rom(0x15D17 + 2 * offset, scroll_x) + + # for positioning fixups we abuse the roomid as a way of identifying which exit data we are appling + # Thanks to Zarby89 for originally finding these values + # todo fix screen scrolling + + if room_id == 0x0059 and world.fix_skullwoods_exit: + rom.write_int16_to_rom(0x15DB5 + 2 * offset, 0x00F8) + elif room_id == 0x004a and world.fix_palaceofdarkness_exit: + rom.write_int16_to_rom(0x15DB5 + 2 * offset, 0x0640) + elif room_id == 0x00d6 and world.fix_trock_exit: + rom.write_int16_to_rom(0x15DB5 + 2 * offset, 0x0134) + elif room_id == 0x000c and world.fix_gtower_exit: # fix ganons tower exit point + rom.write_byte(0x15DB5 + 2 * offset, 0x00A4) + else: + rom.write_int16_to_rom(0x15DB5 + 2 * offset, link_y) + + rom.write_int16_to_rom(0x15E53 + 2 * offset, link_x) + rom.write_int16_to_rom(0x15EF1 + 2 * offset, camera_y) + rom.write_int16_to_rom(0x15F8F + 2 * offset, camera_x) + rom.write_byte(0x1602D + offset, unknown_1) + rom.write_byte(0x1607C + offset, unknown_2) + rom.write_int16_to_rom(0x160CB + 2 * offset, door_1) + rom.write_int16_to_rom(0x16169 + 2 * offset, door_2) + elif isinstance(exit.addresses, list): + # is hole + for address in exit.addresses: + rom.write_byte(address, exit.target) + else: + # patch door table + rom.write_byte(0xDBB73 + exit.addresses, exit.target) + # patch medallion requirements if world.required_medallions[0] == 'Bombos': @@ -721,20 +759,6 @@ def patch_rom(world, rom, hashtable, beep='normal', sprite=None): rom.write_byte(0xFED31, 0x2A) # preopen bombable exit rom.write_byte(0xFEE41, 0x2A) # preopen bombable exit - # Thanks to Zarby89 for finding these values - # fix skull woods exit point - rom.write_byte(0x15E0D, 0xF8 if world.fix_skullwoods_exit else 0xB8) - - # fix palace of darkness exit point - rom.write_byte(0x15E03, 0x40 if world.fix_palaceofdarkness_exit else 0x28) - - # fix turtle rock exit point - rom.write_byte(0x15E1D, 0x34 if world.fix_trock_exit else 0x28) - - # fix ganons tower exit point - rom.write_byte(0x15E25, 0xA4 if world.fix_gtower_exit else 0x28) - # todo fix screen scrolling - write_strings(rom, world) # set rom name