remove suppress rom argument

This commit is contained in:
Fabian Dill 2021-05-13 01:40:36 +02:00
parent d5cdff5ec9
commit daa959e353
3 changed files with 117 additions and 121 deletions

4
Gui.py
View File

@ -428,7 +428,6 @@ def guiMain(args=None):
guiargs.fastmenu = rom_vars.fastMenuVar.get() guiargs.fastmenu = rom_vars.fastMenuVar.get()
guiargs.create_spoiler = bool(createSpoilerVar.get()) guiargs.create_spoiler = bool(createSpoilerVar.get())
guiargs.skip_playthrough = not bool(createSpoilerVar.get()) guiargs.skip_playthrough = not bool(createSpoilerVar.get())
guiargs.suppress_rom = bool(suppressRomVar.get())
guiargs.open_pyramid = openpyramidVar.get() guiargs.open_pyramid = openpyramidVar.get()
guiargs.mapshuffle = bool(mapshuffleVar.get()) guiargs.mapshuffle = bool(mapshuffleVar.get())
guiargs.compassshuffle = bool(compassshuffleVar.get()) guiargs.compassshuffle = bool(compassshuffleVar.get())
@ -513,7 +512,7 @@ def guiMain(args=None):
elif type(v) is dict: # use same settings for every player elif type(v) is dict: # use same settings for every player
setattr(guiargs, k, {player: getattr(guiargs, k) for player in range(1, guiargs.multi + 1)}) setattr(guiargs, k, {player: getattr(guiargs, k) for player in range(1, guiargs.multi + 1)})
try: try:
if not guiargs.suppress_rom and not os.path.exists(guiargs.rom): if not os.path.exists(guiargs.rom):
raise FileNotFoundError(f"Could not find specified rom file {guiargs.rom}") raise FileNotFoundError(f"Could not find specified rom file {guiargs.rom}")
if guiargs.count is not None: if guiargs.count is not None:
seed = guiargs.seed seed = guiargs.seed
@ -1204,7 +1203,6 @@ def guiMain(args=None):
setattr(args, k, v[1]) # only get values for player 1 for now setattr(args, k, v[1]) # only get values for player 1 for now
# load values from commandline args # load values from commandline args
createSpoilerVar.set(int(args.create_spoiler)) createSpoilerVar.set(int(args.create_spoiler))
suppressRomVar.set(int(args.suppress_rom))
mapshuffleVar.set(args.mapshuffle) mapshuffleVar.set(args.mapshuffle)
compassshuffleVar.set(args.compassshuffle) compassshuffleVar.set(args.compassshuffle)
keyshuffleVar.set(args.keyshuffle) keyshuffleVar.set(args.keyshuffle)

233
Main.py
View File

@ -416,140 +416,139 @@ def main(args, seed=None):
pool = concurrent.futures.ThreadPoolExecutor() pool = concurrent.futures.ThreadPoolExecutor()
multidata_task = None multidata_task = None
check_accessibility_task = pool.submit(world.fulfills_accessibility) check_accessibility_task = pool.submit(world.fulfills_accessibility)
if not args.suppress_rom:
rom_futures = [] rom_futures = []
mod_futures = [] mod_futures = []
for team in range(world.teams): for team in range(world.teams):
for player in world.alttp_player_ids: for player in world.alttp_player_ids:
rom_futures.append(pool.submit(_gen_rom, team, player)) rom_futures.append(pool.submit(_gen_rom, team, player))
for player in world.factorio_player_ids: for player in world.factorio_player_ids:
mod_futures.append(pool.submit(generate_mod, world, player, mod_futures.append(pool.submit(generate_mod, world, player,
str(args.outputname if args.outputname else world.seed))) str(args.outputname if args.outputname else world.seed)))
def get_entrance_to_region(region: Region): def get_entrance_to_region(region: Region):
for entrance in region.entrances: for entrance in region.entrances:
if entrance.parent_region.type in (RegionType.DarkWorld, RegionType.LightWorld): if entrance.parent_region.type in (RegionType.DarkWorld, RegionType.LightWorld):
return entrance return entrance
for entrance in region.entrances: # BFS might be better here, trying DFS for now. for entrance in region.entrances: # BFS might be better here, trying DFS for now.
return get_entrance_to_region(entrance.parent_region) return get_entrance_to_region(entrance.parent_region)
# collect ER hint info # collect ER hint info
er_hint_data = {player: {} for player in range(1, world.players + 1) if world.shuffle[player] != "vanilla" or world.retro[player]} er_hint_data = {player: {} for player in range(1, world.players + 1) if world.shuffle[player] != "vanilla" or world.retro[player]}
from worlds.alttp.Regions import RegionType from worlds.alttp.Regions import RegionType
for region in world.regions: for region in world.regions:
if region.player in er_hint_data and region.locations: if region.player in er_hint_data and region.locations:
main_entrance = get_entrance_to_region(region) main_entrance = get_entrance_to_region(region)
for location in region.locations: for location in region.locations:
if type(location.address) == int: # skips events and crystals if type(location.address) == int: # skips events and crystals
if lookup_vanilla_location_to_entrance[location.address] != main_entrance.name: if lookup_vanilla_location_to_entrance[location.address] != main_entrance.name:
er_hint_data[region.player][location.address] = main_entrance.name er_hint_data[region.player][location.address] = main_entrance.name
ordered_areas = ('Light World', 'Dark World', 'Hyrule Castle', 'Agahnims Tower', 'Eastern Palace', 'Desert Palace', ordered_areas = ('Light World', 'Dark World', 'Hyrule Castle', 'Agahnims Tower', 'Eastern Palace', 'Desert Palace',
'Tower of Hera', 'Palace of Darkness', 'Swamp Palace', 'Skull Woods', 'Thieves Town', 'Ice Palace', 'Tower of Hera', 'Palace of Darkness', 'Swamp Palace', 'Skull Woods', 'Thieves Town', 'Ice Palace',
'Misery Mire', 'Turtle Rock', 'Ganons Tower', "Total") 'Misery Mire', 'Turtle Rock', 'Ganons Tower', "Total")
checks_in_area = {player: {area: list() for area in ordered_areas} checks_in_area = {player: {area: list() for area in ordered_areas}
for player in range(1, world.players + 1)} for player in range(1, world.players + 1)}
for player in range(1, world.players + 1): for player in range(1, world.players + 1):
checks_in_area[player]["Total"] = 0 checks_in_area[player]["Total"] = 0
for location in [loc for loc in world.get_filled_locations() if type(loc.address) is int]: for location in [loc for loc in world.get_filled_locations() if type(loc.address) is int]:
main_entrance = get_entrance_to_region(location.parent_region) main_entrance = get_entrance_to_region(location.parent_region)
if location.game != Games.LTTP: if location.game != Games.LTTP:
checks_in_area[location.player]["Light World"].append(location.address) checks_in_area[location.player]["Light World"].append(location.address)
elif location.parent_region.dungeon: elif location.parent_region.dungeon:
dungeonname = {'Inverted Agahnims Tower': 'Agahnims Tower', dungeonname = {'Inverted Agahnims Tower': 'Agahnims Tower',
'Inverted Ganons Tower': 'Ganons Tower'}\ 'Inverted Ganons Tower': 'Ganons Tower'}\
.get(location.parent_region.dungeon.name, location.parent_region.dungeon.name) .get(location.parent_region.dungeon.name, location.parent_region.dungeon.name)
checks_in_area[location.player][dungeonname].append(location.address) checks_in_area[location.player][dungeonname].append(location.address)
elif main_entrance.parent_region.type == RegionType.LightWorld: elif main_entrance.parent_region.type == RegionType.LightWorld:
checks_in_area[location.player]["Light World"].append(location.address) checks_in_area[location.player]["Light World"].append(location.address)
elif main_entrance.parent_region.type == RegionType.DarkWorld: elif main_entrance.parent_region.type == RegionType.DarkWorld:
checks_in_area[location.player]["Dark World"].append(location.address) checks_in_area[location.player]["Dark World"].append(location.address)
checks_in_area[location.player]["Total"] += 1 checks_in_area[location.player]["Total"] += 1
oldmancaves = [] oldmancaves = []
takeanyregions = ["Old Man Sword Cave", "Take-Any #1", "Take-Any #2", "Take-Any #3", "Take-Any #4"] takeanyregions = ["Old Man Sword Cave", "Take-Any #1", "Take-Any #2", "Take-Any #3", "Take-Any #4"]
for index, take_any in enumerate(takeanyregions): for index, take_any in enumerate(takeanyregions):
for region in [world.get_region(take_any, player) for player in range(1, world.players + 1) if world.retro[player]]: for region in [world.get_region(take_any, player) for player in range(1, world.players + 1) if world.retro[player]]:
item = ItemFactory(region.shop.inventory[(0 if take_any == "Old Man Sword Cave" else 1)]['item'], region.player) item = ItemFactory(region.shop.inventory[(0 if take_any == "Old Man Sword Cave" else 1)]['item'], region.player)
player = region.player player = region.player
location_id = SHOP_ID_START + total_shop_slots + index location_id = SHOP_ID_START + total_shop_slots + index
main_entrance = get_entrance_to_region(region) main_entrance = get_entrance_to_region(region)
if main_entrance.parent_region.type == RegionType.LightWorld: if main_entrance.parent_region.type == RegionType.LightWorld:
checks_in_area[player]["Light World"].append(location_id) checks_in_area[player]["Light World"].append(location_id)
else: else:
checks_in_area[player]["Dark World"].append(location_id) checks_in_area[player]["Dark World"].append(location_id)
checks_in_area[player]["Total"] += 1 checks_in_area[player]["Total"] += 1
er_hint_data[player][location_id] = main_entrance.name er_hint_data[player][location_id] = main_entrance.name
oldmancaves.append(((location_id, player), (item.code, player))) oldmancaves.append(((location_id, player), (item.code, player)))
precollected_items = {player: [] for player in range(1, world.players+1)} precollected_items = {player: [] for player in range(1, world.players+1)}
for item in world.precollected_items: for item in world.precollected_items:
precollected_items[item.player].append(item.code) precollected_items[item.player].append(item.code)
FillDisabledShopSlots(world) FillDisabledShopSlots(world)
def write_multidata(roms, mods): def write_multidata(roms, mods):
import base64 import base64
for future in roms: for future in roms:
rom_name = future.result() rom_name = future.result()
rom_names.append(rom_name) rom_names.append(rom_name)
slot_data = {} slot_data = {}
client_versions = {} client_versions = {}
minimum_versions = {"server": (0, 1, 1), "clients": client_versions} minimum_versions = {"server": (0, 1, 1), "clients": client_versions}
games = {} games = {}
for slot in world.player_ids: for slot in world.player_ids:
client_versions[slot] = (0, 0, 3) client_versions[slot] = (0, 0, 3)
games[slot] = world.game[slot] games[slot] = world.game[slot]
connect_names = {base64.b64encode(rom_name).decode(): (team, slot) for connect_names = {base64.b64encode(rom_name).decode(): (team, slot) for
slot, team, rom_name in rom_names} slot, team, rom_name in rom_names}
for i, team in enumerate(parsed_names): for i, team in enumerate(parsed_names):
for player, name in enumerate(team, 1): for player, name in enumerate(team, 1):
if player not in world.alttp_player_ids: if player not in world.alttp_player_ids:
connect_names[name] = (i, player) connect_names[name] = (i, player)
for slot in world.hk_player_ids: for slot in world.hk_player_ids:
slots_data = slot_data[slot] = {} slots_data = slot_data[slot] = {}
for option_name in Options.hollow_knight_options: for option_name in Options.hollow_knight_options:
option = getattr(world, option_name)[slot] option = getattr(world, option_name)[slot]
slots_data[option_name] = int(option.value) slots_data[option_name] = int(option.value)
for slot in world.minecraft_player_ids: for slot in world.minecraft_player_ids:
slot_data[slot] = fill_minecraft_slot_data(world, slot) slot_data[slot] = fill_minecraft_slot_data(world, slot)
locations_data: Dict[int, Dict[int, Tuple[int, int]]] = {player: {} for player in world.player_ids} locations_data: Dict[int, Dict[int, Tuple[int, int]]] = {player: {} for player in world.player_ids}
for location in world.get_filled_locations(): for location in world.get_filled_locations():
if type(location.address) == int: if type(location.address) == int:
locations_data[location.player][location.address] = (location.item.code, location.item.player) locations_data[location.player][location.address] = (location.item.code, location.item.player)
multidata = zlib.compress(pickle.dumps({ multidata = zlib.compress(pickle.dumps({
"slot_data" : slot_data, "slot_data" : slot_data,
"games": games, "games": games,
"names": parsed_names, "names": parsed_names,
"connect_names": connect_names, "connect_names": connect_names,
"remote_items": {player for player in range(1, world.players + 1) if "remote_items": {player for player in range(1, world.players + 1) if
world.remote_items[player]}, world.remote_items[player]},
"locations": locations_data, "locations": locations_data,
"checks_in_area": checks_in_area, "checks_in_area": checks_in_area,
"server_options": get_options()["server_options"], "server_options": get_options()["server_options"],
"er_hint_data": er_hint_data, "er_hint_data": er_hint_data,
"precollected_items": precollected_items, "precollected_items": precollected_items,
"version": tuple(_version_tuple), "version": tuple(_version_tuple),
"tags": ["AP"], "tags": ["AP"],
"minimum_versions": minimum_versions, "minimum_versions": minimum_versions,
"seed_name": str(args.outputname if args.outputname else world.seed) "seed_name": str(args.outputname if args.outputname else world.seed)
}), 9) }), 9)
with open(output_path('%s.archipelago' % outfilebase), 'wb') as f: with open(output_path('%s.archipelago' % outfilebase), 'wb') as f:
f.write(bytes([1])) # version of format f.write(bytes([1])) # version of format
f.write(multidata) f.write(multidata)
for future in mods: for future in mods:
future.result() # collect errors if they occured future.result() # collect errors if they occured
multidata_task = pool.submit(write_multidata, rom_futures, mod_futures) multidata_task = pool.submit(write_multidata, rom_futures, mod_futures)
if not check_accessibility_task.result(): if not check_accessibility_task.result():
if not world.can_beat_game(): if not world.can_beat_game():
raise Exception("Game appears as unbeatable. Aborting.") raise Exception("Game appears as unbeatable. Aborting.")

View File

@ -313,7 +313,6 @@ def parse_arguments(argv, no_defaults=False):
Alternatively, can be a ALttP Rom patched with a Link Alternatively, can be a ALttP Rom patched with a Link
sprite that will be extracted. sprite that will be extracted.
''') ''')
parser.add_argument('--suppress_rom', help='Do not create an output rom file.', action='store_true')
parser.add_argument('--gui', help='Launch the GUI', action='store_true') parser.add_argument('--gui', help='Launch the GUI', action='store_true')
parser.add_argument('--progression_balancing', action='store_true', default=defval(False), parser.add_argument('--progression_balancing', action='store_true', default=defval(False),
help="Enable Multiworld Progression balancing.") help="Enable Multiworld Progression balancing.")