diff --git a/Rom.py b/Rom.py index baf20cc7..4e4cfbf1 100644 --- a/Rom.py +++ b/Rom.py @@ -1518,26 +1518,39 @@ def patch_rom(world, rom, player, team, enemized, is_mystery=False): compass_mode = 0x02 # always on elif world.compassshuffle[player] or world.doorShuffle[player] != 'vanilla' or world.dungeon_counters[player] == 'pickup': compass_mode = 0x01 # show on pickup - if world.shuffle[player] != 'vanilla' and world.overworld_map[player] != 'default': + if (world.shuffle[player] != 'vanilla' and world.overworld_map[player] != 'default') or world.owMixed[player]: compass_mode |= 0x80 # turn on locating dungeons - x_map_position_generic = [0x3c0, 0xbc0, 0x7c0, 0x1c0, 0x5c0, 0xdc0, 0x7c0, 0xbc0, 0x9c0, 0x3c0] - for idx, x_map in enumerate(x_map_position_generic): - rom.write_bytes(0x53df6+idx*2, int16_as_bytes(x_map)) - rom.write_bytes(0x53e16+idx*2, int16_as_bytes(0xFC0)) - if world.compassshuffle[player] and world.overworld_map[player] == 'compass': - compass_mode |= 0x40 # compasses are wild + if world.shuffle[player] != 'vanilla' and world.overworld_map[player] != 'default': + x_map_position_generic = [0x3c0, 0xbc0, 0x7c0, 0x1c0, 0x5c0, 0xdc0, 0x7c0, 0xbc0, 0x9c0, 0x3c0] + for idx, x_map in enumerate(x_map_position_generic): + rom.write_bytes(0x53df6+idx*2, int16_as_bytes(x_map)) + rom.write_bytes(0x53e16+idx*2, int16_as_bytes(0xFC0)) + if world.compassshuffle[player] and world.overworld_map[player] == 'compass': + compass_mode |= 0x40 # compasses are wild + if not (world.shuffle[player] != 'vanilla' and world.overworld_map[player] != 'default'): + # disable HC/AT/GT icons + rom.write_bytes(0x53E8C, int16_as_bytes(0xFF00)) # GT + rom.write_bytes(0x53E8E, int16_as_bytes(0xFF00)) # AT for dungeon, portal_list in dungeon_portals.items(): ow_map_index = dungeon_table[dungeon].map_index - if len(portal_list) == 1: - portal_idx = 0 - else: - if world.doorShuffle[player] == 'crossed': - # the random choice excludes sanctuary - portal_idx = next((i for i, elem in enumerate(portal_list) - if world.get_portal(elem, player).chosen), random.choice([1, 2, 3])) + if world.shuffle[player] != 'vanilla' and world.overworld_map[player] != 'default': + if len(portal_list) == 1: + portal_idx = 0 else: - portal_idx = {'Hyrule Castle': 0, 'Desert Palace': 0, 'Skull Woods': 3, 'Turtle Rock': 3}[dungeon] - portal = world.get_portal(portal_list[portal_idx], player) + if world.doorShuffle[player] == 'crossed': + # the random choice excludes sanctuary + portal_idx = next((i for i, elem in enumerate(portal_list) + if world.get_portal(elem, player).chosen), random.choice([1, 2, 3])) + else: + portal_idx = {'Hyrule Castle': 0, 'Desert Palace': 0, 'Skull Woods': 3, 'Turtle Rock': 3}[dungeon] + else: + if dungeon in ['Hyrule Castle', 'Agahnims Tower', 'Ganons Tower']: + portal_idx = -1 + elif len(portal_list) == 1: + portal_idx = 0 + else: + portal_idx = {'Desert Palace': 1, 'Skull Woods': 3, 'Turtle Rock': 0}[dungeon] + portal = world.get_portal(portal_list[0 if portal_idx == -1 else portal_idx], player) entrance = portal.find_portal_entrance() world_indicator = 0x01 if entrance.parent_region.type == RegionType.DarkWorld else 0x00 coords = ow_prize_table[entrance.name]