Ball n Chain compass fix

This commit is contained in:
aerinon
2020-01-29 06:26:49 -07:00
parent 59e9fb82f5
commit aac0d0486d
2 changed files with 29 additions and 15 deletions

View File

@@ -2023,18 +2023,19 @@ default_one_way_connections = [
]
# For crossed
compass_data = { # offset from 0x122e17, sram storage, write offset from compass_w_addr, 0 = jmp or # of nops
'Hyrule Castle': (0x1, 0xc0, 0x16, 0),
'Eastern Palace': (0x1C, 0xc1, 0x28, 0),
'Desert Palace': (0x35, 0xc2, 0x4a, 0),
'Agahnims Tower': (0x51, 0xc3, 0x5c, 0),
'Swamp Palace': (0x6A, 0xc4, 0x7e, 0),
'Palace of Darkness': (0x83, 0xc5, 0xa4, 0),
'Misery Mire': (0x9C, 0xc6, 0xca, 0),
'Skull Woods': (0xB5, 0xc7, 0xf0, 0),
'Ice Palace': (0xD0, 0xc8, 0x102, 0),
'Tower of Hera': (0xEB, 0xc9, 0x114, 0),
'Thieves Town': (0x106, 0xca, 0x138, 0),
'Turtle Rock': (0x11F, 0xcb, 0x15e, 0),
'Ganons Tower': (0x13A, 0xcc, 0x170, 2)
# offset from 0x122e17, sram storage, write offset from compass_w_addr, 0 = jmp or # of nops, dungeon_id
compass_data = {
'Hyrule Castle': (0x1, 0xc0, 0x16, 0, 0x02),
'Eastern Palace': (0x1C, 0xc1, 0x28, 0, 0x04),
'Desert Palace': (0x35, 0xc2, 0x4a, 0, 0x06),
'Agahnims Tower': (0x51, 0xc3, 0x5c, 0, 0x08),
'Swamp Palace': (0x6A, 0xc4, 0x7e, 0, 0x0a),
'Palace of Darkness': (0x83, 0xc5, 0xa4, 0, 0x0c),
'Misery Mire': (0x9C, 0xc6, 0xca, 0, 0x0e),
'Skull Woods': (0xB5, 0xc7, 0xf0, 0, 0x10),
'Ice Palace': (0xD0, 0xc8, 0x102, 0, 0x12),
'Tower of Hera': (0xEB, 0xc9, 0x114, 0, 0x14),
'Thieves Town': (0x106, 0xca, 0x138, 0, 0x16),
'Turtle Rock': (0x11F, 0xcb, 0x15e, 0, 0x18),
'Ganons Tower': (0x13A, 0xcc, 0x170, 2, 0x1a)
}

15
Rom.py
View File

@@ -2102,8 +2102,19 @@ def compass_code_good(rom):
def update_compasses(rom, world, player):
layouts = world.dungeon_layouts[player]
# cmp XX : bne escape
# cpy 32 : bne escape
# brl .itemCounts
# c9 02 d0 eastern
# nop #2
new_code = [0x07, 0xC0, 0x32, 0xD0, 0x03, 0x82, 0xB9, 0x01, 0xC9, 0x02, 0xD0, 0x10, 0xEA, 0xEA]
rom.write_bytes(compass_w_addr + 8, new_code)
# 05 06 07 08
# C9 00 D0 02 80 04 C9 02 D0 15 C0 32 D0 03 82 B3 01
# C9 XX D0 07 C0 32 D0 03 82 B9 01 C9 02 D0 10 EA EA
for name, builder in layouts.items():
digit_offset, sram_byte, write_offset, jmp_nop_flag = compass_data[name]
digit_offset, sram_byte, write_offset, jmp_nop_flag, dungeon_id = compass_data[name]
digit1 = builder.location_cnt // 10
digit2 = builder.location_cnt % 10
rom.write_byte(compass_r_addr+digit_offset, 0x90+digit1)
@@ -2128,6 +2139,8 @@ def update_compasses(rom, world, player):
else:
for i in range(0, jmp_nop_flag):
rom.write_byte(write_address+9+i, 0xea) # nop
if builder.bk_provided:
rom.write_byte(compass_w_addr+6, dungeon_id)
InconvenientDungeonEntrances = {'Turtle Rock': 'Turtle Rock Main',