From 34df144f8c564c7f6c7192a1afc1500d7fcce1d7 Mon Sep 17 00:00:00 2001 From: CaitSith2 Date: Sun, 12 Apr 2020 15:46:32 -0700 Subject: [PATCH] Changes (#64) * Fix bug where collected maps show on item menu if compass shuffle is on, (and collected compasses if map shuffle is on.) * Add Dungeon Counter Options --- EntranceRandomizer.py | 20 +++++++++++++++++++- Gui.py | 16 ++++++++++++++++ Main.py | 1 + Mystery.py | 2 ++ Rom.py | 10 ++++++---- easy.yaml | 5 +++++ 6 files changed, 49 insertions(+), 5 deletions(-) diff --git a/EntranceRandomizer.py b/EntranceRandomizer.py index f8f96a5e..71a8e474 100755 --- a/EntranceRandomizer.py +++ b/EntranceRandomizer.py @@ -111,6 +111,20 @@ def parse_arguments(argv, no_defaults=False): Timed mode. If time runs out, you lose (but can still keep playing). ''') + parser.add_argument('--dungeon_counters', default=defval('default'), const='default', nargs='?', choices=['default', 'on', 'pickup', 'off'], + help='''\ + Select dungeon counter display settings. (default: %(default)s) + (Note, since timer takes up the same space on the hud as dungeon + counters, timer settings override dungeon counter settings.) + Default: Dungeon counters only show when the compass is + picked up, or otherwise sent, only when compass + shuffle is turned on. + On: Dungeon counters are always displayed. + Pickup: Dungeon counters are shown when the compass is + picked up, even when compass shuffle is turned + off. + Off: Dungeon counters are never shown. + ''') parser.add_argument('--progressive', default=defval('on'), const='normal', nargs='?', choices=['on', 'off', 'random'], help='''\ Select progressive equipment setting. Affects available itempool. (default: %(default)s) @@ -285,6 +299,10 @@ def parse_arguments(argv, no_defaults=False): ret = parser.parse_args(argv) if ret.timer == "none": ret.timer = False + if ret.dungeon_counters == 'on': + ret.dungeon_counters = True + elif ret.dungeon_counters == 'off': + ret.dungeon_counters = False if ret.keysanity: ret.mapshuffle, ret.compassshuffle, ret.keyshuffle, ret.bigkeyshuffle = [True] * 4 @@ -300,7 +318,7 @@ def parse_arguments(argv, no_defaults=False): 'shufflebosses', 'shuffleenemies', 'enemy_health', 'enemy_damage', 'shufflepots', 'ow_palettes', 'uw_palettes', 'sprite', 'disablemusic', 'quickswap', 'fastmenu', 'heartcolor', 'heartbeep', - 'remote_items', 'progressive', 'extendedmsu']: + 'remote_items', 'progressive', 'extendedmsu', 'dungeon_counters']: value = getattr(defaults, name) if getattr(playerargs, name) is None else getattr(playerargs, name) if player == 1: setattr(ret, name, {1: value}) diff --git a/Gui.py b/Gui.py index 94b6e7c3..52e58f4b 100755 --- a/Gui.py +++ b/Gui.py @@ -289,6 +289,14 @@ def guiMain(args=None): timerLabel = Label(timerFrame, text='Timer setting') timerLabel.pack(side=LEFT) + dungeonCounterFrame = Frame(drowDownFrame) + dungeonCounterVar = StringVar() + dungeonCounterVar.set('auto') + dungeonCounterOptionMenu = OptionMenu(dungeonCounterFrame, dungeonCounterVar, 'auto', 'off', 'on', 'on_compass_pickup') + dungeonCounterOptionMenu.pack(side=RIGHT) + dungeonCounterLabel = Label(dungeonCounterFrame, text='Dungeon Chest Counters') + dungeonCounterLabel.pack(side=LEFT) + progressiveFrame = Frame(drowDownFrame) progressiveVar = StringVar() progressiveVar.set('on') @@ -330,6 +338,7 @@ def guiMain(args=None): difficultyFrame.pack(expand=True, anchor=E) itemfunctionFrame.pack(expand=True, anchor=E) timerFrame.pack(expand=True, anchor=E) + dungeonCounterFrame.pack(expand=True, anchor=E) progressiveFrame.pack(expand=True, anchor=E) accessibilityFrame.pack(expand=True, anchor=E) algorithmFrame.pack(expand=True, anchor=E) @@ -427,6 +436,13 @@ def guiMain(args=None): guiargs.timer = timerVar.get() if guiargs.timer == "none": guiargs.timer = False + guiargs.dungeon_counters = dungeonCounterVar.get() + if guiargs.dungeon_counters == "on_compass_pickup": + guiargs.dungeon_counters = "pickup" + elif guiargs.dungeon_counters == "on": + guiargs.dungeon_counters = True + elif guiargs.dungeon_counters == "off": + guiargs.dungeon_counters = False guiargs.progressive = progressiveVar.get() guiargs.accessibility = accessibilityVar.get() guiargs.algorithm = algorithmVar.get() diff --git a/Main.py b/Main.py index a68c29e3..afe1cbb3 100644 --- a/Main.py +++ b/Main.py @@ -57,6 +57,7 @@ def main(args, seed=None): world.timer = args.timer.copy() world.shufflepots = args.shufflepots.copy() world.progressive = args.progressive.copy() + world.dungeon_counters = args.dungeon_counters.copy() world.extendedmsu = args.extendedmsu.copy() world.rom_seeds = {player: random.randint(0, 999999999) for player in range(1, world.players + 1)} diff --git a/Mystery.py b/Mystery.py index 114da3db..4a7ccd04 100644 --- a/Mystery.py +++ b/Mystery.py @@ -268,6 +268,8 @@ def roll_settings(weights): 'timed_countdown': 'timed-countdown', 'display': 'display'}[get_choice('timer', weights)] if 'timer' in weights.keys() else False + ret.dungeon_counters = get_choice('dungeon_counters', weights) if 'dungeon_counters' in weights else 'default' + ret.progressive = convert_to_on_off(get_choice('progressive', weights)) if "progressive" in weights else 'on' inventoryweights = weights.get('startinventory', {}) startitems = [] diff --git a/Rom.py b/Rom.py index ffc082ef..1b77af9e 100644 --- a/Rom.py +++ b/Rom.py @@ -1126,9 +1126,11 @@ def patch_rom(world, rom, player, team, enemized): rom.write_byte(0x18003B, 0x01 if world.mapshuffle[player] else 0x00) # maps showing crystals on overworld # compasses showing dungeon count - if world.clock_mode[player]: + if world.clock_mode[player] or not world.dungeon_counters[player]: rom.write_byte(0x18003C, 0x00) # Currently must be off if timer is on, because they use same HUD location - elif world.compassshuffle[player]: + elif world.dungeon_counters[player] == True: + rom.write_byte(0x18003C, 0x02) # always on + elif world.compassshuffle[player] or world.dungeon_counters[player] == 'pickup': rom.write_byte(0x18003C, 0x01) # show on pickup else: rom.write_byte(0x18003C, 0x00) @@ -1143,8 +1145,8 @@ def patch_rom(world, rom, player, team, enemized): # rom.write_byte(0x180045, ((0x01 if world.keyshuffle[player] else 0x00) | (0x02 if world.bigkeyshuffle[player] else 0x00) - | (0x04 if world.compassshuffle[player] else 0x00) - | (0x08 if world.mapshuffle[player] else 0x00))) # free roaming items in menu + | (0x04 if world.mapshuffle[player] else 0x00) + | (0x08 if world.compassshuffle[player] else 0x00))) # free roaming items in menu # Map reveals reveal_bytes = { diff --git a/easy.yaml b/easy.yaml index 90bba920..bc9fd8a3 100644 --- a/easy.yaml +++ b/easy.yaml @@ -46,6 +46,11 @@ dungeon_items: # alternative to the 4 shuffles above this, does nothing until th mc: 0 # shuffle Maps and Compass none: 1 # shuffle none of the 4 mcsb: 0 # shuffle all of the 4, any combination of m, c, s and b will shuffle the respective item, or not if it's missing, so you can add more options here +dungeon_counters: + on: 0 # always display amount of items checked in a dungeon + pickup: 0 # show when compass is picked up + default: 1 # show when compass is picked up if the compass itself is shuffled + off: 0 # never show item count in dungeons accessibility: items: 0 # Guarantees you will be able to acquire all items, but you may not be able to access all locations locations: 1 # Guarantees you will be able to access all locations, and therefore all items