Improve handling of entrance addresses.

This commit is contained in:
LLCoolDave 2017-06-03 15:33:11 +02:00
parent 7949da8d07
commit 5bb8277ade
3 changed files with 220 additions and 229 deletions

View File

@ -397,6 +397,7 @@ class Entrance(object):
self.parent_region = parent
self.connected_region = None
self.target = None
self.addresses = None
self.spot_type = 'Entrance'
self.recursion_count = 0
@ -409,9 +410,10 @@ class Entrance(object):
return False
def connect(self, region, target=None):
def connect(self, region, addresses=None, target=None):
self.connected_region = region
self.target = target
self.addresses = addresses
region.entrances.append(self)
def __str__(self):

View File

@ -109,16 +109,16 @@ def link_entrances(world):
# place blacksmith, has limited options
random.shuffle(blacksmith_doors)
blacksmith_hut = blacksmith_doors.pop()
ret.append(connect_one_way(world, blacksmith_hut, 'Blacksmiths Hut'))
ret.append(connect_entrance(world, blacksmith_hut, 'Blacksmiths Hut'))
bomb_shop_doors.extend(blacksmith_doors)
# place dam and pyramid fairy, have limited options
# ToDo Dam might be behind fat fairy if we later check for this when placing crystal 5 and 6
random.shuffle(bomb_shop_doors)
bomb_shop = bomb_shop_doors.pop()
ret.append(connect_one_way(world, bomb_shop, 'Big Bomb Shop'))
ret.append(connect_entrance(world, bomb_shop, 'Big Bomb Shop'))
dam = bomb_shop_doors.pop()
ret.append(connect_one_way(world, dam, 'Dam'))
ret.append(connect_entrance(world, dam, 'Dam'))
single_doors.extend(bomb_shop_doors)
# tavern back door cannot be shuffled yet
@ -170,16 +170,16 @@ def link_entrances(world):
# place blacksmith, has limited options
random.shuffle(blacksmith_doors)
blacksmith_hut = blacksmith_doors.pop()
ret.append(connect_one_way(world, blacksmith_hut, 'Blacksmiths Hut'))
ret.append(connect_entrance(world, blacksmith_hut, 'Blacksmiths Hut'))
bomb_shop_doors.extend(blacksmith_doors)
# place dam and pyramid fairy, have limited options
# ToDo Dam might be behind fat fairy if we later check for this when placing crystal 5 and 6
random.shuffle(bomb_shop_doors)
bomb_shop = bomb_shop_doors.pop()
ret.append(connect_one_way(world, bomb_shop, 'Big Bomb Shop'))
ret.append(connect_entrance(world, bomb_shop, 'Big Bomb Shop'))
dam = bomb_shop_doors.pop()
ret.append(connect_one_way(world, dam, 'Dam'))
ret.append(connect_entrance(world, dam, 'Dam'))
single_doors.extend(bomb_shop_doors)
# tavern back door cannot be shuffled yet
@ -245,16 +245,16 @@ def link_entrances(world):
# place blacksmith, has limited options
random.shuffle(blacksmith_doors)
blacksmith_hut = blacksmith_doors.pop()
ret.append(connect_one_way(world, blacksmith_hut, 'Blacksmiths Hut'))
ret.append(connect_entrance(world, blacksmith_hut, 'Blacksmiths Hut'))
bomb_shop_doors.extend(blacksmith_doors)
# place dam and pyramid fairy, have limited options
# ToDo Dam might be behind fat fairy if we later check for this when placing crystal 5 and 6
random.shuffle(bomb_shop_doors)
bomb_shop = bomb_shop_doors.pop()
ret.append(connect_one_way(world, bomb_shop, 'Big Bomb Shop'))
ret.append(connect_entrance(world, bomb_shop, 'Big Bomb Shop'))
dam = bomb_shop_doors.pop()
ret.append(connect_one_way(world, dam, 'Dam'))
ret.append(connect_entrance(world, dam, 'Dam'))
single_doors.extend(bomb_shop_doors)
# tavern back door cannot be shuffled yet
@ -305,7 +305,7 @@ def link_entrances(world):
if world.mode == 'standard':
# cannot move uncle cave
ret.append(connect_one_way(world, 'Hyrule Castle Secret Entrance Drop', 'Hyrule Castle Secret Entrance'))
ret.append(connect_entrance(world, 'Hyrule Castle Secret Entrance Drop', 'Hyrule Castle Secret Entrance'))
ret.append(connect_exit(world, 'Hyrule Castle Secret Entrance Exit', 'Hyrule Castle Secret Entrance Stairs'))
ret.append(connect_entrance(world, lw_doors.pop(), 'Hyrule Castle Secret Entrance Exit'))
else:
@ -326,22 +326,22 @@ def link_entrances(world):
sw_hole_pool = dw_hole_entrances
mandatory_dark_world.append('Skull Woods First Section Exit')
for target in ['Skull Woods First Section (Left)', 'Skull Woods First Section (Right)', 'Skull Woods First Section (Top)']:
ret.append(connect_one_way(world, sw_hole_pool.pop(), target))
ret.append(connect_entrance(world, sw_hole_pool.pop(), target))
# sanctuary has to be in light world
ret.append(connect_one_way(world, lw_hole_entrances.pop(), 'Sewer Drop'))
ret.append(connect_entrance(world, lw_hole_entrances.pop(), 'Sewer Drop'))
mandatory_light_world.append('Sanctuary Exit')
# fill up remaining holes
for hole in dw_hole_entrances:
exits, target = hole_targets.pop()
mandatory_dark_world.append(exits)
ret.append(connect_one_way(world, hole, target))
ret.append(connect_entrance(world, hole, target))
for hole in lw_hole_entrances:
exits, target = hole_targets.pop()
mandatory_light_world.append(exits)
ret.append(connect_one_way(world, hole, target))
ret.append(connect_entrance(world, hole, target))
# hyrule castle handling
if world.mode == 'standard':
@ -479,16 +479,16 @@ def link_entrances(world):
# place blacksmith, has limited options
random.shuffle(blacksmith_doors)
blacksmith_hut = blacksmith_doors.pop()
ret.append(connect_one_way(world, blacksmith_hut, 'Blacksmiths Hut'))
ret.append(connect_entrance(world, blacksmith_hut, 'Blacksmiths Hut'))
bomb_shop_doors.extend(blacksmith_doors)
# place dam and pyramid fairy, have limited options
# ToDo Dam might be behind fat fairy if we later check for this when placing crystal 5 and 6
random.shuffle(bomb_shop_doors)
bomb_shop = bomb_shop_doors.pop()
ret.append(connect_one_way(world, bomb_shop, 'Big Bomb Shop'))
ret.append(connect_entrance(world, bomb_shop, 'Big Bomb Shop'))
dam = bomb_shop_doors.pop()
ret.append(connect_one_way(world, dam, 'Dam'))
ret.append(connect_entrance(world, dam, 'Dam'))
single_doors.extend(bomb_shop_doors)
# tavern back door cannot be shuffled yet
@ -524,7 +524,7 @@ def link_entrances(world):
if world.mode == 'standard':
# cannot move uncle cave
ret.append(connect_one_way(world, 'Hyrule Castle Secret Entrance Drop', 'Hyrule Castle Secret Entrance'))
ret.append(connect_entrance(world, 'Hyrule Castle Secret Entrance Drop', 'Hyrule Castle Secret Entrance'))
ret.append(connect_exit(world, 'Hyrule Castle Secret Entrance Exit', 'Hyrule Castle Secret Entrance Stairs'))
ret.append(connect_entrance(world, doors.pop(), 'Hyrule Castle Secret Entrance Exit'))
else:
@ -539,7 +539,7 @@ def link_entrances(world):
# fill up holes
for hole in hole_entrances:
ret.append(connect_one_way(world, hole, hole_targets.pop()))
ret.append(connect_entrance(world, hole, hole_targets.pop()))
# hyrule castle handling
if world.mode == 'standard':
@ -631,16 +631,16 @@ def link_entrances(world):
# place blacksmith, has limited options
random.shuffle(blacksmith_doors)
blacksmith_hut = blacksmith_doors.pop()
ret.append(connect_one_way(world, blacksmith_hut, 'Blacksmiths Hut'))
ret.append(connect_entrance(world, blacksmith_hut, 'Blacksmiths Hut'))
bomb_shop_doors.extend(blacksmith_doors)
# place dam and pyramid fairy, have limited options
# ToDo Dam might be behind fat fairy if we later check for this when placing crystal 5 and 6
random.shuffle(bomb_shop_doors)
bomb_shop = bomb_shop_doors.pop()
ret.append(connect_one_way(world, bomb_shop, 'Big Bomb Shop'))
ret.append(connect_entrance(world, bomb_shop, 'Big Bomb Shop'))
dam = bomb_shop_doors.pop()
ret.append(connect_one_way(world, dam, 'Dam'))
ret.append(connect_entrance(world, dam, 'Dam'))
single_doors.extend(bomb_shop_doors)
# tavern back door cannot be shuffled yet
@ -657,17 +657,15 @@ def link_entrances(world):
ret.append('Fix to prevent Agahnim Softlock: Swap Contents of Turtle Rock Ledge (East) and Mimic Cave:')
mimic_cave_entrance = world.get_entrance('Mimic Cave Mirror Spot')
mimic_cave_target = mimic_cave_entrance.connected_region
ddmle_entrance = world.get_entrance('Dark Death Mountain Ledge (East)')
ddmle_entrance.connected_region = mimic_cave_target
mimic_cave_target.entrances.remove(mimic_cave_entrance)
mimic_cave_target.entrances.append(ddmle_entrance)
ret.append('Dark Death Mountain Ledge (East) => %s' % mimic_cave_target)
aga_tower = world.get_region('Agahnims Tower')
mimic_cave_entrance.connected_region = aga_tower
mimic_cave_target = mimic_cave_entrance.connected_region
mimic_cave_target.entrances.remove(mimic_cave_entrance)
aga_tower.entrances.remove(ddmle_entrance)
aga_tower.entrances.append(mimic_cave_entrance)
ddmle_entrance.connect(mimic_cave_target, door_addresses['Dark Death Mountain Ledge (East)'][0], exit_ids[mimic_cave_target.name])
ret.append('Dark Death Mountain Ledge (East) => %s' % mimic_cave_target.name)
mimic_cave_entrance.connect(aga_tower, door_addresses['Mimic Cave Mirror Spot'], exit_ids['Agahnims Tower Exit'][0])
ret.append('Mimic Cave Mirror Spot => Agahnims Tower Exit')
# check for swamp palace fix
@ -681,36 +679,51 @@ def connect_simple(world, exitname, regionname):
world.get_entrance(exitname).connect(world.get_region(regionname))
def connect_one_way(world, exitname, regionname):
entrance = world.get_entrance(exitname)
region = world.get_region(regionname)
target = cave_codes.get(region.name, None)
entrance.connect(region, target)
return '%s => %s' % (entrance.name, region.name)
def connect_entrance(world, entrancename, exitname):
entrance = world.get_entrance(entrancename)
# check if we got an entrance or a region to connect to
try:
region = world.get_region(exitname)
exit = None
except RuntimeError:
exit = world.get_entrance(exitname)
target = (exit_ids[exit.name][0], entrance.target[1] if entrance.target is not None else None)
entrance.connect(exit.parent_region, target)
return '%s => %s' % (entrance.name, exit.name)
region = exit.parent_region
# if this was already connected somewhere, remove the backreference
if entrance.connected_region is not None:
entrance.connected_region.entrances.remove(entrance)
target = exit_ids[exit.name][0] if exit is not None else exit_ids.get(region.name, None)
addresses = door_addresses[entrance.name][0] if exit is not None else door_addresses[entrance.name]
entrance.connect(region, addresses, target)
return '%s => %s' % (entrance.name, exit.name if exit is not None else region.name)
def connect_exit(world, exitname, entrancename):
entrance = world.get_entrance(entrancename)
exit = world.get_entrance(exitname)
target = (entrance.target[0] if entrance.target is not None else None, exit_ids[exit.name][1])
entrance.target = target
exit.connect(entrance.parent_region)
# if this was already connected somewhere, remove the backreference
if exit.connected_region is not None:
exit.connected_region.entrances.remove(exit)
exit.connect(entrance.parent_region, door_addresses[entrance.name][1], exit_ids[exit.name][1])
return '%s <= %s' % (entrance.name, exit.name)
def connect_two_way(world, entrancename, exitname):
entrance = world.get_entrance(entrancename)
exit = world.get_entrance(exitname)
entrance.connect(exit.parent_region, exit_ids[exit.name])
exit.connect(entrance.parent_region)
# if these were already connected somewhere, remove the backreference
if entrance.connected_region is not None:
entrance.connected_region.entrances.remove(entrance)
if exit.connected_region is not None:
exit.connected_region.entrances.remove(exit)
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])
return '%s <=> %s' % (entrance.name, exit.name)
@ -733,7 +746,7 @@ def scramble_holes(world):
if world.mode == 'standard':
# cannot move uncle cave
ret.append(connect_two_way(world, 'Hyrule Castle Secret Entrance Stairs', 'Hyrule Castle Secret Entrance Exit'))
ret.append(connect_one_way(world, 'Hyrule Castle Secret Entrance Drop', 'Hyrule Castle Secret Entrance'))
ret.append(connect_entrance(world, 'Hyrule Castle Secret Entrance Drop', 'Hyrule Castle Secret Entrance'))
else:
hole_entrances.append(('Hyrule Castle Secret Entrance Stairs', 'Hyrule Castle Secret Entrance Drop'))
hole_targets.append(('Hyrule Castle Secret Entrance Exit', 'Hyrule Castle Secret Entrance'))
@ -742,7 +755,7 @@ def scramble_holes(world):
for entrance, drop in hole_entrances:
exit, target = hole_targets.pop()
ret.append(connect_two_way(world, entrance, exit))
ret.append(connect_one_way(world, drop, target))
ret.append(connect_entrance(world, drop, target))
return '\n'.join(ret)
@ -757,7 +770,7 @@ def connect_random(world, exitlist, targetlist, two_way=False):
if two_way:
ret.append(connect_two_way(world, exit, target))
else:
ret.append(connect_one_way(world, exit, target))
ret.append(connect_entrance(world, exit, target))
return '\n'.join(ret)
@ -836,7 +849,7 @@ def connect_doors(world, doors, targets):
while doors:
door = doors.pop()
target = targets.pop()
ret.append(connect_one_way(world, door, target))
ret.append(connect_entrance(world, door, target))
return '\n'.join(ret)
@ -1565,66 +1578,8 @@ door_addresses = {'Desert Palace Entrance (South)': (0xDBB7B, 0x15B02),
'Dark Death Mountain Ascend (Top)': (0xDBB86, 0x15B18),
'Dark Death Mountain Ascend (Bottom)': (0xDBB85, 0x15B16),
'Hookshot Cave': (0xDBBAC, 0x15B64),
'Hookshot Cave Back Entrance': (0xDBBAD, 0x15B66)}
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),
'Dark Palace 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),
'Thieves Forest 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),
'7 Chest Cave Exit (Bottom)': (0x1E, 0xFF),
'7 Chest Cave Exit (Middle)': (0x1F, 0xEF),
'7 Chest 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),
'Dark Death Mountain Ascend Exit (Top)': (0x14, 0xE8),
'Dark Death Mountain Ascend Exit (Bottom)': (0x13, 0xF8),
'Hookshot Cave Exit (South)': (0x3A, 0x3C),
'Hookshot Cave Exit (North)': (0x3B, 0x2C)}
single_doors = {'Skull Woods First Section Hole (East)': (0xDB84D, 0xDB84E),
'Hookshot Cave Back Entrance': (0xDBBAD, 0x15B66),
'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),
@ -1705,8 +1660,63 @@ single_doors = {'Skull Woods First Section Hole (East)': (0xDB84D, 0xDB84E),
'Lake Hylia Fortune Teller': 0xDBBE5,
'Kakariko Gamble Game': 0xDBBD9}
cave_codes = {'Waterfall of Wishing': 0x5C,
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),
'Dark Palace 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),
'Thieves Forest 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),
'7 Chest Cave Exit (Bottom)': (0x1E, 0xFF),
'7 Chest Cave Exit (Middle)': (0x1F, 0xEF),
'7 Chest 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),
'Dark Death Mountain Ascend Exit (Top)': (0x14, 0xE8),
'Dark Death Mountain Ascend Exit (Bottom)': (0x13, 0xF8),
'Hookshot Cave Exit (South)': (0x3A, 0x3C),
'Hookshot Cave Exit (North)': (0x3B, 0x2C),
'Waterfall of Wishing': 0x5C,
'Dam': 0x4E,
'Thiefs Hut': 0x61,
'Lumberjack House': 0x6B,

23
Rom.py
View File

@ -1,5 +1,4 @@
from Dungeons import dungeon_music_addresses
from EntranceShuffle import door_addresses, single_doors
from Text import string_to_alttp_text, text_addresses, credits_addresses, string_to_credits
from Text import Uncle_texts, Ganon1_texts, PyramidFairy_texts, TavernMan_texts, Sahasrahla2_texts, Triforce_texts, Blind_texts, BombShop2_texts
from Text import KingsReturn_texts, Sanctuary_texts, Kakariko_texts, Blacksmiths_texts, DeathMountain_texts, LostWoods_texts, WishingWell_texts, DesertPalace_texts, MountainTower_texts, LinksHouse_texts, Lumberjacks_texts, SickKid_texts, FluteBoy_texts, Zora_texts, MagicShop_texts
@ -40,27 +39,7 @@ def patch_rom(world, rom, hashtable, quickswap=False, beep='normal', sprite=None
for region in world.regions:
for exit in region.exits:
if exit.target is not None:
try:
# ugly fix for agahnim fix in simple dungeon shuffle mode
if world.agahnim_fix_required and exit.name == 'Dark Death Mountain Ledge (East)':
write_byte(rom, door_addresses[exit.name][0], world.get_entrance('Mimic Cave Mirror Spot').target)
continue
addresses = door_addresses[exit.name]
write_byte(rom, addresses[0], exit.target[0])
write_byte(rom, addresses[1], exit.target[1])
except KeyError:
# probably cave
# ugly fix for agahnim fix in simple dungeon shuffle mode
if world.agahnim_fix_required and exit.name == 'Mimic Cave Mirror Spot':
write_byte(rom, single_doors[exit.name], world.get_entrance('Dark Death Mountain Ledge (East)').target[0])
write_byte(rom, door_addresses['Dark Death Mountain Ledge (East)'][1], world.get_entrance('Dark Death Mountain Ledge (East)').target[1])
continue
addresses = single_doors[exit.name]
if not isinstance(addresses, tuple):
addresses = (addresses,)
addresses = [exit.addresses] if isinstance(exit.addresses, int) else exit.addresses
for address in addresses:
write_byte(rom, address, exit.target)