From 1f12c60cc2152a9be5c2509fb0b60327e1de23ff Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Sun, 30 Aug 2020 15:57:26 +0200 Subject: [PATCH] update maseya z3pr handling to latest version --- Rom.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Rom.py b/Rom.py index 23e923d4..c3b3a80e 100644 --- a/Rom.py +++ b/Rom.py @@ -29,6 +29,7 @@ import Patch try: from maseya import z3pr + from maseya.z3pr.palette_randomizer import build_offsets_array except: z3pr = None @@ -1510,14 +1511,16 @@ def apply_rom_settings(rom, beep, color, quickswap, fastmenu, disable_music, spr "randomize_overworld": ow_palettes == 'random' } if any(options.values()): + data_dir = local_path("data") if is_bundled() else None + offsets_array = build_offsets_array(options, data_dir) + ColorF = z3pr.ColorF - data_dir = local_path("data") if is_bundled() else None + def next_color_generator(): + while True: + yield ColorF(local_random.random(), local_random.random(), local_random.random()) - def next_color(): - return ColorF(local_random.random(), local_random.random(), local_random.random()) - - z3pr.randomize(rom.buffer, "maseya", next_color, options, data_dir) + z3pr.randomize(rom.buffer, "maseya", offsets_iterator=offsets_array, color_generator=next_color_generator()) else: logging.warning("Could not find z3pr palette shuffle. " "If you want improved palette shuffling please install the maseya-z3pr package.")