Add option to enable item quickswap with L/R

This commit is contained in:
LLCoolDave
2017-05-25 12:50:42 +02:00
parent 2f9b91d7fc
commit 7af2425c9f
2 changed files with 27 additions and 10 deletions

28
Rom.py
View File

@@ -4,7 +4,7 @@ from Text import string_to_alttp_text, text_addresses, altar_text
import random
def patch_rom(world, rom):
def patch_rom(world, rom, quickswap=False):
# patch items
for location in world.get_locations():
if location.name == 'Ganon':
@@ -196,6 +196,27 @@ def patch_rom(world, rom):
else:
write_byte(rom, 0x4E3BB, 0xEB)
# disable open door sprites when exiting caves
if world.shuffle not in ['default', 'dungeonssimple', 'dungeonsfull']:
for i in range(0x85):
write_byte(rom, 0x15274 + i, 0x00)
# enable quick item swapping with L and R (ported by Amazing Ampharos)
if quickswap:
write_bytes(rom, 0x107fb, [0x22, 0x50, 0xFF, 0x1F])
write_bytes(rom, 0x12451, [0x22, 0x50, 0xFF, 0x1F])
write_bytes(rom, 0xfff50, [0x20, 0x58, 0xFF, 0xA5, 0xF6, 0x29, 0x40, 0x6B, 0xA5, 0xF6, 0x89, 0x10, 0xF0, 0x03, 0x4C, 0x69,
0xFF, 0x89, 0x20, 0xF0, 0x03, 0x4C, 0xAA, 0xFF, 0x60, 0xAD, 0x02, 0x02, 0xF0, 0x3B, 0xDA, 0xAA,
0xE0, 0x0F, 0xF0, 0x14, 0xE0, 0x10, 0xF0, 0x14, 0xE0, 0x14, 0xD0, 0x02, 0xA2, 0x00, 0xE8, 0xBF,
0x3F, 0xF3, 0x7E, 0xF0, 0xEB, 0x4C, 0xEB, 0xFF, 0xA2, 0x01, 0x80, 0x0A, 0xAF, 0x4F, 0xF3, 0x7E,
0xAA, 0xE0, 0x04, 0xF0, 0x10, 0xE8, 0xBF, 0x5B, 0xF3, 0x7E, 0xF0, 0xF5, 0x8A, 0x8F, 0x4F, 0xF3,
0x7E, 0xA2, 0x10, 0x80, 0xE0, 0xA2, 0x11, 0x80, 0xD6, 0x60, 0xAD, 0x02, 0x02, 0xF0, 0x3B, 0xDA,
0xAA, 0xE0, 0x11, 0xF0, 0x14, 0xE0, 0x10, 0xF0, 0x14, 0xE0, 0x01, 0xD0, 0x02, 0xA2, 0x15, 0xCA,
0xBF, 0x3F, 0xF3, 0x7E, 0xF0, 0xEB, 0x4C, 0xEB, 0xFF, 0xA2, 0x04, 0x80, 0x0A, 0xAF, 0x4F, 0xF3,
0x7E, 0xAA, 0xE0, 0x01, 0xF0, 0x10, 0xCA, 0xBF, 0x5B, 0xF3, 0x7E, 0xF0, 0xF5, 0x8A, 0x8F, 0x4F,
0xF3, 0x7E, 0xA2, 0x10, 0x80, 0xE0, 0xA2, 0x0F, 0x80, 0xD6, 0x60, 0xA9, 0x20, 0x8D, 0x2F, 0x01,
0x8E, 0x02, 0x02, 0x22, 0x7F, 0xDB, 0x0D, 0xFA, 0x60, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF])
# write strings
write_string_to_rom(rom, 'Ganon2', 'Did you find the silver arrows in Hyrule?')
write_string_to_rom(rom, 'Uncle', 'Good Luck!\nYou will need it.')
@@ -209,11 +230,6 @@ def patch_rom(world, rom):
write_string_to_rom(rom, 'Ganon1', '\n\n\n\n\n\n\n\n\nWhy are you reading an empty textbox?')
write_string_to_rom(rom, 'TavernMan', 'Did you know that talking to random NPCs wastes time in a race? I hope this information may be of use to you in the future.')
# disable open door sprites when exiting caves
if world.shuffle not in ['default', 'dungeonssimple', 'dungeonsfull']:
for i in range(0x85):
write_byte(rom, 0x15274 + i, 0x00)
altaritem = world.get_location('Altar').item.name if world.get_location('Altar').item is not None else 'Nothing'
write_string_to_rom(rom, 'Altar', altar_text.get(altaritem, 'Unknown Item.'))