diff --git a/Adjuster.py b/Adjuster.py index 661381a9..f98f38fa 100755 --- a/Adjuster.py +++ b/Adjuster.py @@ -27,6 +27,7 @@ def main(): ''') parser.add_argument('--quickswap', help='Enable quick item swapping with L and R.', action='store_true') parser.add_argument('--disablemusic', help='Disables game music.', action='store_true') + parser.add_argument('--enableflashing', help='Reenable flashing animations (unfriendly to epilepsy, always disabled in race roms)', action='store_false', dest="reduceflashing") parser.add_argument('--heartbeep', default='normal', const='normal', nargs='?', choices=['double', 'normal', 'half', 'quarter', 'off'], help='''\ Select the rate at which the heart beep sound is played at diff --git a/AdjusterMain.py b/AdjusterMain.py index f26c669b..fa770b51 100644 --- a/AdjusterMain.py +++ b/AdjusterMain.py @@ -28,9 +28,10 @@ def adjust(args): palettes_options['sword']=args.sword_palettes palettes_options['shield']=args.shield_palettes # palettes_options['link']=args.link_palettesvera + racerom = rom.read_byte(0x180213) > 0 apply_rom_settings(rom, args.heartbeep, args.heartcolor, args.quickswap, args.fastmenu, args.disablemusic, - args.sprite, palettes_options) + args.sprite, palettes_options, reduceflashing=args.reduceflashing if not racerom else True) path = output_path(f'{os.path.basename(args.rom)[:-4]}_adjusted.sfc') rom.write_to_file(path) diff --git a/EntranceRandomizer.py b/EntranceRandomizer.py index f8404fe7..022bd96d 100755 --- a/EntranceRandomizer.py +++ b/EntranceRandomizer.py @@ -251,6 +251,7 @@ def parse_arguments(argv, no_defaults=False): ''') parser.add_argument('--quickswap', help='Enable quick item swapping with L and R.', action='store_true') parser.add_argument('--disablemusic', help='Disables game music.', action='store_true') + parser.add_argument('--enableflashing', help='Reenable flashing animations (unfriendly to epilepsy, always disabled in race roms)', action='store_false', dest="reduceflashing") parser.add_argument('--mapshuffle', default=defval(False), help='Maps are no longer restricted to their dungeons, but can be anywhere', action='store_true') @@ -410,7 +411,7 @@ def parse_arguments(argv, no_defaults=False): "plando_items", "plando_texts", "plando_connections", 'remote_items', 'progressive', 'dungeon_counters', 'glitch_boots', 'killable_thieves', 'tile_shuffle', 'bush_shuffle', 'shuffle_prizes', 'sprite_pool', 'dark_room_logic', - 'restrict_dungeon_item_on_boss', + 'restrict_dungeon_item_on_boss', 'reduceflashing', 'hud_palettes', 'sword_palettes', 'shield_palettes', 'link_palettes']: value = getattr(defaults, name) if getattr(playerargs, name) is None else getattr(playerargs, name) if player == 1: diff --git a/Gui.py b/Gui.py index 19c62a85..86a71db7 100755 --- a/Gui.py +++ b/Gui.py @@ -130,6 +130,10 @@ def guiMain(args=None): disableMusicCheckbutton = Checkbutton(romOptionsFrame, text="Disable music", variable=disableMusicVar) disableMusicCheckbutton.grid(row=0, column=0, sticky=E) + disableFlashingVar = IntVar(value=1) + disableFlashingCheckbutton = Checkbutton(romOptionsFrame, text="Disable flashing (anti-epilepsy)", variable=disableFlashingVar) + disableFlashingCheckbutton.grid(row=6, column=0, sticky=E) + spriteDialogFrame = Frame(romOptionsFrame) spriteDialogFrame.grid(row=0, column=1) baseSpriteLabel = Label(spriteDialogFrame, text='Sprite:') @@ -241,7 +245,7 @@ def guiMain(args=None): romDialogFrame = Frame(romOptionsFrame) - romDialogFrame.grid(row=6, column=0, columnspan=2, sticky=W+E) + romDialogFrame.grid(row=7, column=0, columnspan=2, sticky=W+E) baseRomLabel = Label(romDialogFrame, text='Base Rom: ') romVar = StringVar(value="Zelda no Densetsu - Kamigami no Triforce (Japan).sfc") @@ -577,6 +581,7 @@ def guiMain(args=None): guiargs.retro = bool(retroVar.get()) guiargs.quickswap = bool(quickSwapVar.get()) guiargs.disablemusic = bool(disableMusicVar.get()) + guiargs.reduceflashing = bool(disableFlashingVar.get()) guiargs.ow_palettes = owPalettesVar.get() guiargs.uw_palettes = uwPalettesVar.get() guiargs.hud_palettes = hudPalettesVar.get() @@ -697,9 +702,11 @@ def guiMain(args=None): quickSwapCheckbutton2 = Checkbutton(checkBoxFrame2, text="L/R Item quickswapping", variable=quickSwapVar) disableMusicCheckbutton2 = Checkbutton(checkBoxFrame2, text="Disable game music", variable=disableMusicVar) + disableFlashingCheckbutton2 = Checkbutton(checkBoxFrame2, text="Disable flashing (anti-epilepsy)", variable=disableFlashingVar) quickSwapCheckbutton2.pack(expand=True, anchor=W) disableMusicCheckbutton2.pack(expand=True, anchor=W) + disableFlashingCheckbutton2.pack(expand=True, anchor=W) fileDialogFrame2 = Frame(rightHalfFrame2) @@ -808,6 +815,7 @@ def guiMain(args=None): guiargs.shield_palettes = shieldPalettesVar.get() guiargs.quickswap = bool(quickSwapVar.get()) guiargs.disablemusic = bool(disableMusicVar.get()) + guiargs.reduceflashing = bool(disableFlashingVar.get()) guiargs.rom = romVar2.get() guiargs.baserom = romVar.get() guiargs.sprite = sprite @@ -1492,6 +1500,7 @@ def guiMain(args=None): retroVar.set(args.retro) quickSwapVar.set(int(args.quickswap)) disableMusicVar.set(int(args.disablemusic)) + disableFlashingVar.set(int(args.reduceflashing)) if args.count: countVar.set(str(args.count)) if args.seed: diff --git a/Main.py b/Main.py index fcd21c9a..2d22db67 100644 --- a/Main.py +++ b/Main.py @@ -259,7 +259,7 @@ def main(args, seed=None): apply_rom_settings(rom, args.heartbeep[player], args.heartcolor[player], args.quickswap[player], args.fastmenu[player], args.disablemusic[player], args.sprite[player], - palettes_options, world, player, True) + palettes_options, world, player, True, reduceflashing=args.reduceflashing[player] if not args.race else True) mcsb_name = '' if all([world.mapshuffle[player], world.compassshuffle[player], world.keyshuffle[player], diff --git a/Mystery.py b/Mystery.py index 2041294b..92ab4182 100644 --- a/Mystery.py +++ b/Mystery.py @@ -691,6 +691,7 @@ def roll_settings(weights: dict, plando_options: typing.Set[str] = frozenset(("b ret.disablemusic = get_choice('disablemusic', romweights, False) ret.quickswap = get_choice('quickswap', romweights, True) ret.fastmenu = get_choice('menuspeed', romweights, "normal") + ret.reduceflashing = get_choice('reduceflashing', romweights, False) ret.heartcolor = get_choice('heartcolor', romweights, "red") ret.heartbeep = convert_to_on_off(get_choice('heartbeep', romweights, "normal")) ret.ow_palettes = get_choice('ow_palettes', romweights, "default") diff --git a/Rom.py b/Rom.py index 285b7e52..e7c664df 100644 --- a/Rom.py +++ b/Rom.py @@ -1672,7 +1672,7 @@ def hud_format_text(text): def apply_rom_settings(rom, beep, color, quickswap, fastmenu, disable_music, sprite: str, palettes_options, - world=None, player=1, allow_random_on_event=False): + world=None, player=1, allow_random_on_event=False, reduceflashing=False): local_random = random if not world else world.rom_seeds[player] # enable instant item menu @@ -1697,6 +1697,23 @@ def apply_rom_settings(rom, beep, color, quickswap, fastmenu, disable_music, spr else: rom.write_byte(0x180048, 0x08) + + # Reduce flashing by nopping out instructions + if reduceflashing: + rom.write_bytes(0x17E07, [0x06]) # reduce amount of colors changed, add this branch if we need to reduce more ""+ [0x80] + [(0x81-0x08)]"" + rom.write_bytes(0x17EAB, [0xD0, 0x03, 0xA9, 0x40, 0x29, 0x60]) # nullifies aga lightning, cutscene, vitreous, bat, ether + # ONLY write to black values with this low pale blue to indicate flashing, that's IT. ""BNE + : LDA #$2940 : + : RTS"" + rom.write_bytes(0x123FE, [0x72]) # set lightning flash in misery mire (and standard) to brightness 0x72 + rom.write_bytes(0x3FA7B, [0x80, 0xac-0x7b]) # branch from palette writing lightning on death mountain + rom.write_byte(0x10817F, 0x01) # internal rom option + else: + rom.write_bytes(0x17E07, [0x00]) + rom.write_bytes(0x17EAB, [0x85, 0x00, 0x29, 0x1F, 0x00, 0x18]) + rom.write_bytes(0x123FE, [0x32]) # original weather flash value + rom.write_bytes(0x3FA7B, [0xc2, 0x20]) # rep #$20 + rom.write_byte(0x10817F, 0x00) # internal rom option + + rom.write_byte(0x18004B, 0x01 if quickswap else 0x00) rom.write_byte(0x0CFE18, 0x00 if disable_music else rom.orig_buffer[0x0CFE18] if rom.orig_buffer else 0x70) diff --git a/WebHostLib/static/static/weightedSettings.json b/WebHostLib/static/static/weightedSettings.json index b6e1b7cb..d118c4bd 100644 --- a/WebHostLib/static/static/weightedSettings.json +++ b/WebHostLib/static/static/weightedSettings.json @@ -1602,6 +1602,26 @@ } } }, + "reduceflashing": { + "keyString": "rom.reduceflashing", + "friendlyName": "Reduce Flashing", + "description": "Disable the amount of flashing effects in-game", + "inputType": "range", + "subOptions": { + "on": { + "keyString": "rom.reduceflashing.on", + "friendlyName": "Disabled", + "description": "Disables flashing.", + "defaultValue": 50 + }, + "off": { + "keyString": "rom.reduceflashing.off", + "friendlyName": "Enabled", + "description": "Enables flashing.", + "defaultValue": 0 + } + } + }, "quickswap": { "keyString": "rom.quickswap", "friendlyName": "Item Quick-Swap", diff --git a/playerSettings.yaml b/playerSettings.yaml index f911f766..f212f49c 100644 --- a/playerSettings.yaml +++ b/playerSettings.yaml @@ -401,6 +401,9 @@ rom: quickswap: # Enable switching items by pressing the L+R shoulder buttons on: 50 off: 0 + reduceflashing: # Reduces instances of flashing such as lightning attacks, weather, ether and more. + on: 50 + off: 0 menuspeed: # Controls how fast the item menu opens and closes normal: 50 instant: 0