Individual settings: map/compass/key/bk shuffle

This commit is contained in:
Bonta-kun
2019-12-16 21:46:47 +01:00
parent dc26dfce77
commit 1315eb55cf
8 changed files with 69 additions and 65 deletions

34
Rom.py
View File

@@ -490,14 +490,14 @@ def patch_rom(world, player, rom, enemized):
# patch music
music_addresses = dungeon_music_addresses[location.name]
if world.mapshuffle:
if world.mapshuffle[player]:
music = random.choice([0x11, 0x16])
else:
music = 0x11 if 'Pendant' in location.item.name else 0x16
for music_address in music_addresses:
rom.write_byte(music_address, music)
if world.mapshuffle:
if world.mapshuffle[player]:
rom.write_byte(0x155C9, random.choice([0x11, 0x16])) # Randomize GT music too with map shuffle
# patch entrance/exits/holes
@@ -839,7 +839,7 @@ def patch_rom(world, player, rom, enemized):
ERtimeincrease = 10
else:
ERtimeincrease = 20
if world.keyshuffle or world.bigkeyshuffle or world.mapshuffle:
if world.keyshuffle[player] or world.bigkeyshuffle[player] or world.mapshuffle[player]:
ERtimeincrease = ERtimeincrease + 15
if world.clock_mode == 'off':
rom.write_bytes(0x180190, [0x00, 0x00, 0x00]) # turn off clock mode
@@ -956,24 +956,24 @@ def patch_rom(world, player, rom, enemized):
rom.write_byte(0x18005F, world.crystals_needed_for_ganon[player])
rom.write_byte(0x18008A, 0x01 if world.mode[player] == "standard" else 0x00) # block HC upstairs doors in rain state in standard mode
rom.write_byte(0x18016A, 0x10 | ((0x01 if world.keyshuffle else 0x00)
| (0x02 if world.compassshuffle else 0x00)
| (0x04 if world.mapshuffle else 0x00)
| (0x08 if world.bigkeyshuffle else 0x00))) # free roaming item text boxes
rom.write_byte(0x18003B, 0x01 if world.mapshuffle else 0x00) # maps showing crystals on overworld
rom.write_byte(0x18016A, 0x10 | ((0x01 if world.keyshuffle[player] else 0x00)
| (0x02 if world.compassshuffle[player] else 0x00)
| (0x04 if world.mapshuffle[player] else 0x00)
| (0x08 if world.bigkeyshuffle[player] else 0x00))) # free roaming item text boxes
rom.write_byte(0x18003B, 0x01 if world.mapshuffle[player] else 0x00) # maps showing crystals on overworld
# compasses showing dungeon count
if world.clock_mode != 'off':
rom.write_byte(0x18003C, 0x00) # Currently must be off if timer is on, because they use same HUD location
elif world.compassshuffle:
elif world.compassshuffle[player]:
rom.write_byte(0x18003C, 0x01) # show on pickup
else:
rom.write_byte(0x18003C, 0x00)
rom.write_byte(0x180045, ((0x01 if world.keyshuffle else 0x00)
| (0x02 if world.bigkeyshuffle else 0x00)
| (0x04 if world.compassshuffle else 0x00)
| (0x08 if world.mapshuffle else 0x00))) # free roaming items in menu
rom.write_byte(0x180045, ((0x01 if world.keyshuffle[player] else 0x00)
| (0x02 if world.bigkeyshuffle[player] else 0x00)
| (0x04 if world.compassshuffle[player] else 0x00)
| (0x08 if world.mapshuffle[player] else 0x00))) # free roaming items in menu
# Map reveals
reveal_bytes = {
@@ -998,8 +998,8 @@ def patch_rom(world, player, rom, enemized):
return reveal_bytes.get(location.parent_region.dungeon.name, 0x0000)
return 0x0000
write_int16(rom, 0x18017A, get_reveal_bytes('Green Pendant') if world.mapshuffle else 0x0000) # Sahasrahla reveal
write_int16(rom, 0x18017C, get_reveal_bytes('Crystal 5')|get_reveal_bytes('Crystal 6') if world.mapshuffle else 0x0000) # Bomb Shop Reveal
write_int16(rom, 0x18017A, get_reveal_bytes('Green Pendant') if world.mapshuffle[player] else 0x0000) # Sahasrahla reveal
write_int16(rom, 0x18017C, get_reveal_bytes('Crystal 5')|get_reveal_bytes('Crystal 6') if world.mapshuffle[player] else 0x0000) # Bomb Shop Reveal
rom.write_byte(0x180172, 0x01 if world.retro else 0x00) # universal keys
rom.write_byte(0x180175, 0x01 if world.retro else 0x00) # rupee bow
@@ -1493,9 +1493,9 @@ def write_strings(rom, world, player):
# Lastly we write hints to show where certain interesting items are. It is done the way it is to re-use the silver code and also to give one hint per each type of item regardless of how many exist. This supports many settings well.
items_to_hint = RelevantItems.copy()
if world.keyshuffle:
if world.keyshuffle[player]:
items_to_hint.extend(SmallKeys)
if world.bigkeyshuffle:
if world.bigkeyshuffle[player]:
items_to_hint.extend(BigKeys)
random.shuffle(items_to_hint)
hint_count = 5 if world.shuffle[player] not in ['vanilla', 'dungeonssimple', 'dungeonsfull'] else 8