Skip to content

Commit 0e625b5

Browse files
committed
Some fixes for python 3.4.
Python 3.4 didn't like some of my syntax. Win7 Service pack 1 is required for Python 3.5 Service Pack 1 won't install in my VM for unknown reasons. Welcome to yak shaving 101.
1 parent 927150c commit 0e625b5

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

dwrandomizer.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -465,9 +465,9 @@ def fix_fighters_ring(self):
465465
Adds functionality for the fighter's ring (+2 to attack)
466466
"""
467467
# ring patch
468-
self.add_patch(0xf10c, 1, (0x20, 0x54, 0xff, 0xea))
469-
self.add_patch(0xff64 ,1, (0x85, 0xcd, 0xa5, 0xcf, 0x29, 0x20, 0xf0, 0x07,
470-
0xa5, 0xcc, 0x18, 0x69, 0x02, 0x85, 0xcc, 0xa5, 0xcf, 0x60))
468+
self.add_patch(0xf10c, 1, 0x20, 0x54, 0xff, 0xea)
469+
self.add_patch(0xff64 ,1, 0x85, 0xcd, 0xa5, 0xcf, 0x29, 0x20, 0xf0, 0x07,
470+
0xa5, 0xcc, 0x18, 0x69, 0x02, 0x85, 0xcc, 0xa5, 0xcf, 0x60)
471471

472472
def move_repel(self):
473473
"""
@@ -480,14 +480,14 @@ def buff_heal(self):
480480
"""
481481
Buffs the heal spell slightly to have a range of 10-25 instead of 10-15
482482
"""
483-
self.add_patch(0xdbce, 1, [15])
483+
self.add_patch(0xdbce, 1, 15)
484484

485485
def patch_northern_shrine(self):
486486
"""
487487
Removes the 2 blocks from around the shrine guardian so you can walk around
488488
him.
489489
"""
490-
self.add_patch(0xd77, 10, [0x66, 0x66])
490+
self.add_patch(0xd77, 10, 0x66, 0x66)
491491

492492
def revert(self):
493493
"""
@@ -544,15 +544,15 @@ def add_tantegel_exit(self):
544544
Adds a quicker exit for the Tantegel throne room.
545545
"""
546546
# add new stairs to the throne room and 1st floor
547-
self.add_patch(0x43a, 1, [0x47])
548-
self.add_patch(0x2b9, 1, [0x45])
547+
self.add_patch(0x43a, 1, 0x47)
548+
self.add_patch(0x2b9, 1, 0x45)
549549
# add a new exit to the first floor
550-
self.add_patch(0x2d7, 1, [0x66])
550+
self.add_patch(0x2d7, 1, 0x66)
551551
# replace the usless grave warps with some for tantegel
552-
self.add_patch(0xf45f, 1, [5, 1, 8])
553-
self.add_patch(0xf4f8, 1, [4, 1, 7])
552+
self.add_patch(0xf45f, 1, 5, 1, 8)
553+
self.add_patch(0xf4f8, 1, 4, 1, 7)
554554
#remove the top set of stairs associated with the old warp in the grave
555-
self.add_patch(0x1298, 1, [0x22])
555+
self.add_patch(0x1298, 1, 0x22)
556556

557557
def commit(self):
558558
"""
@@ -586,21 +586,20 @@ def commit(self):
586586
self.rom_data[self.chests_slice] = self.chests
587587
self.apply_patches()
588588

589-
def add_patch(self, addr, step, data):
589+
def add_patch(self, addr, *data):
590590
"""
591591
Adds a new manual rom patch
592592
:Parameters:
593593
addr : int
594594
The address where the new data is to be applied
595-
step : int
596-
The distance between each data byte in the rom
597595
data : array
598-
The data to be patched into the ROM
596+
The first argument should be the distance between each byte to be placed
597+
in the rom. The rest is the data to be patched into the ROM
599598
600599
rtype:
601600
return:
602601
"""
603-
self.patches[addr] = (step, *data)
602+
self.patches[addr] = data
604603

605604
def apply_patches(self):
606605
"""

worldmap.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def place_landmarks(self):
178178
grid = MapGrid(self.grid)
179179

180180
# place Charlock
181-
while (self.closer_than(x-3, y, *tantegel, 5) or
181+
while (self.closer_than(5, x-3, y, *tantegel) or
182182
self.tile_at( x, y) in (TOWN, CASTLE, CAVE, STAIRS)):
183183
x, y = self.accessible_land(grid, tantegel, 6, 118, 3, 116)
184184
charlock = (x-3, y)
@@ -192,19 +192,19 @@ def place_landmarks(self):
192192

193193
for i in range(6):
194194
x, y = charlock
195-
while (self.closer_than(x, y, *charlock, 5) or
195+
while (self.closer_than(5, x, y, *charlock) or
196196
self.grid[y][x] in (TOWN, CASTLE, CAVE, STAIRS)):
197197
x, y = self.accessible_land(grid, tantegel)
198198
self.add_warp(1, x, y, TOWN)
199199

200200
for i in range(6):
201201
x, y = charlock
202-
while (self.closer_than(x, y, *charlock, 5) or
202+
while (self.closer_than(5, x, y, *charlock) or
203203
self.grid[y][x] in (TOWN, CASTLE, CAVE, STAIRS)):
204204
x, y = self.accessible_land(grid, tantegel)
205205
self.add_warp(1, x, y, CAVE)
206206

207-
def closer_than (self, x1, y1, x2, y2, distance):
207+
def closer_than (self, distance, x1, y1, x2, y2):
208208
"""
209209
Determines whether x1,y1 is closer than distance vertically and
210210
horizontally to x2,y2.

0 commit comments

Comments
 (0)