Fixed off-by-one issue on writing dest to ROM

This commit is contained in:
codemann8
2021-04-13 19:11:37 -05:00
parent 2b0cc0fc0d
commit 4a0bf1f123
7 changed files with 17 additions and 13 deletions

1
.gitignore vendored
View File

@@ -37,5 +37,4 @@ get-pip.py
venv
test
*.code-workspace
*.zspr

View File

@@ -1471,9 +1471,9 @@ class OWEdge(object):
def getAddress(self):
base_address = {
Direction.North: 0x153800,
Direction.South: 0x153800 + (0x41 * 12),
Direction.West: 0x153800 + (0x82 * 12),
Direction.East: 0x153800 + (0xcc * 12),
Direction.South: 0x153800 + (0x42 * 12),
Direction.West: 0x153800 + (0x84 * 12),
Direction.East: 0x153800 + (0xcf * 12),
}
return base_address[self.direction] + (self.edge_id * 12)

View File

@@ -48,14 +48,16 @@ def connect_two_way(world, entrancename, exitname, player):
exit.connect(entrance.parent_region)
x = world.check_for_owedge(entrancename, player)
y = world.check_for_owedge(exitname, player)
if x is not None:
if x is not None and y is not None:
x.dest = y
if y is not None:
y.dest = x
elif x is None:
logging.getLogger('').error('%s is not a valid edge.', entrancename)
elif y is None:
logging.getLogger('').error('%s is not a valid edge.', exitname)
world.spoiler.set_overworld(exitname, entrancename, 'both', player)
# these are connections that cannot be shuffled and always exist. They link together separate parts of the world we need to divide into regions
test_connections = [
#('Links House ES', 'Octoballoon WS'),
#('Links House NE', 'Lost Woods Pass SW')
@@ -68,6 +70,7 @@ temporary_mandatory_connections = [
('Stone Bridge WC', 'Hobo EC'),
]
# these are connections that cannot be shuffled and always exist. They link together separate parts of the world we need to divide into regions
mandatory_connections = [('Flute Spot 1', 'West Death Mountain (Bottom)'),
('Flute Spot 2', 'Potion Shop Area'),
('Flute Spot 3', 'Kakariko Area'),

2
Rom.py
View File

@@ -27,7 +27,7 @@ from EntranceShuffle import door_addresses, exit_ids
JAP10HASH = '03a63945398191337e896e5771f77173'
RANDOMIZERBASEHASH = 'f82fc93357cab31b03de36ce4c5b01b2'
RANDOMIZERBASEHASH = 'f2cddfcfcf24946664eac6ce07546454'
class JsonRom(object):

View File

@@ -198,8 +198,9 @@ OWNewDestination:
ldx OWBGIndex,y : lda $e2,x : !add 1,s : !add 3,s : sta $e2,x
ldx OWCameraIndex,y : lda $618,x : !add 1,s : !add 3,s : sta $618,x
ldx OWCameraIndex,y : lda $61a,x : !add 1,s : !add 3,s : sta $61a,x
pla : lsr : pha : ldx OWBGIndex,y : lda $e0,x : !add 1,s : sta $e0,x
pla : pla : lsr : pha : ldx OWBGIndex,y : lda $e0,x : !add 1,s : sta $e0,x
pla : asl : php : ror : plp : ror
pha : ldx OWBGIndex,y : lda $e0,x : !add 1,s : sta $e0,x
pla : ldx OWBGIndex,y : lda $e0,x : !add 1,s : sta $e0,x
pla : pla : pla
;opposite coord stuff
@@ -211,11 +212,12 @@ OWNewDestination:
sep #$10 : tax : phx : ldx #$0 : phx : rep #$10 : pla : plx : plx : pha
++ ;ldy #$0
ldx OWOppCoordIndex,y : lda $20,x : !add 1,s : sta $20,x ;set coord
sep #$10 : ldx OWOppCoordIndex,y : lda $20,x : !add 1,s : sta $20,x ;set coord
ldx OWOppBGIndex,y : lda $e2,x : !add 1,s : sta $e2,x
ldx OWOppCameraIndex,y : lda $618,x : !add 1,s : sta $618,x
ldx OWOppCameraIndex,y : lda $61a,x : !add 1,s : sta $61a,x
ldx OWOppBGIndex,y : lda $e0,x : !add 1,s : sta $e0,x : pla
ldx OWOppBGIndex,y : lda $e0,x : !add 1,s : sta $e0,x
lda $610,y : !add 1,s : sta $610,y : pla
sep #$30 ;: ldy $418 :
lda OWOppSlotOffset,y : !add $04 : asl : sta $700

Binary file not shown.

File diff suppressed because one or more lines are too long