Bug with sanc/pull switch doors fixed.

Bug with doors with offset 2 going to doors with offset 2 was fixed in asm.
Refactor asm code to use Y as 2nd index, which cleaned up code.
Also learned the phb:phk:plb ... plb trick (cleaner than what I was doing)
This commit is contained in:
randall.rupper
2019-08-26 15:03:42 -06:00
parent 8db381a59c
commit 7f6c593df0
6 changed files with 162 additions and 125 deletions

View File

@@ -97,7 +97,7 @@ def connect_two_way(world, entrancename, exitname, player):
# if these were already connected somewhere, remove the backreference
if entrance.connected_region is not None:
entrance.connected_region.entrances.remove(entrance, player)
entrance.connected_region.entrances.remove(entrance)
if ext.connected_region is not None:
ext.connected_region.entrances.remove(ext)
@@ -640,22 +640,40 @@ default_one_way_connections = [('Sewers Pull Switch S', 'Sanctuary N'),
('Eastern Big Key NE', 'Eastern Compass Area SW')]
experimental_connections = [('Eastern Boss SE', 'Eastern Courtyard N'),
('Eastern Courtyard EN', 'Eastern Attic Switches WS'),
('Eastern Lobby N', 'Eastern Darkness S'),
('Eastern Courtyard WN', 'Eastern Compass Area E'),
('Eastern Attic Switches ES', 'Eastern Cannonball Ledge WN'),
('Eastern Compass Area EN', 'Hyrule Castle Back Hall W'),
('Hyrule Castle Back Hall E', 'Eastern Map Area W'),
('Eastern Attic Start WS', 'Eastern Cannonball Ledge Key Door EN'),
('Eastern Compass Area SW', 'Hyrule Dungeon Guardroom N'),
('Hyrule Castle East Lobby NW', 'Hyrule Castle East Hall SW'),
('Hyrule Castle East Lobby N', 'Eastern Courtyard Ledge S'),
('Hyrule Castle Lobby E', 'Eastern Courtyard Ledge W'),
('Hyrule Castle Lobby WN', 'Eastern Courtyard Ledge E'),
('Hyrule Castle West Lobby EN', 'Hyrule Castle East Lobby W'),
('Hyrule Castle Throne Room N', 'Hyrule Castle East Hall S'),
('Hyrule Castle West Lobby E', 'Hyrule Castle East Hall W'),
('Hyrule Castle West Lobby N', 'Hyrule Dungeon Armory S'),
('Hyrule Castle Lobby W', 'Hyrule Castle West Hall E'),
('Hyrule Castle West Hall S', 'Sanctuary N')]
experimental_connections = [('Eastern Boss SE', 'Eastern Eyegores NE'),
('Eastern Eyegores ES', 'Eastern Map Valley WN'),
('Eastern Lobby N', 'Eastern Courtyard Ledge S'),
('Eastern Big Key EN', 'Eastern Courtyard Ledge W'),
('Eastern Big Key NE', 'Eastern Compass Area SW'),
('Eastern Compass Area EN', 'Eastern Courtyard WN'),
('Eastern Courtyard N', 'Eastern Map Valley SW'),
('Eastern Courtyard EN', 'Eastern Map Area W'),
('Hyrule Castle Lobby W', 'Hyrule Castle Back Hall E'),
('Hyrule Castle Throne Room N', 'Sewers Behind Tapestry S'),
('Hyrule Castle Lobby WN', 'Hyrule Castle West Lobby EN'),
('Hyrule Castle West Lobby N', 'Eastern Cannonball S'),
('Hyrule Castle Lobby E', 'Sewers Water W'),
('Sewers Dark Cross Key Door S', 'Sanctuary N')]
# experimental_connections = [('Eastern Boss SE', 'Eastern Courtyard N'),
# ('Eastern Courtyard EN', 'Eastern Attic Switches WS'),
# ('Eastern Lobby N', 'Eastern Darkness S'),
# ('Eastern Courtyard WN', 'Eastern Compass Area E'),
# ('Eastern Attic Switches ES', 'Eastern Cannonball Ledge WN'),
# ('Eastern Compass Area EN', 'Hyrule Castle Back Hall W'),
# ('Hyrule Castle Back Hall E', 'Eastern Map Area W'),
# ('Eastern Attic Start WS', 'Eastern Cannonball Ledge Key Door EN'),
# ('Eastern Compass Area SW', 'Hyrule Dungeon Guardroom N'),
# ('Hyrule Castle East Lobby NW', 'Hyrule Castle East Hall SW'),
# ('Hyrule Castle East Lobby N', 'Eastern Courtyard Ledge S'),
# ('Hyrule Castle Lobby E', 'Eastern Courtyard Ledge W'),
# ('Hyrule Castle Lobby WN', 'Eastern Courtyard Ledge E'),
# ('Hyrule Castle West Lobby EN', 'Hyrule Castle East Lobby W'),
# ('Hyrule Castle Throne Room N', 'Hyrule Castle East Hall S'),
# ('Hyrule Castle West Lobby E', 'Hyrule Castle East Hall W'),
# ('Hyrule Castle West Lobby N', 'Hyrule Dungeon Armory S'),
# ('Hyrule Castle Lobby W', 'Hyrule Castle West Hall E'),
# ('Hyrule Castle West Hall S', 'Sanctuary N')]

145
Doors.py
View File

@@ -2,104 +2,109 @@
from BaseClasses import Door, DoorType, Direction
# constants
# door offsets
Top = 0
Left = 0
Mid = 1
Bot = 2
Right = 2
# layer numbers
High = 0
Low = 1
def create_doors(world, player):
world.doors += [
# hyrule castle
create_toggle_door(player, 'Hyrule Castle Lobby W', DoorType.Normal, Direction.West, 0x61, Mid, 0),
create_toggle_door(player, 'Hyrule Castle Lobby E', DoorType.Normal, Direction.East, 0x61, Mid, 0),
create_dir_door(player, 'Hyrule Castle Lobby WN', DoorType.Normal, Direction.West, 0x61, Top, 0),
create_dir_door(player, 'Hyrule Castle Lobby North Stairs', DoorType.StraightStairs, Direction.North, 0x61, Mid, 0),
create_toggle_door(player, 'Hyrule Castle West Lobby E', DoorType.Normal, Direction.East, 0x60, Mid, 1),
create_dir_door(player, 'Hyrule Castle West Lobby N', DoorType.Normal, Direction.North, 0x60, Right, 1),
create_dir_door(player, 'Hyrule Castle West Lobby EN', DoorType.Normal, Direction.East, 0x60, Top, 0),
create_toggle_door(player, 'Hyrule Castle East Lobby W', DoorType.Normal, Direction.West, 0x62, Mid, 1),
create_dir_door(player, 'Hyrule Castle East Lobby N', DoorType.Normal, Direction.North, 0x62, Mid, 0),
create_dir_door(player, 'Hyrule Castle East Lobby NW', DoorType.Normal, Direction.North, 0x62, Left, 1),
create_dir_door(player, 'Hyrule Castle East Hall W', DoorType.Normal, Direction.West, 0x52, Top, 1),
create_dir_door(player, 'Hyrule Castle East Hall S', DoorType.Normal, Direction.South, 0x52, Mid, 1),
create_dir_door(player, 'Hyrule Castle East Hall SW', DoorType.Normal, Direction.South, 0x52, Left, 1),
create_dir_door(player, 'Hyrule Castle West Hall E', DoorType.Normal, Direction.East, 0x50, Top, 1),
create_dir_door(player, 'Hyrule Castle West Hall S', DoorType.Normal, Direction.South, 0x50, Right, 1),
create_dir_door(player, 'Hyrule Castle Back Hall W', DoorType.Normal, Direction.West, 0x01, Top, 1),
create_dir_door(player, 'Hyrule Castle Back Hall E', DoorType.Normal, Direction.East, 0x01, Top, 1),
create_toggle_door(player, 'Hyrule Castle Lobby W', DoorType.Normal, Direction.West, 0x61, Mid, High),
create_toggle_door(player, 'Hyrule Castle Lobby E', DoorType.Normal, Direction.East, 0x61, Mid, High),
create_dir_door(player, 'Hyrule Castle Lobby WN', DoorType.Normal, Direction.West, 0x61, Top, High),
create_dir_door(player, 'Hyrule Castle Lobby North Stairs', DoorType.StraightStairs, Direction.North, 0x61, Mid, High),
create_toggle_door(player, 'Hyrule Castle West Lobby E', DoorType.Normal, Direction.East, 0x60, Mid, Low),
create_dir_door(player, 'Hyrule Castle West Lobby N', DoorType.Normal, Direction.North, 0x60, Right, Low),
create_dir_door(player, 'Hyrule Castle West Lobby EN', DoorType.Normal, Direction.East, 0x60, Top, High),
create_toggle_door(player, 'Hyrule Castle East Lobby W', DoorType.Normal, Direction.West, 0x62, Mid, Low),
create_dir_door(player, 'Hyrule Castle East Lobby N', DoorType.Normal, Direction.North, 0x62, Mid, High),
create_dir_door(player, 'Hyrule Castle East Lobby NW', DoorType.Normal, Direction.North, 0x62, Left, Low),
create_dir_door(player, 'Hyrule Castle East Hall W', DoorType.Normal, Direction.West, 0x52, Top, Low),
create_dir_door(player, 'Hyrule Castle East Hall S', DoorType.Normal, Direction.South, 0x52, Mid, High),
create_dir_door(player, 'Hyrule Castle East Hall SW', DoorType.Normal, Direction.South, 0x52, Left, Low),
create_dir_door(player, 'Hyrule Castle West Hall E', DoorType.Normal, Direction.East, 0x50, Top, Low),
create_dir_door(player, 'Hyrule Castle West Hall S', DoorType.Normal, Direction.South, 0x50, Right, Low),
create_dir_door(player, 'Hyrule Castle Back Hall W', DoorType.Normal, Direction.West, 0x01, Top, Low),
create_dir_door(player, 'Hyrule Castle Back Hall E', DoorType.Normal, Direction.East, 0x01, Top, Low),
create_door(player, 'Hyrule Castle Back Hall Down Stairs', DoorType.SpiralStairs),
create_dir_door(player, 'Hyrule Castle Throne Room N', DoorType.Normal, Direction.North, 0x51, Mid, 0),
create_dir_door(player, 'Hyrule Castle Throne Room South Stairs', DoorType.StraightStairs, Direction.South, 0x51, Mid, 1),
create_dir_door(player, 'Hyrule Castle Throne Room N', DoorType.Normal, Direction.North, 0x51, Mid, High),
create_dir_door(player, 'Hyrule Castle Throne Room South Stairs', DoorType.StraightStairs, Direction.South, 0x51, Mid, Low),
# hyrule dungeon level
create_door(player, 'Hyrule Dungeon Map Room Up Stairs', DoorType.SpiralStairs),
create_dir_door(player, 'Hyrule Dungeon North Abyss South Edge', DoorType.Open, Direction.South, 0x72, None, 1),
create_dir_door(player, 'Hyrule Dungeon North Abyss Catwalk Edge', DoorType.Open, Direction.South, 0x72, None, 0),
create_dir_door(player, 'Hyrule Dungeon South Abyss North Edge', DoorType.Open, Direction.North, 0x82, None, 1),
create_dir_door(player, 'Hyrule Dungeon South Abyss West Edge', DoorType.Open, Direction.West, 0x82, None, 1),
create_dir_door(player, 'Hyrule Dungeon South Abyss Catwalk North Edge', DoorType.Open, Direction.North, 0x82, None, 0),
create_dir_door(player, 'Hyrule Dungeon South Abyss Catwalk West Edge', DoorType.Open, Direction.West, 0x82, None, 0),
create_dir_door(player, 'Hyrule Dungeon Guardroom Catwalk Edge', DoorType.Open, Direction.East, 0x81, None, 0),
create_dir_door(player, 'Hyrule Dungeon Guardroom Abyss Edge', DoorType.Open, Direction.West, 0x81, None, 0),
create_dir_door(player, 'Hyrule Dungeon Guardroom N', DoorType.Normal, Direction.North, 0x81, Left, 1), # todo: is this a toggle door?
create_dir_door(player, 'Hyrule Dungeon Armory S', DoorType.Normal, Direction.South, 0x71, Left, 1), # not sure what the layer should be here
create_dir_door(player, 'Hyrule Dungeon North Abyss South Edge', DoorType.Open, Direction.South, 0x72, None, Low),
create_dir_door(player, 'Hyrule Dungeon North Abyss Catwalk Edge', DoorType.Open, Direction.South, 0x72, None, High),
create_dir_door(player, 'Hyrule Dungeon South Abyss North Edge', DoorType.Open, Direction.North, 0x82, None, Low),
create_dir_door(player, 'Hyrule Dungeon South Abyss West Edge', DoorType.Open, Direction.West, 0x82, None, Low),
create_dir_door(player, 'Hyrule Dungeon South Abyss Catwalk North Edge', DoorType.Open, Direction.North, 0x82, None, High),
create_dir_door(player, 'Hyrule Dungeon South Abyss Catwalk West Edge', DoorType.Open, Direction.West, 0x82, None, High),
create_dir_door(player, 'Hyrule Dungeon Guardroom Catwalk Edge', DoorType.Open, Direction.East, 0x81, None, High),
create_dir_door(player, 'Hyrule Dungeon Guardroom Abyss Edge', DoorType.Open, Direction.West, 0x81, None, High),
create_dir_door(player, 'Hyrule Dungeon Guardroom N', DoorType.Normal, Direction.North, 0x81, Left, Low), # todo: is this a toggle door?
create_dir_door(player, 'Hyrule Dungeon Armory S', DoorType.Normal, Direction.South, 0x71, Left, Low), # not sure what the layer should be here
create_door(player, 'Hyrule Dungeon Armory Down Stairs', DoorType.SpiralStairs),
create_door(player, 'Hyrule Dungeon Staircase Up Stairs', DoorType.SpiralStairs),
create_door(player, 'Hyrule Dungeon Staircase Down Stairs', DoorType.SpiralStairs),
create_door(player, 'Hyrule Dungeon Cellblock Up Stairs', DoorType.SpiralStairs),
# sewers
create_blocked_door(player, 'Sewers Behind Tapestry S', DoorType.Normal, Direction.South, 0x41, Mid, 0),
create_blocked_door(player, 'Sewers Behind Tapestry S', DoorType.Normal, Direction.South, 0x41, Mid, High),
create_door(player, 'Sewers Behind Tapestry Down Stairs', DoorType.SpiralStairs),
create_door(player, 'Sewers Rope Room Up Stairs', DoorType.SpiralStairs),
create_dir_door(player, 'Sewers Rope Room North Stairs', DoorType.StraightStairs, Direction.North, 0x42, Mid, 0),
create_dir_door(player, 'Sewers Dark Cross South Stairs', DoorType.StraightStairs, Direction.South, 0x32, Mid, 0),
create_dir_door(player, 'Sewers Dark Cross Key Door N', DoorType.Normal, Direction.North, 0x32, Mid, 0),
create_dir_door(player, 'Sewers Dark Cross Key Door S', DoorType.Normal, Direction.South, 0x22, Mid, 0),
create_dir_door(player, 'Sewers Water W', DoorType.Normal, Direction.West, 0x22, Bot, 0),
create_dir_door(player, 'Sewers Key Rat E', DoorType.Normal, Direction.East, 0x21, Bot, 0),
create_small_key_door(player, 'Sewers Key Rat Key Door N', DoorType.Normal, Direction.North, 0x21, Right, 0),
create_small_key_door(player, 'Sewers Secret Room Key Door S', DoorType.Normal, Direction.South, 0x11, Right, 0),
create_dir_door(player, 'Sewers Rope Room North Stairs', DoorType.StraightStairs, Direction.North, 0x42, Mid, High),
create_dir_door(player, 'Sewers Dark Cross South Stairs', DoorType.StraightStairs, Direction.South, 0x32, Mid, High),
create_dir_door(player, 'Sewers Dark Cross Key Door N', DoorType.Normal, Direction.North, 0x32, Mid, High),
create_dir_door(player, 'Sewers Dark Cross Key Door S', DoorType.Normal, Direction.South, 0x22, Mid, High),
create_dir_door(player, 'Sewers Water W', DoorType.Normal, Direction.West, 0x22, Bot, High),
create_dir_door(player, 'Sewers Key Rat E', DoorType.Normal, Direction.East, 0x21, Bot, High),
create_small_key_door(player, 'Sewers Key Rat Key Door N', DoorType.Normal, Direction.North, 0x21, Right, High),
create_small_key_door(player, 'Sewers Secret Room Key Door S', DoorType.Normal, Direction.South, 0x11, Right, High),
create_door(player, 'Sewers Secret Room Up Stairs', DoorType.SpiralStairs),
create_door(player, 'Sewers Pull Switch Down Stairs', DoorType.SpiralStairs),
create_dir_door(player, 'Sewers Pull Switch S', DoorType.Normal, Direction.South, 0x02, Mid, 0),
create_blocked_door(player, 'Sanctuary N', DoorType.Normal, Direction.North, 0x12, Mid, 0), # logically one way, but should be linked
create_toggle_door(player, 'Sewers Pull Switch S', DoorType.Normal, Direction.South, 0x02, Mid, Low),
# logically one way the sanc, but should be linked - also toggle
create_blocked_door(player, 'Sanctuary N', DoorType.Normal, Direction.North, 0x12, Mid, 0, True),
# Eastern Palace
create_dir_door(player, 'Eastern Lobby N', DoorType.Normal, Direction.North, 0xc9, Mid, 0),
create_dir_door(player, 'Eastern Cannonball S', DoorType.Normal, Direction.South, 0xb9, Mid, 0),
create_dir_door(player, 'Eastern Cannonball N', DoorType.Normal, Direction.North, 0xb9, Mid, 0),
create_dir_door(player, 'Eastern Cannonball Ledge WN', DoorType.Normal, Direction.West, 0xb9, Top, 0),
create_small_key_door(player, 'Eastern Cannonball Ledge Key Door EN', DoorType.Normal, Direction.East, 0xb9, Top, 0),
create_dir_door(player, 'Eastern Courtyard Ledge S', DoorType.Normal, Direction.South, 0xa9, Mid, 0),
create_dir_door(player, 'Eastern Courtyard Ledge W', DoorType.Normal, Direction.West, 0xa9, Mid, 0),
create_dir_door(player, 'Eastern Courtyard Ledge E', DoorType.Normal, Direction.East, 0xa9, Mid, 0),
create_dir_door(player, 'Eastern Map Area W', DoorType.Normal, Direction.West, 0xaa, Mid, 0),
create_dir_door(player, 'Eastern Compass Area E', DoorType.Normal, Direction.East, 0xa8, Mid, 0),
create_dir_door(player, 'Eastern Compass Area EN', DoorType.Normal, Direction.East, 0xa8, Top, 1),
create_blocked_door(player, 'Eastern Compass Area SW', DoorType.Normal, Direction.South, 0xa8, Right, 0),
create_dir_door(player, 'Eastern Courtyard WN', DoorType.Normal, Direction.West, 0xa9, Top, 1),
create_dir_door(player, 'Eastern Courtyard EN', DoorType.Normal, Direction.East, 0xa9, Top, 1),
create_big_key_door(player, 'Eastern Courtyard N', DoorType.Normal, Direction.North, 0xa9, Mid, 0),
create_dir_door(player, 'Eastern Lobby N', DoorType.Normal, Direction.North, 0xc9, Mid, High),
create_dir_door(player, 'Eastern Cannonball S', DoorType.Normal, Direction.South, 0xb9, Mid, High),
create_dir_door(player, 'Eastern Cannonball N', DoorType.Normal, Direction.North, 0xb9, Mid, High),
create_dir_door(player, 'Eastern Cannonball Ledge WN', DoorType.Normal, Direction.West, 0xb9, Top, High),
create_small_key_door(player, 'Eastern Cannonball Ledge Key Door EN', DoorType.Normal, Direction.East, 0xb9, Top, High),
create_dir_door(player, 'Eastern Courtyard Ledge S', DoorType.Normal, Direction.South, 0xa9, Mid, High),
create_dir_door(player, 'Eastern Courtyard Ledge W', DoorType.Normal, Direction.West, 0xa9, Mid, High),
create_dir_door(player, 'Eastern Courtyard Ledge E', DoorType.Normal, Direction.East, 0xa9, Mid, High),
create_dir_door(player, 'Eastern Map Area W', DoorType.Normal, Direction.West, 0xaa, Mid, High),
create_dir_door(player, 'Eastern Compass Area E', DoorType.Normal, Direction.East, 0xa8, Mid, High),
create_dir_door(player, 'Eastern Compass Area EN', DoorType.Normal, Direction.East, 0xa8, Top, Low),
create_blocked_door(player, 'Eastern Compass Area SW', DoorType.Normal, Direction.South, 0xa8, Right, High),
create_dir_door(player, 'Eastern Courtyard WN', DoorType.Normal, Direction.West, 0xa9, Top, Low),
create_dir_door(player, 'Eastern Courtyard EN', DoorType.Normal, Direction.East, 0xa9, Top, Low),
create_big_key_door(player, 'Eastern Courtyard N', DoorType.Normal, Direction.North, 0xa9, Mid, High),
create_door(player, 'Eastern Courtyard Potholes', DoorType.Hole),
create_door(player, 'Eastern Fairies\' Warp', DoorType.Warp),
create_dir_door(player, 'Eastern Map Valley WN', DoorType.Normal, Direction.West, 0xaa, Top, 1),
create_dir_door(player, 'Eastern Map Valley SW', DoorType.Normal, Direction.South, 0xaa, Left, 0),
create_small_key_door(player, 'Eastern Dark Square NW', DoorType.Normal, Direction.North, 0xba, Left, 0),
create_small_key_door(player, 'Eastern Dark Square Key Door WN', DoorType.Normal, Direction.West, 0xba, Top, 0),
create_small_key_door(player, 'Eastern Big Key EN', DoorType.Normal, Direction.East, 0xb8, Top, 0),
create_dir_door(player, 'Eastern Big Key NE', DoorType.Normal, Direction.North, 0xb8, Right, 0),
create_small_key_door(player, 'Eastern Darkness S', DoorType.Normal, Direction.South, 0x99, Mid, 0),
create_dir_door(player, 'Eastern Map Valley WN', DoorType.Normal, Direction.West, 0xaa, Top, Low),
create_dir_door(player, 'Eastern Map Valley SW', DoorType.Normal, Direction.South, 0xaa, Left, High),
create_small_key_door(player, 'Eastern Dark Square NW', DoorType.Normal, Direction.North, 0xba, Left, High),
create_small_key_door(player, 'Eastern Dark Square Key Door WN', DoorType.Normal, Direction.West, 0xba, Top, High),
create_small_key_door(player, 'Eastern Big Key EN', DoorType.Normal, Direction.East, 0xb8, Top, High),
create_dir_door(player, 'Eastern Big Key NE', DoorType.Normal, Direction.North, 0xb8, Right, High),
create_small_key_door(player, 'Eastern Darkness S', DoorType.Normal, Direction.South, 0x99, Mid, High),
create_door(player, 'Eastern Darkness Up Stairs', DoorType.SpiralStairs),
create_door(player, 'Eastern Attic Start Down Stairs', DoorType.SpiralStairs),
create_dir_door(player, 'Eastern Attic Start WS', DoorType.Normal, Direction.West, 0xda, Bot, 0),
create_dir_door(player, 'Eastern Attic Switches ES', DoorType.Normal, Direction.East, 0xd9, Bot, 0),
create_dir_door(player, 'Eastern Attic Switches WS', DoorType.Normal, Direction.West, 0xd9, Bot, 0),
create_dir_door(player, 'Eastern Eyegores ES', DoorType.Normal, Direction.East, 0xd8, Bot, 0),
create_dir_door(player, 'Eastern Eyegores NE', DoorType.Normal, Direction.North, 0xd8, Right, 0),
create_dir_door(player, 'Eastern Boss SE', DoorType.Normal, Direction.South, 0xc8, Right, 0),
create_dir_door(player, 'Eastern Attic Start WS', DoorType.Normal, Direction.West, 0xda, Bot, High),
create_dir_door(player, 'Eastern Attic Switches ES', DoorType.Normal, Direction.East, 0xd9, Bot, High),
create_dir_door(player, 'Eastern Attic Switches WS', DoorType.Normal, Direction.West, 0xd9, Bot, High),
create_dir_door(player, 'Eastern Eyegores ES', DoorType.Normal, Direction.East, 0xd8, Bot, High),
create_dir_door(player, 'Eastern Eyegores NE', DoorType.Normal, Direction.North, 0xd8, Right, High),
create_dir_door(player, 'Eastern Boss SE', DoorType.Normal, Direction.South, 0xc8, Right, High),
]
@@ -119,8 +124,8 @@ def create_big_key_door(player, name, type, direction, room, doorIndex, layer):
return d
def create_blocked_door(player, name, type, direction, room, doorIndex, layer):
d = Door(player, name, type, direction, room, doorIndex, layer)
def create_blocked_door(player, name, type, direction, room, doorIndex, layer, toggle=False):
d = Door(player, name, type, direction, room, doorIndex, layer, toggle)
d.blocked = True
return d

2
Gui.py
View File

@@ -208,7 +208,7 @@ def guiMain(args=None):
doorShuffleVar.set('vanilla')
doorShuffleOptionMenu = OptionMenu(doorShuffleFrame, doorShuffleVar, 'vanilla', 'basic', 'crosssed', 'experimental')
doorShuffleOptionMenu.pack(side=RIGHT)
doorShuffleLabel = Label(shuffleFrame, text='Door shuffle algorithm')
doorShuffleLabel = Label(doorShuffleFrame, text='Door shuffle algorithm')
doorShuffleLabel.pack(side=LEFT)
heartbeepFrame = Frame(drowDownFrame)

9
Rom.py
View File

@@ -18,7 +18,7 @@ from EntranceShuffle import door_addresses
JAP10HASH = '03a63945398191337e896e5771f77173'
RANDOMIZERBASEHASH = '286871f737f98e7764c0f6ce125c68ca'
RANDOMIZERBASEHASH = '10d5e3bb3fad6cb230090678ce5b86c2'
# RANDOMIZERBASEHASH = 'cb560220b7b1b8202e92381aee19cd36' todo clean this up
@@ -534,10 +534,9 @@ def patch_rom(world, player, rom):
patch_shuffled_dark_sanc(world, rom, player)
# patch doors
if world.doorShuffle != 'vanilla':
for door in world.doors:
if door.dest is not None and door.player == player and door.type == DoorType.Normal:
rom.write_bytes(door.getAddress(), door.dest.getTarget(door.toggle))
for door in world.doors:
if door.dest is not None and door.player == player and door.type == DoorType.Normal:
rom.write_bytes(door.getAddress(), door.dest.getTarget(door.toggle))
write_custom_shops(rom, world, player)

View File

@@ -12,6 +12,16 @@ org $02bd80
jsl AdjustTransition
nop
; Graphics fix - doesn't work yet
org $028961
jsl GfxFixer
org $00fda4
Dungeon_InitStarTileCh:
org $00d6ae ;(PC: 56ae)
LoadTransAuxGfx:
org $00df5a ;(PC: 5f5a)
PrepTransAuxGfx:
;turn off linking doors -- see .notRoomLinkDoor label in Bank02.asm
org $02b5a6
bra NotLinkDoor1
@@ -86,8 +96,8 @@ CalcIndex: ; A->low byte of Link's Coord, X-> Link's quadrant, DoorOffset x 2 ->
; A is a door table row offset
LoadRoomHorz:
{
phb : phk : plb
sty $06 : sta $07 : lda $a0 : pha ; Store normal room on stack
lda #$27 : pha : plb ; change db register
lda $07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00
lda $01 : and.b #$80 : cmp #$80 : bne .gtg
pla : sta $a0 : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine)
@@ -95,16 +105,17 @@ LoadRoomHorz:
.gtg ;Good to Go!
pla ; Throw away normal room (don't fill up the stack)
lda $a0 : and.b #$0F : asl a : sec : sbc $23 : clc : adc $06 : sta $02
ldx #$00 : jsr ShiftVariablesMainDir
lda $a0 : and.b #$F0 : lsr #3 : sec : sbc $21 : sta $02 : sta $03
ldy #$00 : jsr ShiftVariablesMainDir
lda $aa : lsr : sta $07
lda $a0 : and.b #$F0 : lsr #3 : clc : adc $07 : sec : sbc $21 : sta $02 : sta $03
jsr ShiftLowCoord
jsr ShiftQuad
jsr ShiftCameraBounds
ldx #$01 : jsr ShiftVariablesSubDir ; flip direction
ldy #$01 : jsr ShiftVariablesSubDir ; flip direction
lda $01 : and.b #$04 : lsr #2
sta.b $EE
.end
lda #$02 : pha : plb ; restore db register
plb ; restore db register
rts
}
@@ -112,8 +123,8 @@ LoadRoomHorz:
; A is a door table row offset (stored a $07)
LoadRoomVert:
{
phb : phk : plb
sty $06 : sta $07 : lda $a0 : pha ; Store normal room on stack
lda #$27 : pha : plb ; change db register
lda $07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00
lda $01 : and.b #$80 : cmp #$80 : bne .gtg
pla : sta $a0 : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine)
@@ -121,16 +132,16 @@ LoadRoomVert:
.gtg ;Good to Go!
pla ; Throw away normal room (don't fill up the stack)
lda $a0 : and.b #$F0 : lsr #3 : sec : sbc $21 : clc : adc $06 : sta $02
ldx #$01 : jsr ShiftVariablesMainDir ;; Todo consider using y as main index (may simplify things)
lda $a0 : and.b #$0F : asl a : sec : sbc $23 : sta $02 : sta $03
ldy #$01 : jsr ShiftVariablesMainDir
lda $a0 : and.b #$0F : asl a : clc : adc $a9 : sec : sbc $23 : sta $02 : sta $03
jsr ShiftLowCoord
jsr ShiftQuad
jsr ShiftCameraBounds
ldx #$00 : jsr ShiftVariablesSubDir ; flip direction
ldy #$00 : jsr ShiftVariablesSubDir ; flip direction
lda $01 : and.b #$04 : lsr #2
sta.b $EE
.end
lda #$02 : pha : plb ; restore db register
plb ; restore db register
rts
}
@@ -151,7 +162,7 @@ LookupNewRoom: ; expects data offset to be in A
; Sets high bytes of various registers
ShiftVariablesMainDir:
{
txy : lda CoordIndex,y : tax
lda CoordIndex,y : tax
lda $21,x : clc : adc $02 : sta $21,x ; coordinate update
lda CameraIndex,y : tax
lda $e3,x : clc : adc $02 : sta $e3,x ; scroll register high byte
@@ -160,7 +171,7 @@ ShiftVariablesMainDir:
lda $0607,x : clc : adc $02 : sta $0607,x
lda $0601,x : clc : adc $02 : sta $0601,x
lda $0603,x : clc : adc $02 : sta $0603,x
tyx : rts
rts
}
ShiftLowCoord:
@@ -168,9 +179,8 @@ ShiftLowCoord:
lda $01 : and.b #$03 ; high byte index
jsr CalcOpposingShift
lda $0127 : and.b #$f0 : cmp.b #$20 : bne .lowDone
lda OppCoordIndex,x : phx : tax
lda OppCoordIndex,y : tax
lda #$80 : clc : adc $20,x : sta $20,x
plx
.lowDone
rts
}
@@ -184,7 +194,7 @@ CalcOpposingShift:
{
stz $0127 ; set up (can you zero out 127 alone?)
cmp.b $04 : beq .noOffset ; (equal, no shifts to do)
phx : tay ; reserve these
phy : tay ; reserve these
lda $04 : tax : tya : sec : sbc $04 : sta $04 : cmp.b #$00 : bpl .shiftPos
lda #$40
cpx.b #$01 : beq .skipNegQuad
@@ -203,29 +213,28 @@ CalcOpposingShift:
lda $0127 : eor #$60
.setDone sta $0127
.done plx
.done ply
.noOffset rts
}
; X should be set to either 1 (vertical) or 2 (horizontal) (for a9,aa quadrant a8 is base)
ShiftQuad:
{
lda $0127 : and #$08 : cmp.b #$00 : beq .quadDone
phx : lda ShiftQuadIndex,x : tax
lda ShiftQuadIndex,y : tax ; X should be set to either 1 (vertical) or 2 (horizontal) (for a9,aa quadrant)
lda $0127 : and #$01 : cmp.b #$00 : beq .decQuad
inc $02
txa : sta $a8, x ; alter a9/aa
bra .end
bra .quadDone
.decQuad
lda $02 : inc : sta $03
dec $02
lda #$00 : sta $a8, x ; alter a9/aa
.end plx
.quadDone rts
}
ShiftVariablesSubDir:
{
txy : lda CoordIndex,y : tax
lda CoordIndex,y : tax
lda $21,x : clc : adc $02 : sta $21,x ; coordinate update
lda CameraIndex,y : tax
lda $e3,x : clc : adc $03 : sta $e3,x ; scroll register high byte
@@ -234,22 +243,22 @@ ShiftVariablesSubDir:
lda $0605,x : clc : adc $02 : sta $0605,x ; high bytes of these guys
lda $0603,x : clc : adc $03 : sta $0603,x
lda $0607,x : clc : adc $03 : sta $0607,x
tyx : rts ; so as to not modify x
rts
}
ShiftCameraBounds:
{
lda CamBoundIndex,x : tay ; should be 0 for horz travel (vert bounds) or 4 for vert travel (horz bounds)
lda CamBoundIndex,y : tax ; should be 0 for horz travel (vert bounds) or 4 for vert travel (horz bounds)
rep #$30
lda $0127 : and #$00f0 : asl #2 : sta $06
lda $0127 : and #$0001 : cmp #$0000 : beq .subIt
lda $0618, y : clc : adc $06 : sta $0618, y
lda $061A, y : clc : adc $06 : sta $061A, y
lda $0618, x : clc : adc $06 : sta $0618, x
lda $061A, x : clc : adc $06 : sta $061A, x
sep #$30
rts
.subIt
lda $0618, y : sec : sbc $06 : sta $0618, y
lda $061A, y : sec : sbc $06 : sta $061A, y
lda $0618, x : sec : sbc $06 : sta $0618, x
lda $061A, x : sec : sbc $06 : sta $061A, x
sep #$30
rts
}
@@ -273,6 +282,12 @@ AdjustTransition:
rtl
}
GfxFixer:
jsl Dungeon_InitStarTileCh
jsl LoadTransAuxGfx
jsl PrepTransAuxGfx
rtl
org $279000
OffsetTable:
dw -8, 8

File diff suppressed because one or more lines are too long