fix clock mode, again

This commit is contained in:
Fabian Dill 2020-03-04 13:55:03 +01:00
parent 62c54e2eab
commit e3beb702f8
7 changed files with 36 additions and 20 deletions

View File

@ -98,7 +98,7 @@ class World(object):
set_player_attr('open_pyramid', False) set_player_attr('open_pyramid', False)
set_player_attr('treasure_hunt_icon', 'Triforce Piece') set_player_attr('treasure_hunt_icon', 'Triforce Piece')
set_player_attr('treasure_hunt_count', 0) set_player_attr('treasure_hunt_count', 0)
set_player_attr('clock_mode', 'off') set_player_attr('clock_mode', False)
set_player_attr('can_take_damage', True) set_player_attr('can_take_damage', True)
def get_name_string_for_object(self, obj) -> str: def get_name_string_for_object(self, obj) -> str:

View File

@ -280,13 +280,15 @@ def parse_arguments(argv, no_defaults=False):
parser.add_argument(f'--p{player}', default=defval(''), help=argparse.SUPPRESS) parser.add_argument(f'--p{player}', default=defval(''), help=argparse.SUPPRESS)
ret = parser.parse_args(argv) ret = parser.parse_args(argv)
if ret.timer == "none":
ret.timer = False
if ret.keysanity: if ret.keysanity:
ret.mapshuffle, ret.compassshuffle, ret.keyshuffle, ret.bigkeyshuffle = [True] * 4 ret.mapshuffle, ret.compassshuffle, ret.keyshuffle, ret.bigkeyshuffle = [True] * 4
if multiargs.multi: if multiargs.multi:
defaults = copy.deepcopy(ret) defaults = copy.deepcopy(ret)
for player in range(1, multiargs.multi + 1): for player in range(1, multiargs.multi + 1):
playerargs = parse_arguments(shlex.split(getattr(ret,f"p{player}")), True) playerargs = parse_arguments(shlex.split(getattr(ret, f"p{player}")), True)
for name in ['logic', 'mode', 'swords', 'goal', 'difficulty', 'item_functionality', for name in ['logic', 'mode', 'swords', 'goal', 'difficulty', 'item_functionality',
'shuffle', 'crystals_ganon', 'crystals_gt', 'openpyramid', 'timer', 'shuffle', 'crystals_ganon', 'crystals_gt', 'openpyramid', 'timer',

2
Gui.py
View File

@ -416,6 +416,8 @@ def guiMain(args=None):
guiargs.difficulty = difficultyVar.get() guiargs.difficulty = difficultyVar.get()
guiargs.item_functionality = itemfunctionVar.get() guiargs.item_functionality = itemfunctionVar.get()
guiargs.timer = timerVar.get() guiargs.timer = timerVar.get()
if guiargs.timer == "none":
guiargs.timer = False
guiargs.progressive = progressiveVar.get() guiargs.progressive = progressiveVar.get()
guiargs.accessibility = accessibilityVar.get() guiargs.accessibility = accessibilityVar.get()
guiargs.algorithm = algorithmVar.get() guiargs.algorithm = algorithmVar.get()

View File

@ -129,8 +129,10 @@ def generate_itempool(world, player):
'dungeons', 'dungeons',
'triforcehunt', 'triforcehunt',
'crystals'] 'crystals']
or world.mode[player] not in ['open', 'standard', 'inverted'] or world.timer[player] not in ['none', 'display', or world.mode[player] not in ['open', 'standard', 'inverted'] or world.timer[player] not in [False,
'timed', 'timed-ohko', 'display',
'timed',
'timed-ohko',
'ohko', 'ohko',
'timed-countdown']): 'timed-countdown']):
raise NotImplementedError('Not supported yet') raise NotImplementedError('Not supported yet')
@ -669,13 +671,14 @@ def make_custom_item_pool(progressive, shuffle, difficulty, timer, goal, mode, s
def test(): def test():
for difficulty in ['normal', 'hard', 'expert']: for difficulty in ['normal', 'hard', 'expert']:
for goal in ['ganon', 'triforcehunt', 'pedestal']: for goal in ['ganon', 'triforcehunt', 'pedestal']:
for timer in ['none', 'display', 'timed', 'timed-ohko', 'ohko', 'timed-countdown']: for timer in [False, 'display', 'timed', 'timed-ohko', 'ohko', 'timed-countdown']:
for mode in ['open', 'standard', 'inverted']: for mode in ['open', 'standard', 'inverted']:
for swords in ['random', 'assured', 'swordless', 'vanilla']: for swords in ['random', 'assured', 'swordless', 'vanilla']:
for progressive in ['on', 'off']: for progressive in ['on', 'off']:
for shuffle in ['full', 'insanity_legacy']: for shuffle in ['full', 'insanity_legacy']:
for retro in [True, False]: for retro in [True, False]:
out = get_pool_core(progressive, shuffle, difficulty, timer, goal, mode, swords, retro) out = get_pool_core(progressive, shuffle, difficulty, timer, goal, mode, swords,
retro)
count = len(out[0]) + len(out[1]) count = len(out[0]) + len(out[1])
correct_count = total_items_to_place correct_count = total_items_to_place

15
Main.py
View File

@ -197,12 +197,19 @@ def main(args, seed=None):
outfilepname += f'_P{player}' outfilepname += f'_P{player}'
if world.players > 1 or world.teams > 1: if world.players > 1 or world.teams > 1:
outfilepname += f"_{world.player_names[player][team].replace(' ', '_')}" if world.player_names[player][team] != 'Player %d' % player else '' outfilepname += f"_{world.player_names[player][team].replace(' ', '_')}" if world.player_names[player][team] != 'Player %d' % player else ''
outfilesuffix = ('_%s_%s-%s-%s-%s%s_%s-%s%s%s%s%s' % (world.logic[player], world.difficulty[player], world.difficulty_adjustments[player], outfilesuffix = ('_%s_%s-%s-%s-%s%s_%s-%s%s%s%s%s' % (world.logic[player], world.difficulty[player],
world.difficulty_adjustments[player],
world.mode[player], world.goal[player], world.mode[player], world.goal[player],
"" if world.timer[player] in ['none', 'display'] else "-" + world.timer[player], "" if world.timer[player] in [False,
world.shuffle[player], world.algorithm, mcsb_name, 'display'] else "-" +
world.timer[
player],
world.shuffle[player], world.algorithm,
mcsb_name,
"-retro" if world.retro[player] else "", "-retro" if world.retro[player] else "",
"-prog_" + world.progressive[player] if world.progressive[player] in ['off', 'random'] else "", "-prog_" + world.progressive[player] if
world.progressive[player] in ['off',
'random'] else "",
"-nohints" if not world.hints[player] else "")) if not args.outputname else '' "-nohints" if not world.hints[player] else "")) if not args.outputname else ''
rom.write_to_file(output_path(f'{outfilebase}{outfilepname}{outfilesuffix}.sfc')) rom.write_to_file(output_path(f'{outfilebase}{outfilepname}{outfilesuffix}.sfc'))

View File

@ -256,12 +256,14 @@ def roll_settings(weights):
ret.beemizer = int(get_choice('beemizer', weights)) if 'beemizer' in weights else 0 ret.beemizer = int(get_choice('beemizer', weights)) if 'beemizer' in weights else 0
ret.timer = {'none': 'none', ret.timer = {'none': False,
None: False,
False: False,
'timed': 'timed', 'timed': 'timed',
'timed_ohko': 'timed-ohko', 'timed_ohko': 'timed-ohko',
'ohko': 'ohko', 'ohko': 'ohko',
'timed_countdown': 'timed-countdown', 'timed_countdown': 'timed-countdown',
'display': 'display'}[get_choice('timer', weights)] if 'timer' in weights.keys() else 'none' 'display': 'display'}[get_choice('timer', weights)] if 'timer' in weights.keys() else False
ret.progressive = convert_to_on_off(get_choice('progressive', weights)) if "progressive" in weights else 'on' ret.progressive = convert_to_on_off(get_choice('progressive', weights)) if "progressive" in weights else 'on'
inventoryweights = weights.get('startinventory', {}) inventoryweights = weights.get('startinventory', {})

4
Rom.py
View File

@ -853,7 +853,7 @@ def patch_rom(world, rom, player, team, enemized):
ERtimeincrease = 20 ERtimeincrease = 20
if world.keyshuffle[player] or world.bigkeyshuffle[player] or world.mapshuffle[player]: if world.keyshuffle[player] or world.bigkeyshuffle[player] or world.mapshuffle[player]:
ERtimeincrease = ERtimeincrease + 15 ERtimeincrease = ERtimeincrease + 15
if world.clock_mode[player] == 'off': if world.clock_mode[player] == False:
rom.write_bytes(0x180190, [0x00, 0x00, 0x00]) # turn off clock mode rom.write_bytes(0x180190, [0x00, 0x00, 0x00]) # turn off clock mode
write_int32(rom, 0x180200, 0) # red clock adjustment time (in frames, sint32) write_int32(rom, 0x180200, 0) # red clock adjustment time (in frames, sint32)
write_int32(rom, 0x180204, 0) # blue clock adjustment time (in frames, sint32) write_int32(rom, 0x180204, 0) # blue clock adjustment time (in frames, sint32)
@ -1111,7 +1111,7 @@ def patch_rom(world, rom, player, team, enemized):
rom.write_byte(0x18003B, 0x01 if world.mapshuffle[player] else 0x00) # maps showing crystals on overworld rom.write_byte(0x18003B, 0x01 if world.mapshuffle[player] else 0x00) # maps showing crystals on overworld
# compasses showing dungeon count # compasses showing dungeon count
if world.clock_mode[player] != 'off': if world.clock_mode[player]:
rom.write_byte(0x18003C, 0x00) # Currently must be off if timer is on, because they use same HUD location 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.compassshuffle[player]:
rom.write_byte(0x18003C, 0x01) # show on pickup rom.write_byte(0x18003C, 0x01) # show on pickup