Permalink
Browse files

Fixed a bug where some caves weren't randomized

Garin's Grave and Tantegel Basement weren't being shuffled.
Also moved speed hacks to the top level options menu.
  • Loading branch information...
mcgrew committed Aug 7, 2016
1 parent 6c53690 commit 30153fa0894ea00bdebb0664ceac59941afe20f4
Showing with 17 additions and 17 deletions.
  1. +4 −4 dwrandomizer.py
  2. +13 −13 worldmap.py
@@ -9,7 +9,7 @@
from worldmap import WorldMap,MapGrid
import ips
VERSION = "1.2"
VERSION = "1.2.1"
#sha1sums of various roms
prg0sums = ['6a50ce57097332393e0e8751924fd56456ef083c', #Dragon Warrior (U) (PRG0) [!].nes
'66330df6fe3e3c85adb8183721e5f88c149e52eb', #Dragon Warrior (U) (PRG0) [b1].nes
@@ -826,13 +826,13 @@ def prompt_for_options(args):
elif (mode.lower().startswith("f")):
args.fast_leveling = True
if input("\nApply hacks to speed up game play (experimental)? (y/N) ").lower().startswith("y"):
args.speed_hacks = True
if custom:
if input("\nGenerate a random world map? (Y/n) ").lower().startswith("n"):
args.no_map = False
if input("\nApply hacks to speed up game play (experimental)? (y/N) ").lower().startswith("y"):
args.speed_hacks = True
if args.no_map:
if input("\nRandomize town & cave locations? (Y/n) ").lower().startswith("n"):
args.no_towns = False
@@ -610,22 +610,22 @@ def shuffle_warps(self):
"""
Shuffles the map warps (towns and caves).
"""
if not self.generated: # don't shuffle if this is a generated map.
cave_end = 8 if self.generated else 7
caves = [self.warps_from[x] for x in self.cave_warps[:cave_end]]
towns = [self.warps_from[x] for x in self.town_warps]
cave_end = 8 if self.generated else 7
caves = [self.warps_from[x] for x in self.cave_warps[:cave_end]]
towns = [self.warps_from[x] for x in self.town_warps]
random.shuffle(caves)
random.shuffle(towns)
while not self.generated and (tuple(caves[1]) == (1, 108, 109) or
(tuple(towns[4]) == (1, 102, 72) and caves[1][0] in (4, 9)) or
(tuple(towns[0]) == (1, 102, 72) and caves[1][0] == 9)):
random.shuffle(caves)
random.shuffle(towns)
while not self.generated and (tuple(caves[1]) == (1, 108, 109) or
(tuple(towns[4]) == (1, 102, 72) and caves[1][0] in (4, 9)) or
(tuple(towns[0]) == (1, 102, 72) and caves[1][0] == 9)):
random.shuffle(caves)
# save the shuffling
for i in range(cave_end):
self.warps_from[self.cave_warps[i]] = caves[i]
# save the shuffling
for i in range(cave_end):
self.warps_from[self.cave_warps[i]] = caves[i]
if not self.generated: # don't shuffle towns if this is a generated map.
for i in range(6):
self.warps_from[self.town_warps[i]] = towns[i]
self.update_warps()
self.update_warps()
def update_warps(self):
# update with the new warps

0 comments on commit 30153fa

Please sign in to comment.