Enable fast menu

Fast menu is an instant-open menu. It is an alternative to quickswap.
This commit is contained in:
Kevin Cathcart 2017-10-14 12:00:41 -04:00
parent a7d0e32f2d
commit 51a892e869
7 changed files with 31 additions and 7 deletions

View File

@ -6,7 +6,7 @@ from collections import OrderedDict
class World(object):
def __init__(self, shuffle, logic, mode, difficulty, goal, algorithm, place_dungeon_items, check_beatable_only, shuffle_ganon, quickswap):
def __init__(self, shuffle, logic, mode, difficulty, goal, algorithm, place_dungeon_items, check_beatable_only, shuffle_ganon, quickswap, fastmenu):
self.shuffle = shuffle
self.logic = logic
self.mode = mode
@ -48,6 +48,7 @@ class World(object):
self.fix_gtower_exit = self.shuffle_ganon
self.can_access_trock_eyebridge = None
self.quickswap = quickswap
self.fastmenu = fastmenu
self.spoiler = Spoiler(self)
def get_region(self, regionname):
@ -640,7 +641,8 @@ class Spoiler(object):
'difficulty': self.world.difficulty,
'completeable': not self.world.check_beatable_only,
'dungeonitems': self.world.place_dungeon_items,
'quickswap': self.world.quickswap}
'quickswap': self.world.quickswap,
'fastmenu': self.world.fastmenu}
def to_json(self):
self.parse_data()
@ -663,7 +665,8 @@ class Spoiler(object):
outfile.write('Filling Algorithm: %s\n' % self.metadata['algorithm'])
outfile.write('All Locations Accessible: %s\n' % ('Yes' if self.metadata['completeable'] else 'No, some locations may be unreachable'))
outfile.write('Maps and Compasses in Dungeons: %s\n' % ('Yes' if self.metadata['dungeonitems'] else 'No'))
outfile.write('L\\R Quickswap enabled: %s' % ('Yes' if self.metadata['quickswap'] else 'No'))
outfile.write('L\\R Quickswap enabled: %s\n' % ('Yes' if self.metadata['quickswap'] else 'No'))
outfile.write('Fastmenu enabled: %s' % ('Yes' if self.metadata['fastmenu'] else 'No'))
if self.entrances:
outfile.write('\n\nEntrances:\n\n')
outfile.write('\n'.join(['%s %s %s' % (entry['entrance'], '<=>' if entry['direction'] == 'both' else '<=' if entry['direction'] == 'exit' else '=>', entry['exit']) for entry in self.entrances]))

View File

@ -124,6 +124,7 @@ if __name__ == '__main__':
--seed given will produce the same 10 (different) roms each
time).
''', type=int)
parser.add_argument('--fastmenu', help='Enable instant menu', action='store_true')
parser.add_argument('--quickswap', help='Enable quick item swapping with L and R.', action='store_true')
parser.add_argument('--nodungeonitems', help='''\
Remove Maps and Compasses from Itempool, replacing them by

5
Gui.py
View File

@ -19,6 +19,8 @@ def guiMain(args=None):
suppressRomCheckbutton = Checkbutton(checkBoxFrame, text="Do not create patched Rom", variable=suppressRomVar)
quickSwapVar = IntVar()
quickSwapCheckbutton = Checkbutton(checkBoxFrame, text="Enabled L/R Item quickswapping", variable=quickSwapVar)
fastMenuVar = IntVar()
fastMenuCheckbutton = Checkbutton(checkBoxFrame, text="Enable instant menu", variable=fastMenuVar)
dungeonItemsVar = IntVar()
dungeonItemsCheckbutton = Checkbutton(checkBoxFrame, text="Place Dungeon Items (Compasses/Maps)", onvalue=0, offvalue=1, variable=dungeonItemsVar)
beatableOnlyVar = IntVar()
@ -29,6 +31,7 @@ def guiMain(args=None):
createSpoilerCheckbutton.pack(expand=True, anchor=W)
suppressRomCheckbutton.pack(expand=True, anchor=W)
quickSwapCheckbutton.pack(expand=True, anchor=W)
fastMenuCheckbutton.pack(expand=True, anchor=W)
dungeonItemsCheckbutton.pack(expand=True, anchor=W)
beatableOnlyCheckbutton.pack(expand=True, anchor=W)
shuffleGanonCheckbutton.pack(expand=True, anchor=W)
@ -159,6 +162,7 @@ def guiMain(args=None):
guiargs.suppress_rom = bool(suppressRomVar.get())
guiargs.nodungeonitems = bool(dungeonItemsVar.get())
guiargs.beatableonly = bool(beatableOnlyVar.get())
guiargs.fastmenu = bool(fastMenuVar.get())
guiargs.quickswap = bool(quickSwapVar.get())
guiargs.shuffleganon = bool(shuffleGanonVar.get())
guiargs.rom = romVar.get()
@ -197,6 +201,7 @@ def guiMain(args=None):
if args.nodungeonitems:
dungeonItemsVar.set(int(not args.nodungeonitems))
beatableOnlyVar.set(int(args.beatableonly))
fastMenuVar.set(int(args.fastmenu))
quickSwapVar.set(int(args.quickswap))
if args.count:
countVar.set(str(args.count))

View File

@ -28,7 +28,7 @@ def main(args, seed=None):
start = time.clock()
# initialize the world
world = World(args.shuffle, args.logic, args.mode, args.difficulty, args.goal, args.algorithm, not args.nodungeonitems, args.beatableonly, args.shuffleganon, args.quickswap)
world = World(args.shuffle, args.logic, args.mode, args.difficulty, args.goal, args.algorithm, not args.nodungeonitems, args.beatableonly, args.shuffleganon, args.quickswap, args.fastmenu)
logger = logging.getLogger('')
if seed is None:
random.seed(None)
@ -91,7 +91,7 @@ def main(args, seed=None):
else:
sprite = None
outfilebase = 'ER_%s_%s-%s-%s_%s-%s%s%s_%s' % (world.logic, world.difficulty, world.mode, world.goal, world.shuffle, world.algorithm, "-quickswap" if world.quickswap else "", "-shuffleganon" if world.shuffle_ganon else "", world.seed)
outfilebase = 'ER_%s_%s-%s-%s_%s-%s%s%s%s_%s' % (world.logic, world.difficulty, world.mode, world.goal, world.shuffle, world.algorithm, "-fastmenu" if world.fastmenu else "","-quickswap" if world.quickswap else "", "-shuffleganon" if world.shuffle_ganon else "", world.seed)
if not args.suppress_rom:
if args.jsonout:
@ -202,7 +202,7 @@ def generate_itempool(world):
def copy_world(world):
# ToDo: Not good yet
ret = World(world.shuffle, world.logic, world.mode, world.difficulty, world.goal, world.algorithm, world.place_dungeon_items, world.check_beatable_only, world.shuffle_ganon, world.quickswap)
ret = World(world.shuffle, world.logic, world.mode, world.difficulty, world.goal, world.algorithm, world.place_dungeon_items, world.check_beatable_only, world.shuffle_ganon, world.quickswap, world.fastmenu)
ret.required_medallions = list(world.required_medallions)
ret.swamp_patch_required = world.swamp_patch_required
ret.ganon_at_pyramid = world.ganon_at_pyramid

View File

@ -29,7 +29,7 @@ def main(args, seed=None):
start = time.clock()
# initialize the world
world = World('vanilla', 'noglitches', 'standard', 'normal', 'ganon', 'freshness', False, False, False, args.quickswap)
world = World('vanilla', 'noglitches', 'standard', 'normal', 'ganon', 'freshness', False, False, False, args.quickswap, args.fastmenu)
logger = logging.getLogger('')
hasher = hashlib.md5()
@ -203,6 +203,7 @@ if __name__ == '__main__':
parser.add_argument('--rom', default='Zelda no Densetsu - Kamigami no Triforce (Japan).sfc', help='Path to an ALttP JAP(1.0) rom to use as a base.')
parser.add_argument('--loglevel', default='info', const='info', nargs='?', choices=['error', 'info', 'warning', 'debug'], help='Select level of logging for output.')
parser.add_argument('--seed', help='Define seed number to generate.', type=int)
parser.add_argument('--fastmenu', help='Enable instant menu', action='store_true')
parser.add_argument('--quickswap', help='Enable quick item swapping with L and R.', action='store_true')
parser.add_argument('--heartbeep', default='normal', const='normal', nargs='?', choices=['normal', 'half', 'quarter', 'off'],
help='Select the rate at which the heart beep sound is played at low health.')

View File

@ -203,6 +203,12 @@ If --seed is provided, it will be used for the first seed, then used to derive t
Use to enable quick item swap with L/R buttons. (default: False)
```
--fastmenu
```
As an alternative to quickswap, opens menu instantly. (default: False)
```
--nodungeonitems
```

8
Rom.py
View File

@ -360,6 +360,14 @@ def patch_rom(world, rom, hashtable, beep='normal', sprite=None):
rom.write_byte(0x15E25, 0xA4)
# todo fix screen scrolling
#enable instant item menu
if world.fastmenu:
rom.write_byte(0x180048, 0x01)
# Sound twekas for fastmenu:
rom.write_byte(0x6DD9A, 0x20)
rom.write_byte(0x6DF2A, 0x20)
rom.write_byte(0x6E0E9, 0x20)
# enable quick item swapping with L and R (ported by Amazing Ampharos)
if world.quickswap:
rom.write_bytes(0x107fb, [0x22, 0x50, 0xFF, 0x1F])