From c968621ba30f8206a2375f8a716030ee72cf70c0 Mon Sep 17 00:00:00 2001 From: aerinon Date: Tue, 31 Mar 2020 11:00:49 -0600 Subject: [PATCH] Tons of edge work: --Refactor of scrolling --Addition of edge math --Tied linking doors to DR Flag --Fixed vanilla linking doors --- BaseClasses.py | 11 +- DoorShuffle.py | 29 ++-- Doors.py | 10 +- DungeonGenerator.py | 31 +--- Main.py | 2 +- Rom.py | 2 + Utils.py | 24 +++- asm/doorrando.asm | 4 +- asm/doortables.asm | 306 +++++++++++++++++++-------------------- asm/drhooks.asm | 10 +- asm/edges.asm | 342 +++++++++++++++++++++++++++++++++----------- asm/math.asm | 15 +- asm/normal.asm | 191 +++++++++---------------- 13 files changed, 559 insertions(+), 418 deletions(-) diff --git a/BaseClasses.py b/BaseClasses.py index 437e5544..9b403e91 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -1188,15 +1188,24 @@ class Door(object): if self.type == DoorType.Open: bitmask = self.edge_id bitmask += 0x10 * self.layer - bitmask += 0x20 * self.quadrant bitmask += 0x80 if src.type == DoorType.Open: + bitmask += 0x20 * self.quadrant fraction = 0x10 * multiply_lookup[src.edge_width][self.edge_width] fraction += divisor_lookup[src.edge_width][self.edge_width] return [self.roomIndex, bitmask, fraction] else: + bitmask += 0x20 * self.quad_indicator() return [self.roomIndex, bitmask] + def quad_indicator(self): + if self.direction in [Direction.North, Direction.South]: + return self.quadrant & 0x1 + elif self.direction in [Direction.East, Direction.West]: + return (self.quadrant & 0x2) >> 1 + return 0 + + def dir(self, direction, room, doorIndex, layer): self.direction = direction self.roomIndex = room diff --git a/DoorShuffle.py b/DoorShuffle.py index 90c572ce..0b4c6598 100644 --- a/DoorShuffle.py +++ b/DoorShuffle.py @@ -50,9 +50,9 @@ def link_doors(world, player): connect_one_way(world, ent, ext, player) vanilla_key_logic(world, player) elif world.doorShuffle[player] == 'basic': - # if not world.experimental[player]: - for entrance, ext in open_edges: - connect_two_way(world, entrance, ext, player) + if not world.experimental[player]: + for entrance, ext in open_edges: + connect_two_way(world, entrance, ext, player) within_dungeon(world, player) elif world.doorShuffle[player] == 'crossed': for entrance, ext in open_edges: @@ -1079,6 +1079,9 @@ def flatten_pair_list(paired_list): return flat_list +okay_normals = [DoorKind.Normal, DoorKind.SmallKey, DoorKind.Bombable, DoorKind.Dashable, DoorKind.DungeonChanger] + + def find_key_door_candidates(region, checked, world, player): dungeon = region.dungeon candidates = [] @@ -1103,11 +1106,12 @@ def find_key_door_candidates(region, checked, world, player): elif d.type == DoorType.Normal: d2 = d.dest if d2 not in candidates: - room_b = world.get_room(d2.roomIndex, player) - pos_b, kind_b = room_b.doorList[d2.doorListPos] - okay_normals = [DoorKind.Normal, DoorKind.SmallKey, DoorKind.Bombable, - DoorKind.Dashable, DoorKind.DungeonChanger] - valid = kind in okay_normals and kind_b in okay_normals + if d2.type == DoorType.Normal: + room_b = world.get_room(d2.roomIndex, player) + pos_b, kind_b = room_b.doorList[d2.doorListPos] + valid = kind in okay_normals and kind_b in okay_normals + else: + valid = kind in okay_normals if valid and 0 <= d2.doorListPos < 4: candidates.append(d2) else: @@ -1224,10 +1228,13 @@ def smooth_door_pairs(world, player): partner = door.dest skip.add(partner) room_a = world.get_room(door.roomIndex, player) - room_b = world.get_room(partner.roomIndex, player) type_a = room_a.kind(door) - type_b = room_b.kind(partner) - valid_pair = stateful_door(door, type_a) and stateful_door(partner, type_b) + if partner.type in [DoorType.Normal, DoorType.Interior]: + room_b = world.get_room(partner.roomIndex, player) + type_b = room_b.kind(partner) + valid_pair = stateful_door(door, type_a) and stateful_door(partner, type_b) + else: + valid_pair, room_b, type_b = False, None, None if door.type == DoorType.Normal: if type_a == DoorKind.SmallKey or type_b == DoorKind.SmallKey: if valid_pair: diff --git a/Doors.py b/Doors.py index 125865f8..d8c6c778 100644 --- a/Doors.py +++ b/Doors.py @@ -72,11 +72,11 @@ def create_doors(world, player): create_door(player, 'Hyrule Dungeon North Abyss Catwalk Edge', Open).dir(So, 0x72, None, High).edge(1, Z, 0x08), create_door(player, 'Hyrule Dungeon North Abyss Catwalk Dropdown', Lgcl), create_door(player, 'Hyrule Dungeon South Abyss North Edge', Open).dir(No, 0x82, None, Low).edge(0, A, 0x10), - create_door(player, 'Hyrule Dungeon South Abyss West Edge', Open).dir(We, 0x82, None, Low).edge(3, Z, 0x10), + create_door(player, 'Hyrule Dungeon South Abyss West Edge', Open).dir(We, 0x82, None, Low).edge(3, Z, 0x18), create_door(player, 'Hyrule Dungeon South Abyss Catwalk North Edge', Open).dir(No, 0x82, None, High).edge(1, A, 0x08), - create_door(player, 'Hyrule Dungeon South Abyss Catwalk West Edge', Open).dir(We, 0x82, None, High).edge(4, A, 0x18), + create_door(player, 'Hyrule Dungeon South Abyss Catwalk West Edge', Open).dir(We, 0x82, None, High).edge(4, A, 0x10), create_door(player, 'Hyrule Dungeon Guardroom Catwalk Edge', Open).dir(Ea, 0x81, None, High).edge(3, S, 0x10), - create_door(player, 'Hyrule Dungeon Guardroom Abyss Edge', Open).dir(Ea, 0x81, None, High).edge(4, X, 0x18), + create_door(player, 'Hyrule Dungeon Guardroom Abyss Edge', Open).dir(Ea, 0x81, None, Low).edge(4, X, 0x18), create_door(player, 'Hyrule Dungeon Guardroom N', Nrml).dir(No, 0x81, Left, Low).pos(0), create_door(player, 'Hyrule Dungeon Armory S', Nrml).dir(So, 0x71, Left, Low).trap(0x2).pos(1), create_door(player, 'Hyrule Dungeon Armory ES', Intr).dir(Ea, 0x71, Left, Low).pos(2), @@ -201,8 +201,8 @@ def create_doors(world, player): create_door(player, 'Desert Trap Room SW', Intr).dir(So, 0x75, Left, High).pos(0), create_door(player, 'Desert North Hall SE Edge', Open).dir(So, 0x74, None, High).edge(5, X, 0x20), create_door(player, 'Desert North Hall SW Edge', Open).dir(So, 0x74, None, High).edge(3, Z, 0x20), - create_door(player, 'Desert North Hall W Edge', Open).dir(We, 0x74, None, High).edge(2, Z, 0x20), - create_door(player, 'Desert North Hall E Edge', Open).dir(Ea, 0x74, None, High).edge(1, X, 0x20), + create_door(player, 'Desert North Hall W Edge', Open).dir(We, 0x74, None, High).edge(1, Z, 0x20), + create_door(player, 'Desert North Hall E Edge', Open).dir(Ea, 0x74, None, High).edge(2, X, 0x20), create_door(player, 'Desert North Hall NW', Intr).dir(No, 0x74, Left, High).pos(1), create_door(player, 'Desert Map SW', Intr).dir(So, 0x74, Left, High).pos(1), create_door(player, 'Desert North Hall NE', Intr).dir(No, 0x74, Right, High).pos(0), diff --git a/DungeonGenerator.py b/DungeonGenerator.py index 34b2ba9d..6aae3436 100644 --- a/DungeonGenerator.py +++ b/DungeonGenerator.py @@ -20,10 +20,6 @@ class Hook(Enum): South = 2 East = 3 Stairs = 4 - NEdge = 5 - SEdge = 6 - WEdge = 7 - EEdge = 8 class GraphPiece: @@ -526,33 +522,14 @@ def opposite_h_type(h_type): Hook.South: Hook.North, Hook.West: Hook.East, Hook.East: Hook.West, - Hook.NEdge: Hook.SEdge, - Hook.SEdge: Hook.NEdge, - Hook.EEdge: Hook.WEdge, - Hook.WEdge: Hook.EEdge, } return type_map[h_type] -edge_map = { - Direction.North: Hook.NEdge, - Direction.South: Hook.SEdge, - Direction.West: Hook.WEdge, - Direction.East: Hook.EEdge, -} - -edge_map_back = { - Direction.North: Hook.SEdge, - Direction.South: Hook.NEdge, - Direction.West: Hook.EEdge, - Direction.East: Hook.WEdge, -} - - def hook_from_door(door): if door.type == DoorType.SpiralStairs: return Hook.Stairs - if door.type == DoorType.Normal: + if door.type in [DoorType.Normal, DoorType.Open]: dir = { Direction.North: Hook.North, Direction.South: Hook.South, @@ -560,15 +537,13 @@ def hook_from_door(door): Direction.East: Hook.East, } return dir[door.direction] - if door.type == DoorType.Open: - return edge_map[door.direction] return None def hanger_from_door(door): if door.type == DoorType.SpiralStairs: return Hook.Stairs - if door.type == DoorType.Normal: + if door.type in [DoorType.Normal, DoorType.Open]: dir = { Direction.North: Hook.South, Direction.South: Hook.North, @@ -576,8 +551,6 @@ def hanger_from_door(door): Direction.East: Hook.West, } return dir[door.direction] - if door.type == DoorType.Open: - return edge_map_back[door.direction] return None diff --git a/Main.py b/Main.py index 5085c935..1bc7e208 100644 --- a/Main.py +++ b/Main.py @@ -24,7 +24,7 @@ from Fill import distribute_items_cutoff, distribute_items_staleness, distribute from ItemList import generate_itempool, difficulties, fill_prizes from Utils import output_path, parse_player_names, print_wiki_doors_by_region, print_wiki_doors_by_room -__version__ = '0.0.20dev' +__version__ = '0.1.0-dev' class EnemizerError(RuntimeError): pass diff --git a/Rom.py b/Rom.py index 0d942f35..2f5d4054 100644 --- a/Rom.py +++ b/Rom.py @@ -319,6 +319,8 @@ def get_sprite_from_name(name): name = name.lower() if name in ['random', 'randomonhit']: return Sprite(random.choice(list(_sprite_table.values()))) + if name == ('(default link)'): + name = 'link' return Sprite(_sprite_table[name]) if name in _sprite_table else None class Sprite(object): diff --git a/Utils.py b/Utils.py index 63670d78..a336d50f 100644 --- a/Utils.py +++ b/Utils.py @@ -189,6 +189,26 @@ entrance_data = { } +def read_layout_data(old_rom='Zelda no Densetsu - Kamigami no Triforce (Japan).sfc'): + with open(old_rom, 'rb') as stream: + old_rom_data = bytearray(stream.read()) + + string = '' + for room in range(0, 0xff+1): + # print(ent) + pointer_start = 0xf8000+room*3 + highbyte = old_rom_data[pointer_start+2] + midbyte = old_rom_data[pointer_start+1] + midbyte = midbyte - 0x80 if highbyte % 2 == 0 else midbyte + pointer = highbyte // 2 * 0x10000 + pointer += midbyte * 0x100 + pointer += old_rom_data[pointer_start] + layout_byte = old_rom_data[pointer+1] + layout = (layout_byte & 0x1c) >> 2 + string += hex(room) + ':' + str(layout) + '\n' + print(string) + + def read_entrance_data(old_rom='Zelda no Densetsu - Kamigami no Triforce (Japan).sfc'): with open(old_rom, 'rb') as stream: old_rom_data = bytearray(stream.read()) @@ -360,6 +380,6 @@ def print_graph(world): if __name__ == '__main__': - pass # make_new_base2current() - read_entrance_data(old_rom='C:\\Users\\Randall\\Documents\\kwyn\\orig\\z3.sfc') + # read_entrance_data(old_rom=sys.argv[1]) + read_layout_data(old_rom=sys.argv[1]) diff --git a/asm/doorrando.asm b/asm/doorrando.asm index f14d67c1..646580eb 100644 --- a/asm/doorrando.asm +++ b/asm/doorrando.asm @@ -19,8 +19,8 @@ incsrc spiral.asm incsrc gfx.asm incsrc keydoors.asm incsrc overrides.asm -;incsrc edges.asm -;incsrc math.asm +incsrc edges.asm +incsrc math.asm warnpc $279000 ; Data Section diff --git a/asm/doortables.asm b/asm/doortables.asm index 2aed2bf3..8071188c 100644 --- a/asm/doortables.asm +++ b/asm/doortables.asm @@ -58,156 +58,156 @@ db $00 org $27A000 DoorTable: ;; NW 00 N 01 N 02 WN 00 W 01 WS 02 SW 00 S 01 SE 02 EN 00 E 01 ES 02 - Door ruler -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Default/Garbage row -dw $8000, $8000, $8000, $0450, $8000, $8000, $8000, $8000, $8000, $0452, $8000, $8000 ; HC Back Hall (x01) -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Sewer Switches (x02) -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Crystaroller -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Arghus -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Aga 2 -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Sewer Secret Room -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Sanc -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TR Pokey -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TR Lava Pipe -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TR Pipes n Ledge -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Swap Canal -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Pod dark Maze -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Pod Bridge -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Pod Eye Statue -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; GT Pre Aga -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Ice Cross -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Ice BK -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; x20 Aga1 -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Sewer Key Rat -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Sewer Waters -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TR Eye Entrance -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TR Chest Entrance -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Swamp Statue -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; PoD Arena (x2a) -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; PoD Statue (x2b) -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Ice Compass -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; x30 Aga's Altar -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Dark Cross -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Lanmolas -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Swamp West Wing -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Flooded Key -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Swamp Main Hub (x36) -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Swamp Hammer Time -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Swamp First Basement -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Drop to the Moth -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Pod 3 Catwalks -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Pod Conveyor -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; GT Minihelma -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Ice Conveyor -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Sewers -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Desert Torches -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TT Big Chest -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TT Cellblock -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Swamp Compass Loop -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Skull3 Torches -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Pod Entrance -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Pod Mimics 1 -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; GT Conveyor Ice -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; GT Moldorm -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; IPBJ -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $0401, $8000, $8000 ; HC West Hall (x50) -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; HC Throne Room (x51) -dw $8000, $8000, $8000, $0401, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; HC East Hall (x52) -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Desert Tiles 1 -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Skull 2 Left Entrance -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Skull 2 Right Entrance -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Skull 1 Entrance -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Skull 3 Entrance -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Helmasaur -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; GT Spike Switch -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; GT Cannonball -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Gauntlet 1 -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Ice Choice Cross -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Iced U -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; HC West Lobby (x60) -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; HC Main Lobby (x61) -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; HC East Lobby (x62) -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; x66 Swamp Waterfall -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; x67 Skull 1 Left Drop -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; x68 Skull 1 Pinball -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; x6a Pod Rupees -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; x6b GT Mimics -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; x6c GT Lanmolas -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; x6d Gauntlet 2 -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; x6e Ice Gators -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; HC Armory -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Desert BK Chest -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Swamp Flooded Chests -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; GT DM's Tile -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; GT Randoroom -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; GT Warp Maze -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Ice Freezors -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Ice Hookpit -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; HC Catawalk -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Desert Right Entrance -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; GT Left -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; GT Hopeful Torch -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; GT Right -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Ice Lonely Freezor -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Vitreous (x90) -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Mire Rain -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Mire Dark Crystals -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Mire Blockswitch -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; GT Fallbridge -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; GT Torch Cross -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Eastern Darkness -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; GT Warp Maze 2 -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; GT Invis Bridge -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; GT Compass Room -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Ice Big Chests -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Icy Pots -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Mire Pre-Vitreous (xa0) -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Mire Fishbone -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Mire Bridges -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Mire Corner -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Trinexx (xa4) -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; GT Wizzrobes -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Eastern Compass (xa8) -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Eastern Courtyard (xa9) -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Eastern Map (xaa) -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TT Switch -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Blind -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Iced T -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Ice Slipway -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Mire Warpzone -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Mire ???? -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Mire Spikes -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TR Refill -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TR Dark Maze -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TR Chainchomp -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TR Rollers -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Eastern Big Key -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Easter Cannonball -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Eastern Dark Circle -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TT Hellway -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TT Bossway -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Ice Blockswitch -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Ice Backtracker -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Mire Tiles -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Mire Main Hub -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Mire Big Chest -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TR Switch Maze -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TR Narrow -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TR Early Hub -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TR Floating Torches -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Armos -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Eastern Entrance -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TT NW Quad -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TT NE Quad -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Ice Boss Drop -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Mire BK -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Mire 2 -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TR Laser Bridge -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TR Main Entrance -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Eastern Eyegores -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Eastern Attic Switches -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; Eastern Attic Start -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TT Entrance Quad -dw $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000, $8000 ; TT SE Quad +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Default/Garbage row +dw $0003, $0003, $0003, $0450, $0003, $0003, $0003, $0003, $0003, $0452, $0003, $0003 ; HC Back Hall (x01) +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Sewer Switches (x02) +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Crystaroller +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Arghus +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Aga 2 +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Sewer Secret Room +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Sanc +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Pokey +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Lava Pipe +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Pipes n Ledge +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swap Canal +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Pod dark Maze +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Pod Bridge +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Pod Eye Statue +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Pre Aga +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Cross +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice BK +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x20 Aga1 +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Sewer Key Rat +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Sewer Waters +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Eye Entrance +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Chest Entrance +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp Statue +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; PoD Arena (x2a) +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; PoD Statue (x2b) +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Compass +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x30 Aga's Altar +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Dark Cross +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Lanmolas +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp West Wing +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Flooded Key +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp Main Hub (x36) +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp Hammer Time +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp First Basement +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Drop to the Moth +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Pod 3 Catwalks +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Pod Conveyor +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Minihelma +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Conveyor +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Sewers +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Desert Torches +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT Big Chest +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT Cellblock +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp Compass Loop +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Skull3 Torches +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Pod Entrance +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Pod Mimics 1 +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Conveyor Ice +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Moldorm +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; IPBJ +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0401, $0003, $0003 ; HC West Hall (x50) +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; HC Throne Room (x51) +dw $0003, $0003, $0003, $0401, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; HC East Hall (x52) +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Desert Tiles 1 +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Skull 2 Left Entrance +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Skull 2 Right Entrance +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Skull 1 Entrance +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Skull 3 Entrance +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Helmasaur +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Spike Switch +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Cannonball +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Gauntlet 1 +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Choice Cross +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Iced U +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; HC West Lobby (x60) +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; HC Main Lobby (x61) +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; HC East Lobby (x62) +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x66 Swamp Waterfall +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x67 Skull 1 Left Drop +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x68 Skull 1 Pinball +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x6a Pod Rupees +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x6b GT Mimics +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x6c GT Lanmolas +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x6d Gauntlet 2 +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x6e Ice Gators +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; HC Armory +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Desert BK Chest +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp Flooded Chests +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT DM's Tile +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Randoroom +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Warp Maze +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Freezors +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Hookpit +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; HC Catawalk +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Desert Right Entrance +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Left +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Hopeful Torch +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Right +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Lonely Freezor +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Vitreous (x90) +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Rain +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Dark Crystals +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Blockswitch +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Fallbridge +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Torch Cross +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Darkness +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Warp Maze 2 +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Invis Bridge +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Compass Room +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Big Chests +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Icy Pots +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Pre-Vitreous (xa0) +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Fishbone +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Bridges +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Corner +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Trinexx (xa4) +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Wizzrobes +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Compass (xa8) +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Courtyard (xa9) +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Map (xaa) +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT Switch +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Blind +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Iced T +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Slipway +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Warpzone +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire ???? +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Spikes +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Refill +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Dark Maze +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Chainchomp +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Rollers +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Big Key +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Easter Cannonball +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Dark Circle +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT Hellway +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT Bossway +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Blockswitch +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Backtracker +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Tiles +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Main Hub +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Big Chest +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Switch Maze +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Narrow +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Early Hub +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Floating Torches +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Armos +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Entrance +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT NW Quad +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT NE Quad +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Boss Drop +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire BK +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire 2 +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Laser Bridge +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Main Entrance +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Eyegores +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Attic Switches +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Attic Start +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT Entrance Quad +dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT SE Quad ; this should end at 27AE10 about ; some values you can hardcode ;dw $0070, $36a0 ; ->HC Stairwell @@ -490,8 +490,9 @@ dw $0000 dw $0000,$0000,$0000,$0000 dw $ffff ; indicates the end - we can drop this -; Edge Transition Table -org $27C500 ;ends around 27C5F0 +; Edge Transition Table (Target Room, Flags, MultiDiv ratio for edges) +org $27C500 ;ends around 27C5F(9) 4 bytes would be 27C649 +;I kind of want to split the 3rd byte into two NorthOpenEdge: db $00,$80,$11, $00,$80,$11, $00,$80,$11, $00,$80,$11 db $00,$80,$11, $00,$80,$11, $00,$80,$11, $00,$80,$11 @@ -509,6 +510,7 @@ db $00,$80,$11, $00,$80,$11, $00,$80,$11 db $00,$80,$11, $00,$80,$11, $00,$80,$11 db $00,$80,$11, $00,$80,$11, $00,$80,$11 ; Edge Info Table (Midpoint, Width, Min Coord) +; I kind of want to add a fourth byte to help indicate quadrant info on min coord NorthEdgeInfo: db $a8,$10,$a0, $2c,$08,$28 ;HC db $b8,$20,$a8 ; DP West Wing diff --git a/asm/drhooks.asm b/asm/drhooks.asm index 2eb3e6a0..df946455 100644 --- a/asm/drhooks.asm +++ b/asm/drhooks.asm @@ -11,12 +11,14 @@ jsl AdjustTransition nop ;turn off linking doors -- see .notRoomLinkDoor label in Bank02.asm -org $02b5a6 -bra NotLinkDoor1 +org $02b5a8 ; <- 135a8 - Bank02.asm : 8368 (LDA $7EC004 : STA $A0) +jsl CheckLinkDoorR +bcc NotLinkDoor1 org $02b5b6 NotLinkDoor1: -org $02b647 -bra NotLinkDoor2 +org $02b649 ; <- 135a8 - Bank02.asm : 8482 (LDA $7EC004 : STA $A0) +jsl CheckLinkDoorL +bcc NotLinkDoor2 org $02b657 NotLinkDoor2: diff --git a/asm/edges.asm b/asm/edges.asm index 7b4da849..a45da373 100644 --- a/asm/edges.asm +++ b/asm/edges.asm @@ -1,6 +1,6 @@ HorzEdge: cpy #$ff : beq + - jsr DetectWestEdge : bra ++ + jsr DetectWestEdge : ldy #$02 : bra ++ + jsr DetectEastEdge ++ cmp #$ff : beq + sta $00 : asl : !add $00 : tax @@ -28,71 +28,200 @@ VertEdge: LoadEdgeRoomHorz: lda $03 : sta $a0 - sty $09 - and.b #$0f : asl a : !sub $23 : !add $09 : sta $02 + sty $06 + and.b #$0f : asl a : !sub $23 : !add $06 : sta $02 ldy #$00 : jsr ShiftVariablesMainDir - lda $a0 : and.b #$F0 : lsr #3 : sta $0603 : inc : sta $0607 - lda $04 : and #$40 : bne + - lda $603 : sta $00 : stz $01 : bra ++ - + lda $607 : sta $00 : lda #$02 : sta $01 - ++ ; $01 now contains 0 or 2 - lda $00 : sta $21 : sta $0601 : sta $0605 - lda $01 : sta $aa : lsr : sta $01 : stz $00 - lda $0a : sta $20 + lda $04 : and #$80 : bne .edge + lda $04 : sta $01 ; load up flags in $01 + jsr PrepScrollToNormal + bra .scroll - stz $0e - rep #$30 - lda $e8 : and #$01ff : sta $02 - lda $0a : and #$00ff : !add $00 : sta $00 + .edge + lda $04 : and #$10 : beq + + lda #$01 + + sta $ee ; layer stuff - cmp #$006c : !bge + - lda #$0077 : bra ++ - + cmp #$017c : !blt + - lda #$0187 : bra ++ - + !add #$000b - ++ sta $0618 : inc #2 : sta $061a + jsr MathHorz - lda $00 : cmp #$0078 : !bge + - lda #$0000 : bra ++ - + cmp #$0178 : !blt + - lda #$0100 : bra ++ - + !sub #$0078 - ++ sta $00 - - ; figures out scroll amt - cmp $02 : bne + - lda #$0000 : bra .done - + !blt + - !sub $02 : inc $0e : bra .done - + lda $02 : !sub $00 - - .done sta $ab : sep #$30 - lda $0e : asl : ora $ac : sta $ac - lda $e9 : and #$01 : asl #2 : tax : lda $0603, x : sta $e9 - - lda $04 : and #$10 : lsr #4 : sta $ee ; layer stuff + .scroll + jsr ScrollY rts LoadEdgeRoomVert: lda $03 : sta $a0 - sty $09 - and.b #$f0 : lsr #3 : !sub $21 : !add $09 : sta $02 + sty $06 + and.b #$f0 : lsr #3 : !sub $21 : !add $06 : sta $02 ldy #$01 : jsr ShiftVariablesMainDir + + lda $04 : and #$80 : bne .edge + lda $04 : sta $01 ; load up flags in $01 + jsr PrepScrollToNormal + bra .scroll + + .edge + lda $04 : and #$10 : beq + + lda #$01 + + sta $ee ; layer stuff + + jsr MathVert + lda $03 + + .scroll + jsr ScrollX + rts + + +MathHorz: + jsr MathStart : lda $20 + jsr MathMid : and #$0040 + jsr MathEnd + rts + +MathVert: + jsr MathStart : lda $22 + jsr MathMid : and #$0020 + jsr MathEnd + rts + +MathStart: + rep #$30 + lda $08 : and #$00ff : sta $00 + rts + +MathMid: + and #$01ff : !sub $00 : and #$00ff : sta $00 + ; nothing should be bigger than $a0 at this point + + lda $05 : and #$00f0 : lsr #4 : tax + lda MultDivInfo, x : and #$00ff : tay + lda $00 : jsr MultiplyByY : sta $02 + + lda $07 : and #$00ff : jsr MultiplyByY : tax + + lda $05 : and #$000f : tay + lda MultDivInfo, y : and #$00ff : tay + lda $02 : jsr DivideByY : sta $00 + lda $0c : and #$00ff : sta $02 + lda $04 + rts + +MathEnd: + beq + + lda #$0100 + + !add $02 : !add $00 + sta $04 + sep #$30 + rts + + +; expects target quad in $05 (either 0 or 1) and target pixel in $04, target room should be in $a0 +; $06 is either $ff or $01/02 +; uses $00-$03 and $0e for calculation +; also set up $ac +ScrollY: ;change the Y offset variables + lda $a0 : and.b #$f0 : lsr #3 : sta $0603 : inc : sta $0607 + + lda $05 : bne + + lda $603 : sta $00 : stz $01 : bra ++ + + lda $607 : sta $00 : lda #$02 : sta $01 + ++ ; $01 now contains 0 or 2 and $00 contains the correct lat + + stz $0e + rep #$30 + lda $00 : pha + + lda $e8 : and #$01ff : sta $02 + lda $04 : jsr LimitYCamera : sta $00 + jsr CheckRoomLayoutY : bcc + + lda $00 : cmp #$0080 : !bge ++ + cmp #$0010 : !blt .cmpSrll + lda #$0010 : bra .cmpSrll + ++ cmp #$0100 : !bge .cmpSrll + lda #$0100 + .cmpSrll sta $00 + + ; figures out scroll amt + + lda $00 : cmp $02 : bne + + lda #$0000 : bra .next + + !blt + + !sub $02 : inc $0e : bra .next + + lda $02 : !sub $00 + + .next + sta $ab + jsr AdjustCameraBoundsY + + pla : sta $00 + sep #$30 + lda $04 : sta $20 + lda $00 : sta $21 : sta $0601 : sta $0605 + lda $01 : sta $aa + lda $0e : asl : ora $ac : sta $ac + lda $e9 : and #$01 : asl #2 : tax : lda $0603, x : sta $e9 + rts + +LimitYCamera: + cmp #$006c : !bge + + lda #$0000 : bra .end + + cmp #$017d : !blt + + lda #$0110 : bra .end + + !sub #$006c + .end rts + +CheckRoomLayoutY: + jsr LoadRoomLayout ;switches to 8-bit + cmp #$00 : beq .lock + cmp #$07 : beq .free + cmp #$01 : beq .free + cmp #$04 : !bge .lock + cmp #$02 : bne + + lda $06 : cmp #$ff : beq .lock + + cmp #$03 : bne .free + lda $06 : cmp #$ff : bne .lock + .free rep #$30 : clc : rts + .lock rep #$30 : sec : rts + +LoadRoomLayout: + lda $a0 : asl : !add $a0 : tax + lda $1f8001, x : sta $b8 + lda $1f8000, x : sta $b7 + sep #$30 + ldy #$01 : lda [$b7], y : and #$1c : lsr #2 + rts + +; expects target quad in $05 (either 0 or 1) and target pixel in $04, target room should be in $a0 +; uses $00-$03 and $0e for calculation +; also set up $ac +ScrollX: ;change the X offset variables lda $a0 : and.b #$0f : asl : sta $060b : inc : sta $060f - lda $04 : and #$20 : bne + + lda $05 : bne + lda $60b : sta $00 : stz $01 : bra ++ + lda $60f : sta $00 : lda #$01 : sta $01 - ++ ; $01 now contains 0 or 1 - lda $00 : sta $23 : sta $0609 : sta $060d - lda $01 : sta $a9 : stz $00 ; setup for 16 bit ops - lda $0a : sta $22 + ++ ; $01 now contains 0 or 1 and $00 contains the correct long stz $0e ; pos/neg indicator rep #$30 + lda $00 : pha + lda $e2 : and #$01ff : sta $02 - lda $0a : and #$00ff : !add $00 : sta $00 + lda $04 : jsr LimitXCamera : sta $00 + jsr CheckRoomLayoutX : bcc + + lda $00 : cmp #$0080 : !bge ++ + lda #$0000 : bra .cmpSrll + ++ lda #$0100 + .cmpSrll sta $00 + + ;figures out scroll amt + + lda $00 : cmp $02 : bne + + lda #$0000 : bra .next + + !blt + + !sub $02 : inc $0e : bra .next + + lda $02 : !sub $00 + + .next + sta $ab : lda $04 cmp #$0078 : !bge + lda #$007f : bra ++ @@ -101,78 +230,121 @@ LoadEdgeRoomVert: + !add #$0007 ++ sta $061c : inc #2 : sta $061e - lda $00 : cmp #$0078 : !bge + - lda #$0000 : bra ++ - + cmp #$0178 : !blt + - lda #$0100 : bra ++ - + !sub #$0078 - ++ sta $00 - - ; figures out scroll amt - cmp $02 : bne + - lda #$0000 : bra .done - + !blt + - !sub $02 : inc $0e : bra .done - + lda $02 : !sub $00 - - .done sta $ab : sep #$30 + pla : sta $00 + sep #$30 + lda $04 : sta $22 + lda $00 : sta $23 : sta $0609 : sta $060d + lda $01 : sta $a9 lda $0e : asl : ora $ac : sta $ac lda $e3 : and #$01 : asl #2 : tax : lda $060b, x : sta $e3 - lda $04 : and #$10 : lsr #4 : sta $ee ; layer stuff + rts + +LimitXCamera: + cmp #$0080 : !bge + + lda #$0000 : bra .end + + cmp #$0181 : !blt + + lda #$0180 + + !sub #$0080 + .end rts + +CheckRoomLayoutX: + jsr LoadRoomLayout ;switches to 8-bit + cmp #$04 : !blt .lock + cmp #$05 : bne + + lda $06 : cmp #$ff : beq .lock + + cmp #$06 : bne .free + lda $06 : cmp #$ff : bne .lock + .free rep #$30 : clc : rts + .lock rep #$30 : sec : rts + +AdjustCameraBoundsY: + jsr CheckRoomLayoutY : bcc .free + + ; layouts that are camera locked (quads only) + lda $04 : and #$00ff : cmp #$007d : !blt + + lda #$0088 : bra ++ + + cmp #$006d : !bge + + lda #$0078 : bra ++ + + !add #$000b + + ; I think we no longer need the $02 variable + ++ sta $02 : lda $04 : and #$0100 : !add $02 : bra .setBounds + + ; layouts where the camera is free + .free lda $04 : cmp #$006c : !bge + + lda #$0077 : bra .setBounds + + cmp #$017c : !blt + + lda #$0187 : bra .setBounds + + !add #$000b + .setBounds sta $0618 : inc #2 : sta $061a rts +; don't need midpoint of edge Link is leaving (formerly in $06 - used by dir indicator) +; don't need width of edge Link is going to (currently in $0b) LoadNorthData: - lda NorthEdgeInfo, x : sta $06 ; not needed I think - lda NorthOpenEdge, x : sta $03 : inx - lda NorthEdgeInfo, x : sta $07 ;probably needed for maths - unsure - lda NorthOpenEdge, x : sta $04 : inx + lda NorthOpenEdge, x : sta $03 : inx ; target room + lda NorthEdgeInfo, x : sta $07 ; needed for maths - (divide by 2 anyway) + lda NorthOpenEdge, x : sta $04 : inx ; bit field lda NorthEdgeInfo, x : sta $08 ; needed for maths - lda NorthOpenEdge, x : sta $05 - lda $04 : and #$0f : sta $00 : asl : !add $00 : tax - lda SouthEdgeInfo, x : sta $0a : inx ; needed now, and for nrml transition - lda SouthEdgeInfo, x : sta $0b : inx ; probably not needed - unsure + lda NorthOpenEdge, x : sta $05 ; ratio + lda $04 : jsr LoadSouthMidpoint : inx ; needed now, and for nrml transition + lda SouthEdgeInfo, x : sta $0b : inx ; probably not needed todo: remove lda SouthEdgeInfo, x : sta $0c ; needed for maths rts +LoadSouthMidpoint: + and #$0f : sta $00 : asl : !add $00 : tax + lda SouthEdgeInfo, x : sta $0a ; needed now, and for nrml transition + rts + LoadSouthData: - lda SouthEdgeInfo, x : sta $06 lda SouthOpenEdge, x : sta $03 : inx lda SouthEdgeInfo, x : sta $07 lda SouthOpenEdge, x : sta $04 : inx lda SouthEdgeInfo, x : sta $08 lda SouthOpenEdge, x : sta $05 - lda $04 : and #$0f : sta $00 : asl : !add $00 : tax - lda NorthEdgeInfo, x : sta $0a : inx + lda $04 : jsr LoadNorthMidpoint : inx lda NorthEdgeInfo, x : sta $0b : inx lda NorthEdgeInfo, x : sta $0c rts +LoadNorthMidpoint: + and #$0f : sta $00 : asl : !add $00 : tax + lda NorthEdgeInfo, x : sta $0a ; needed now, and for nrml transition + rts + LoadWestData: - lda WestEdgeInfo, x : sta $06 lda WestOpenEdge, x : sta $03 : inx lda WestEdgeInfo, x : sta $07 lda WestOpenEdge, x : sta $04 : inx lda WestEdgeInfo, x : sta $08 lda WestOpenEdge, x : sta $05 - lda $04 : and #$0f : sta $00 : asl : !add $00 : tax - lda EastEdgeInfo, x : sta $0a : inx + lda $04 : jsr LoadEastMidpoint : inx lda EastEdgeInfo, x : sta $0b : inx lda EastEdgeInfo, x : sta $0c rts +LoadEastMidpoint: + and #$0f : sta $00 : asl : !add $00 : tax + lda EastEdgeInfo, x : sta $0a ; needed now, and for nrml transition + rts + LoadEastData: - lda EastEdgeInfo, x : sta $06 lda EastOpenEdge, x : sta $03 : inx lda EastEdgeInfo, x : sta $07 lda EastOpenEdge, x : sta $04 : inx lda EastEdgeInfo, x : sta $08 lda EastOpenEdge, x : sta $05 - lda $04 : and #$0f : sta $00 : asl : !add $00 : tax - lda WestEdgeInfo, x : sta $0a : inx + lda $04 : jsr LoadWestMidpoint : inx lda WestEdgeInfo, x : sta $0b : inx lda WestEdgeInfo, x : sta $0c + + +LoadWestMidpoint: + and #$0f : sta $00 : asl : !add $00 : tax + lda WestEdgeInfo, x : sta $0a ; needed now, and for nrml transition rts @@ -255,8 +427,8 @@ DetectWestEdge: ldx #$05 : bra .end + cmp #$cc : bne + lda $aa : beq ++ - ldx #$07 : bra .end - ++ ldx #$06 : bra .end + ldx #$06 : bra .end + ++ ldx #$07 : bra .end + cmp #$dc : bne .end ldx #$08 .end txa : rts @@ -278,8 +450,8 @@ DetectEastEdge: ldx #$05 : bra .end + cmp #$cb : bne + lda $aa : beq ++ - ldx #$07 : bra .end - ++ ldx #$06 : bra .end + ldx #$06 : bra .end + ++ ldx #$07 : bra .end + cmp #$db : bne .end ldx #$08 .end txa : rts diff --git a/asm/math.asm b/asm/math.asm index 3ea48668..9547a9ac 100644 --- a/asm/math.asm +++ b/asm/math.asm @@ -15,15 +15,17 @@ cpy #$0003 : bne ++ ++ asl : sta $00 : tya : lsr : tay : lda $00 : bra .loop .done rts -;todo -- width in X? +;Divisor in Y. Width of division is in X for rounding toward middle DivideByY: .loop cpy #$0001 : beq .done cpy #$0003 : bne ++ jsr DivideBy3 : bra .done ++ cpy #$0005 : bne ++ jsr DivideBy5 : bra .done -; todo -- alter - width -++ tyx : jsr DivideBy2 : sta $00 : tya : lsr : tay : lda $00 : bra .loop +++ jsr DivideBy2 : sta $00 +tya : lsr : tay +txa : lsr : tax +lda $00 : bra .loop .done rts MultiBy3: @@ -34,12 +36,13 @@ MultiBy5: sta $00 : asl #2 : !add $00 rts -;width of divison in x +;width of divison in x: rounds toward X/2 DivideBy2: sta $00 lsr : bcc .done -sta $02 : txa : lsr : cmp $00 : !bge .done -lda $02 : inc +sta $02 : txa : lsr : cmp $00 : !blt + + lda $02 : inc : bra .done ++ lda $02 .done rts DivideBy3: diff --git a/asm/normal.asm b/asm/normal.asm index fda3ed31..46865f61 100644 --- a/asm/normal.asm +++ b/asm/normal.asm @@ -42,12 +42,26 @@ WarpDown: jsr Cleanup rtl +; carry set = use link door like normal +; carry clear = we are in dr mode, never use linking doors +CheckLinkDoorR: + lda DRMode : bne + + lda $7ec004 : sta $a0 ; what we wrote over + sec : rtl + + clc : rtl + +CheckLinkDoorL: + lda DRMode : bne + + lda $7ec003 : sta $a0 ; what we wrote over + sec : rtl + + clc : rtl + TrapDoorFixer: lda $fe : and #$0038 : beq .end xba : asl #2 : sta $00 stz $0468 : lda $068c : ora $00 : sta $068c .end - stz $fe ; clear our ab here because we don't need it anymore + stz $fe ; clear our fe here because we don't need it anymore rts Cleanup: @@ -74,29 +88,28 @@ LoadRoomHorz: { phb : phk : plb sty $06 : sta $07 : lda $a0 : pha ; Store normal room on stack - lda $07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00 - lda $01 : and.b #$80 : cmp #$80 : bne .gtg - ; jsr HorzEdge : pla : bcs .end - pla + lda $07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00-$01 + lda $00 : cmp #$03 : bne .gtg + jsr HorzEdge : pla : bcs .end sta $a0 : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine) .gtg ;Good to Go! pla ; Throw away normal room (don't fill up the stack) lda $a0 : and.b #$0F : asl a : !sub $23 : !add $06 : sta $02 ldy #$00 : jsr ShiftVariablesMainDir - lda $aa : lsr : sta $07 - lda $a0 : and.b #$F0 : lsr #3 : !add $07 : !sub $21 : sta $02 : sta $03 - jsr ShiftLowCoord - jsr ShiftQuad - jsr ShiftCameraBounds - ldy #$01 : jsr ShiftVariablesSubDir ; flip direction - jsr SetupScrollIndicator - lda $01 : sta $fe : and #$04 : lsr #2 - sta $ee - lda $01 : and #$10 : beq .end : stz $0468 + + lda $01 : and #$80 : beq .normal + ldy $06 : cpy #$ff : beq + + lda $01 : jsr LoadEastMidpoint : bra ++ + + lda $01 : jsr LoadWestMidpoint + ++ jsr PrepScrollToEdge : bra .scroll + + .normal + jsr PrepScrollToNormal + .scroll jsr ScrollY .end plb ; restore db register - rts + rts } ; Y is an adjustment for main direction of travel (stored at $06) @@ -105,33 +118,28 @@ LoadRoomVert: { phb : phk : plb sty $06 : sta $07 : lda $a0 : pha ; Store normal room on stack - lda $07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00 - lda $01 : and.b #$80 : cmp #$80 : bne .gtg - ; jsr VertEdge : pla : bcs .end - pla + lda $07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00-$01 + lda $00 : cmp #$03 : bne .gtg + jsr VertEdge : pla : bcs .end sta $a0 : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine) .gtg ;Good to Go! pla ; Throw away normal room (don't fill up the stack) lda $a0 : and.b #$F0 : lsr #3 : !sub $21 : !add $06 : sta $02 ldy #$01 : jsr ShiftVariablesMainDir - lda $a0 : and.b #$0F : asl a : !add $a9 : !sub $23 : sta $02 : sta $03 - jsr ShiftLowCoord - jsr ShiftQuad - jsr ShiftCameraBounds - ldy #$00 : jsr ShiftVariablesSubDir ; flip direction - jsr SetupScrollIndicator - lda $01 : sta $fe : and #$04 : lsr #2 - sta $ee - .end - plb ; restore db register - rts -} -SetupScrollIndicator: - lda $ab : and #$01 : asl : sta $ac - lda $ab : and #$40 : clc : rol #3 : ora $ac : sta $ac - lda $ab : and #$20 : asl #2 : sta $ab + lda $01 : and #$80 : beq .normal + ldy $06 : cpy #$ff : beq + + lda $01 : jsr LoadSouthMidpoint : bra ++ + + lda $01 : jsr LoadNorthMidpoint + ++ jsr PrepScrollToEdge : bra .scroll + + .normal + jsr PrepScrollToNormal + .scroll jsr ScrollX + .end + plb ; restore db register rts +} LookupNewRoom: ; expects data offset to be in A { @@ -163,93 +171,31 @@ ShiftVariablesMainDir: rts } -ShiftLowCoord: + +; Target pixel should be in A, other info in $01 +; Sets $04 $05 and $ee +PrepScrollToEdge: { - lda $01 : and.b #$03 ; high byte index - jsr CalcOpposingShift - lda $ab : and.b #$f0 : cmp.b #$20 : bne .lowDone - lda OppCoordIndex,y : tax - lda #$80 : !add $20,x : sta $20,x - .lowDone - rts + sta $04 : lda $01 : and #$20 : beq + + lda #01 + + sta $05 + lda $01 : and #$10 : beq + + lda #01 + + sta $ee + rts } -; expects A to be (0,1,2) (dest number) and (0,1,2) (src door number) to be stored in $04 -; $ab will be set to a bitmask aaaa qxxf -; a - amount of adjust -; f - flag, if set, then amount is pos, otherwise neg. -; q - quadrant, if set, then quadrant needs to be modified -CalcOpposingShift: +; Normal Flags should be in $01 +; Sets $04 $05 and $ee, and $fe +PrepScrollToNormal: { - stz $ab : stz $ac ; set up - cmp.b $04 : beq .noOffset ; (equal, no shifts to do) - phy : tay ; reserve these - lda $04 : tax : tya : !sub $04 : sta $04 : cmp.b #$00 : bpl .shiftPos - lda #$40 - cpx.b #$01 : beq .skipNegQuad - ora #$08 - .skipNegQuad - sta $ab : lda $04 : cmp.b #$FE : beq .done ;already set $ab - lda $ab : eor #$60 - bra .setDone - - .shiftPos - lda #$41 - cpy.b #$01 : beq .skipPosQuad - ora #$08 - .skipPosQuad - sta $ab : lda $04 : cmp.b #$02 : bcs .done ;already set $ab - lda $ab : eor #$60 - - .setDone sta $ab - .done ply - .noOffset rts -} - - -ShiftQuad: -{ - lda $ab : and #$08 : beq .quadDone - lda ShiftQuadIndex,y : tax ; X should be set to either 1 (vertical) or 2 (horizontal) (for a9,aa quadrant) - lda $ab : and #$01 : beq .decQuad - inc $02 - txa : sta $a8, x ; alter a9/aa - bra .quadDone - .decQuad - dec $02 - lda #$00 : sta $a8, x ; alter a9/aa - .quadDone rts -} - -ShiftVariablesSubDir: -{ - lda CoordIndex,y : tax - lda $21,x : !add $02 : sta $21,x ; coordinate update - lda CameraIndex,y : tax - lda $e3,x : !add $03 : sta $e3,x ; scroll register high byte - lda CamQuadIndex,y : tax - lda $0601,x : !add $02 : sta $0601,x - lda $0605,x : !add $02 : sta $0605,x ; high bytes of these guys - lda $0603,x : !add $03 : sta $0603,x - lda $0607,x : !add $03 : sta $0607,x - rts -} - -ShiftCameraBounds: -{ - lda CamBoundIndex,y : tax ; should be 0 for horz travel (vert bounds) or 4 for vert travel (horz bounds) - rep #$30 - lda $ab : and #$00f0 : asl #2 : sta $06 - lda $ab : and #$0001 : cmp #$0000 : beq .subIt - lda $0618, x : !add $06 : sta $0618, x - lda $061A, x : !add $06 : sta $061A, x - sep #$30 - rts - .subIt - lda $0618, x : !sub $06 : sta $0618, x - lda $061A, x : !sub $06 : sta $061A, x - sep #$30 - rts + lda $01 : sta $fe : and #$04 : lsr #2 : sta $ee ; trap door and layer + stz $05 : lda #$78 : sta $04 + lda $01 : and #$03 : beq .end + cmp #$02 : !bge + + lda #$f8 : sta $04 : bra .end + + inc $05 + .end rts } AdjustTransition: @@ -276,4 +222,9 @@ AdjustTransition: } AdjustCamAdd: - !add $00E2,y : sta $00E2,y : sta $00E0,y : rts \ No newline at end of file + !add $00E2,y : pha + and #$01ff : cmp #$0111 : !blt + + cmp #$01f8 : !bge ++ + pla : and #$ff10 : pha : bra + + ++ pla : and #$ff00 : !add #$0100 : pha + + pla : sta $00E2,y : sta $00E0,y : rts \ No newline at end of file