Removes Flashing instances in game (#168)

* Added reduced flashing, triforce hud and cutscene options

* Corrected parameters and replacement order

* Mixed up rom byte

* Removed triforce hud, smoothed cutscene speed and reset tables

* Removed triforcehud line and added bird cutscene speedup

* Added options to yaml

* Added check for race rom generation (is not internal asm)

* Added options to GUI (check sprite adjust crash)

* Fixed inconsistency in setting weight

* A "slow" setting for the cutscenespeed (#1)

* Slow wall setting

* Slow wall setting

* Slow wall setting

* Slow wall setting

* Slow wall setting

* Slow wall setting

* Update playerSettings.yaml

* Remove instances of cutscene speed modification

* Changed command to remove to mitigate frame advantage

* Antiepilepsy enabled for default/race roms, param change, RTL byte

* Found a frame independent antiflashing patch for real

* Further ASM patching style

* Reduce these changes to just two bytes

* Added patches for Dark Mountain and Ether Flashing palette reveal

Co-authored-by: StructuralMike <66819228+StructuralMike@users.noreply.github.com>
This commit is contained in:
pepperpow 2021-02-19 10:45:54 -06:00 committed by GitHub
parent 68c639d798
commit fca64f1177
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 58 additions and 5 deletions

View File

@ -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

View File

@ -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)

View File

@ -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:

11
Gui.py
View File

@ -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:

View File

@ -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],

View File

@ -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")

19
Rom.py
View File

@ -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)

View File

@ -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",

View File

@ -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