Overhauled how map checks display dungeon prizes

This commit is contained in:
codemann8
2022-09-04 14:09:54 -05:00
parent a34f177e13
commit a9ed28c59a

55
Rom.py
View File

@@ -1484,8 +1484,7 @@ def patch_rom(world, rom, player, team, enemized, is_mystery=False):
elif (world.compassshuffle[player] or world.doorShuffle[player] != 'vanilla' or world.dropshuffle[player] elif (world.compassshuffle[player] or world.doorShuffle[player] != 'vanilla' or world.dropshuffle[player]
or world.dungeon_counters[player] == 'pickup' or world.pottery[player] not in ['none', 'cave']): or world.dungeon_counters[player] == 'pickup' or world.pottery[player] not in ['none', 'cave']):
compass_mode = 0x01 # show on 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]:
or (world.owMixed[player] and not (world.shuffle[player] != 'vanilla' and world.overworld_map[player] == 'default')):
compass_mode |= 0x80 # turn on locating dungeons compass_mode |= 0x80 # turn on locating dungeons
if world.overworld_map[player] == 'compass': if world.overworld_map[player] == 'compass':
compass_mode |= 0x20 # show icon if compass is collected, 0x00 for maps compass_mode |= 0x20 # show icon if compass is collected, 0x00 for maps
@@ -1500,39 +1499,49 @@ def patch_rom(world, rom, player, team, enemized, is_mystery=False):
for idx, x_map in enumerate(x_map_position_generic): for idx, x_map in enumerate(x_map_position_generic):
rom.write_bytes(0x53df6+idx*2, int16_as_bytes(x_map)) rom.write_bytes(0x53df6+idx*2, int16_as_bytes(x_map))
rom.write_bytes(0x53e16+idx*2, int16_as_bytes(0xFC0)) rom.write_bytes(0x53e16+idx*2, int16_as_bytes(0xFC0))
elif world.shuffle[player] == 'vanilla': elif world.overworld_map[player] == 'default':
# disable HC/AT/GT icons # disable HC/AT/GT icons
# rom.write_bytes(0x53E8A, int16_as_bytes(0xFF00)) # GT if not world.owMixed[player]:
# rom.write_bytes(0x53E8C, int16_as_bytes(0xFF00)) # AT rom.write_bytes(0x53E8A, int16_as_bytes(0xFF00)) # GT
rom.write_bytes(0x53E8C, int16_as_bytes(0xFF00)) # AT
rom.write_bytes(0x53E8E, int16_as_bytes(0xFF00)) # HC rom.write_bytes(0x53E8E, int16_as_bytes(0xFF00)) # HC
for dungeon, portal_list in dungeon_portals.items(): for dungeon, portal_list in dungeon_portals.items():
ow_map_index = dungeon_table[dungeon].map_index ow_map_index = dungeon_table[dungeon].map_index
if world.shuffle[player] != 'vanilla' and world.overworld_map[player] != 'default': if world.shuffle[player] != 'vanilla' and world.overworld_map[player] == 'default':
if len(portal_list) == 1: vanilla_entrances = { 'Hyrule Castle': 'Hyrule Castle Entrance (South)',
portal_idx = 0 'Desert Palace': 'Desert Palace Entrance (North)',
else: 'Skull Woods': 'Skull Woods Final Section'
if world.doorShuffle[player] == 'crossed': }
# the random choice excludes sanctuary entrance_name = vanilla_entrances[dungeon] if dungeon in vanilla_entrances else dungeon
portal_idx = next((i for i, elem in enumerate(portal_list) entrance = world.get_entrance(entrance_name, player)
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: else:
if dungeon in ['Hyrule Castle', 'Agahnims Tower', 'Ganons Tower']: if world.shuffle[player] != 'vanilla':
portal_idx = -1 if len(portal_list) == 1:
elif len(portal_list) == 1: portal_idx = 0
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]))
else:
portal_idx = {'Hyrule Castle': 0, 'Desert Palace': 0, 'Skull Woods': 3, 'Turtle Rock': 3}[dungeon]
else: else:
portal_idx = {'Desert Palace': 1, 'Skull Woods': 3, 'Turtle Rock': 0}[dungeon] if dungeon in ['Hyrule Castle', 'Agahnims Tower', 'Ganons Tower']:
portal = world.get_portal(portal_list[0 if portal_idx == -1 else portal_idx], player) portal_idx = -1
entrance = portal.find_portal_entrance() 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 world_indicator = 0x01 if entrance.parent_region.type == RegionType.DarkWorld else 0x00
coords = ow_prize_table[entrance.name] coords = ow_prize_table[entrance.name]
# figure out compass entrances and what world (light/dark) # figure out compass entrances and what world (light/dark)
if world.shuffle[player] == 'vanilla' or world.overworld_map[player] != 'default': if world.overworld_map[player] != 'default' or world.owMixed[player]:
rom.write_bytes(0x53E36+ow_map_index*2, int16_as_bytes(coords[0])) rom.write_bytes(0x53E36+ow_map_index*2, int16_as_bytes(coords[0]))
rom.write_bytes(0x53E56+ow_map_index*2, int16_as_bytes(coords[1])) rom.write_bytes(0x53E56+ow_map_index*2, int16_as_bytes(coords[1]))
rom.write_byte(0x53EA6+ow_map_index, world_indicator) rom.write_byte(0x53EA6+ow_map_index, world_indicator)
# in crossed doors - flip the compass exists flags # in crossed doors - flip the compass exists flags
if world.doorShuffle[player] == 'crossed': if world.doorShuffle[player] == 'crossed':
for dungeon, portal_list in dungeon_portals.items(): for dungeon, portal_list in dungeon_portals.items():