From 0e625b5422746eadca0da994e55904d9101c202a Mon Sep 17 00:00:00 2001 From: Thomas McGrew Date: Mon, 29 Feb 2016 01:55:01 -0500 Subject: [PATCH] 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. --- dwrandomizer.py | 31 +++++++++++++++---------------- worldmap.py | 8 ++++---- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/dwrandomizer.py b/dwrandomizer.py index 8220ea4..c39f3f0 100755 --- a/dwrandomizer.py +++ b/dwrandomizer.py @@ -465,9 +465,9 @@ def fix_fighters_ring(self): Adds functionality for the fighter's ring (+2 to attack) """ # ring patch - self.add_patch(0xf10c, 1, (0x20, 0x54, 0xff, 0xea)) - self.add_patch(0xff64 ,1, (0x85, 0xcd, 0xa5, 0xcf, 0x29, 0x20, 0xf0, 0x07, - 0xa5, 0xcc, 0x18, 0x69, 0x02, 0x85, 0xcc, 0xa5, 0xcf, 0x60)) + self.add_patch(0xf10c, 1, 0x20, 0x54, 0xff, 0xea) + self.add_patch(0xff64 ,1, 0x85, 0xcd, 0xa5, 0xcf, 0x29, 0x20, 0xf0, 0x07, + 0xa5, 0xcc, 0x18, 0x69, 0x02, 0x85, 0xcc, 0xa5, 0xcf, 0x60) def move_repel(self): """ @@ -480,14 +480,14 @@ def buff_heal(self): """ Buffs the heal spell slightly to have a range of 10-25 instead of 10-15 """ - self.add_patch(0xdbce, 1, [15]) + self.add_patch(0xdbce, 1, 15) def patch_northern_shrine(self): """ Removes the 2 blocks from around the shrine guardian so you can walk around him. """ - self.add_patch(0xd77, 10, [0x66, 0x66]) + self.add_patch(0xd77, 10, 0x66, 0x66) def revert(self): """ @@ -544,15 +544,15 @@ def add_tantegel_exit(self): Adds a quicker exit for the Tantegel throne room. """ # add new stairs to the throne room and 1st floor - self.add_patch(0x43a, 1, [0x47]) - self.add_patch(0x2b9, 1, [0x45]) + self.add_patch(0x43a, 1, 0x47) + self.add_patch(0x2b9, 1, 0x45) # add a new exit to the first floor - self.add_patch(0x2d7, 1, [0x66]) + self.add_patch(0x2d7, 1, 0x66) # replace the usless grave warps with some for tantegel - self.add_patch(0xf45f, 1, [5, 1, 8]) - self.add_patch(0xf4f8, 1, [4, 1, 7]) + self.add_patch(0xf45f, 1, 5, 1, 8) + self.add_patch(0xf4f8, 1, 4, 1, 7) #remove the top set of stairs associated with the old warp in the grave - self.add_patch(0x1298, 1, [0x22]) + self.add_patch(0x1298, 1, 0x22) def commit(self): """ @@ -586,21 +586,20 @@ def commit(self): self.rom_data[self.chests_slice] = self.chests self.apply_patches() - def add_patch(self, addr, step, data): + def add_patch(self, addr, *data): """ Adds a new manual rom patch :Parameters: addr : int The address where the new data is to be applied - step : int - The distance between each data byte in the rom data : array - The data to be patched into the ROM + The first argument should be the distance between each byte to be placed + in the rom. The rest is the data to be patched into the ROM rtype: return: """ - self.patches[addr] = (step, *data) + self.patches[addr] = data def apply_patches(self): """ diff --git a/worldmap.py b/worldmap.py index fc222b2..30a8215 100755 --- a/worldmap.py +++ b/worldmap.py @@ -178,7 +178,7 @@ def place_landmarks(self): grid = MapGrid(self.grid) # place Charlock - while (self.closer_than(x-3, y, *tantegel, 5) or + while (self.closer_than(5, x-3, y, *tantegel) or self.tile_at( x, y) in (TOWN, CASTLE, CAVE, STAIRS)): x, y = self.accessible_land(grid, tantegel, 6, 118, 3, 116) charlock = (x-3, y) @@ -192,19 +192,19 @@ def place_landmarks(self): for i in range(6): x, y = charlock - while (self.closer_than(x, y, *charlock, 5) or + while (self.closer_than(5, x, y, *charlock) or self.grid[y][x] in (TOWN, CASTLE, CAVE, STAIRS)): x, y = self.accessible_land(grid, tantegel) self.add_warp(1, x, y, TOWN) for i in range(6): x, y = charlock - while (self.closer_than(x, y, *charlock, 5) or + while (self.closer_than(5, x, y, *charlock) or self.grid[y][x] in (TOWN, CASTLE, CAVE, STAIRS)): x, y = self.accessible_land(grid, tantegel) self.add_warp(1, x, y, CAVE) - def closer_than (self, x1, y1, x2, y2, distance): + def closer_than (self, distance, x1, y1, x2, y2): """ Determines whether x1,y1 is closer than distance vertically and horizontally to x2,y2.