Sprite author credit

Reduce flashing option
This commit is contained in:
aerinon
2021-06-07 11:13:28 -06:00
parent c45dab6a7c
commit 23ffc61667
13 changed files with 57 additions and 12 deletions

View File

@@ -35,6 +35,7 @@ def main():
help='Select the color of Link\'s heart meter. (default: %(default)s)') help='Select the color of Link\'s heart meter. (default: %(default)s)')
parser.add_argument('--ow_palettes', default='default', choices=['default', 'random', 'blackout']) parser.add_argument('--ow_palettes', default='default', choices=['default', 'random', 'blackout'])
parser.add_argument('--uw_palettes', default='default', choices=['default', 'random', 'blackout']) parser.add_argument('--uw_palettes', default='default', choices=['default', 'random', 'blackout'])
parser.add_argument('--reduce_flashing', help='Reduce some in-game flashing.', action='store_true')
parser.add_argument('--sprite', help='''\ parser.add_argument('--sprite', help='''\
Path to a sprite sheet to use for Link. Needs to be in Path to a sprite sheet to use for Link. Needs to be in
binary format and have a length of 0x7000 (28672) bytes, binary format and have a length of 0x7000 (28672) bytes,

View File

@@ -24,7 +24,8 @@ def adjust(args):
if not hasattr(args,"sprite"): if not hasattr(args,"sprite"):
args.sprite = None args.sprite = None
apply_rom_settings(rom, args.heartbeep, args.heartcolor, args.quickswap, args.fastmenu, args.disablemusic, args.sprite, args.ow_palettes, args.uw_palettes) apply_rom_settings(rom, args.heartbeep, args.heartcolor, args.quickswap, args.fastmenu, args.disablemusic,
args.sprite, args.ow_palettes, args.uw_palettes, args.reduce_flashing)
rom.write_to_file(output_path('%s.sfc' % outfilebase)) rom.write_to_file(output_path('%s.sfc' % outfilebase))

4
CLI.py
View File

@@ -101,7 +101,8 @@ def parse_cli(argv, no_defaults=False):
'retro', 'accessibility', 'hints', 'beemizer', 'experimental', 'dungeon_counters', 'retro', 'accessibility', 'hints', 'beemizer', 'experimental', 'dungeon_counters',
'shufflebosses', 'shuffleenemies', 'enemy_health', 'enemy_damage', 'shufflepots', 'shufflebosses', 'shuffleenemies', 'enemy_health', 'enemy_damage', 'shufflepots',
'ow_palettes', 'uw_palettes', 'sprite', 'disablemusic', 'quickswap', 'fastmenu', 'heartcolor', 'heartbeep', 'ow_palettes', 'uw_palettes', 'sprite', 'disablemusic', 'quickswap', 'fastmenu', 'heartcolor', 'heartbeep',
'remote_items', 'shopsanity', 'keydropshuffle', 'mixed_travel', 'standardize_palettes', 'code']: 'remote_items', 'shopsanity', 'keydropshuffle', 'mixed_travel', 'standardize_palettes', 'code',
'reduce_flashing']:
value = getattr(defaults, name) if getattr(playerargs, name) is None else getattr(playerargs, name) value = getattr(defaults, name) if getattr(playerargs, name) is None else getattr(playerargs, name)
if player == 1: if player == 1:
setattr(ret, name, {1: value}) setattr(ret, name, {1: value})
@@ -187,6 +188,7 @@ def parse_settings():
"fastmenu": "normal", "fastmenu": "normal",
"ow_palettes": "default", "ow_palettes": "default",
"uw_palettes": "default", "uw_palettes": "default",
"reduce_flashing": False,
# Spoiler defaults to TRUE # Spoiler defaults to TRUE
# Playthrough defaults to TRUE # Playthrough defaults to TRUE

View File

@@ -27,7 +27,7 @@ from Fill import sell_potions, sell_keys, balance_multiworld_progression, balanc
from ItemList import generate_itempool, difficulties, fill_prizes, customize_shops from ItemList import generate_itempool, difficulties, fill_prizes, customize_shops
from Utils import output_path, parse_player_names from Utils import output_path, parse_player_names
__version__ = '0.4.0.6-u' __version__ = '0.4.0.7-u'
class EnemizerError(RuntimeError): class EnemizerError(RuntimeError):
@@ -280,7 +280,9 @@ def main(args, seed=None, fish=None):
rom_names.append((player, team, list(rom.name))) rom_names.append((player, team, list(rom.name)))
world.spoiler.hashes[(player, team)] = get_hash_string(rom.hash) world.spoiler.hashes[(player, team)] = get_hash_string(rom.hash)
apply_rom_settings(rom, args.heartbeep[player], args.heartcolor[player], args.quickswap[player], args.fastmenu[player], args.disablemusic[player], args.sprite[player], args.ow_palettes[player], args.uw_palettes[player]) apply_rom_settings(rom, args.heartbeep[player], args.heartcolor[player], args.quickswap[player],
args.fastmenu[player], args.disablemusic[player], args.sprite[player],
args.ow_palettes[player], args.uw_palettes[player], args.reduce_flashing[player])
if args.jsonout: if args.jsonout:
jsonout[f'patch_t{team}_p{player}'] = rom.patches jsonout[f'patch_t{team}_p{player}'] = rom.patches

View File

@@ -14,6 +14,9 @@ Thanks to qadan, cheuer, & compiling
# Bug Fixes and Notes. # Bug Fixes and Notes.
* 0.4.0.7
* Reduce flashing option added
* Sprite author credit added
* 0.4.0.6 * 0.4.0.6
* Hints now default to off * Hints now default to off
* The maiden gives you a hint to the attic if you bring her to the unlit boss room * The maiden gives you a hint to the attic if you bring her to the unlit boss room

31
Rom.py
View File

@@ -495,8 +495,6 @@ class Sprite(object):
sprite_name = read_utf16le(stream) sprite_name = read_utf16le(stream)
author_name = read_utf16le(stream) author_name = read_utf16le(stream)
# Ignoring the Author Rom name for the time being.
real_csum = sum(filedata) % 0x10000 real_csum = sum(filedata) % 0x10000
if real_csum != csum or real_csum ^ 0xFFFF != icsum: if real_csum != csum or real_csum ^ 0xFFFF != icsum:
logger.warning('ZSPR file has incorrect checksum. It may be corrupted.') logger.warning('ZSPR file has incorrect checksum. It may be corrupted.')
@@ -1638,7 +1636,8 @@ def hud_format_text(text):
return output[:32] return output[:32]
def apply_rom_settings(rom, beep, color, quickswap, fastmenu, disable_music, sprite, ow_palettes, uw_palettes): def apply_rom_settings(rom, beep, color, quickswap, fastmenu, disable_music, sprite,
ow_palettes, uw_palettes, reduce_flashing):
if sprite and not isinstance(sprite, Sprite): if sprite and not isinstance(sprite, Sprite):
sprite = Sprite(sprite) if os.path.isfile(sprite) else get_sprite_from_name(sprite) sprite = Sprite(sprite) if os.path.isfile(sprite) else get_sprite_from_name(sprite)
@@ -1695,6 +1694,32 @@ def apply_rom_settings(rom, beep, color, quickswap, fastmenu, disable_music, spr
if sprite is not None: if sprite is not None:
write_sprite(rom, sprite) write_sprite(rom, sprite)
# sprite author credits
padded_author = sprite.author_name if sprite is not None else "Nintendo"
padded_author = padded_author[:28] if len(padded_author) > 28 else padded_author
padded_author = padded_author.center(28).upper()
def convert_char_to_credits(char):
char_map = {
" ": (0x9F, 0x9F), "0": (0x53, 0x79), "1": (0x54, 0x7A), "2": (0x55, 0x7B), "3": (0x56, 0x7C),
"4": (0x57, 0x7D), "5": (0x58, 0x7E), "6": (0x59, 0x7F), "7": (0x5A, 0x80), "8": (0x5B, 0x81),
"9": (0x5C, 0x82), "A": (0x5D, 0x83), "B": (0x5E, 0x84), "C": (0x5F, 0x85), "D": (0x60, 0x86),
"E": (0x61, 0x87), "F": (0x62, 0x88), "G": (0x63, 0x89), "H": (0x64, 0x8A), "I": (0x65, 0x8B),
"J": (0x66, 0x8C), "K": (0x67, 0x8D), "L": (0x68, 0x8E), "M": (0x69, 0x8F), "N": (0x6A, 0x90),
"O": (0x6B, 0x91), "P": (0x6C, 0x92), "Q": (0x6D, 0x93), "R": (0x6E, 0x94), "S": (0x6F, 0x95),
"T": (0x70, 0x96), "U": (0x71, 0x97), "V": (0x72, 0x98), "W": (0x73, 0x99), "X": (0x74, 0x9A),
"Y": (0x75, 0x9B), "Z": (0x76, 0x9C), "'": (0x77, 0x9d), ".": (0xA0, 0xC0), "/": (0xA2, 0xC2),
":": (0xA3, 0xC3), "_": (0xA6, 0xC6)}
return char_map[char] if char in char_map else (0x9F, 0x9F)
character_bytes = map(convert_char_to_credits, padded_author)
for i, pair in enumerate(character_bytes):
rom.write_byte(0x118002 + i, pair[0])
rom.write_byte(0x118020 + i, pair[1])
if reduce_flashing:
rom.write_byte(0x18017f, 1)
default_ow_palettes(rom) default_ow_palettes(rom)
if ow_palettes == 'random': if ow_palettes == 'random':
randomize_ow_palettes(rom) randomize_ow_palettes(rom)

View File

@@ -195,6 +195,10 @@
"action": "store_true", "action": "store_true",
"type": "bool" "type": "bool"
}, },
"reduce_flashing": {
"action": "store_true",
"type": "bool"
},
"mapshuffle": { "mapshuffle": {
"action": "store_true", "action": "store_true",
"type": "bool" "type": "bool"

View File

@@ -278,7 +278,7 @@
"Include the Ganon's Tower and Pyramid Hole in the", "Include the Ganon's Tower and Pyramid Hole in the",
"entrance shuffle pool. (default: %(default)s)" "entrance shuffle pool. (default: %(default)s)"
], ],
"shufflelink": [ "shufflelinks": [
"Include Link's House in the entrance shuffle pool. (default: %(default)s)" "Include Link's House in the entrance shuffle pool. (default: %(default)s)"
], ],
"heartbeep": [ "heartbeep": [
@@ -293,6 +293,7 @@
"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."
], ],
"reduce_flashing": [ "Reduce some in-game flashing (default: %(default)s)" ],
"create_rom": [ "Create an output rom file. (default: %(default)s)" ], "create_rom": [ "Create an output rom file. (default: %(default)s)" ],
"gui": [ "Launch the GUI. (default: %(default)s)" ], "gui": [ "Launch the GUI. (default: %(default)s)" ],
"jsonout": [ "jsonout": [

View File

@@ -1,7 +1,8 @@
{ {
"checkboxes": { "checkboxes": {
"nobgm": { "type": "checkbox" }, "nobgm": { "type": "checkbox" },
"quickswap": { "type": "checkbox" } "quickswap": { "type": "checkbox" },
"reduce_flashing": {"type": "checkbox"}
}, },
"leftAdjustFrame": { "leftAdjustFrame": {
"heartcolor": { "heartcolor": {

View File

@@ -2,6 +2,7 @@
"gui": { "gui": {
"adjust.nobgm": "Disable Music & MSU-1", "adjust.nobgm": "Disable Music & MSU-1",
"adjust.quickswap": "L/R Quickswapping", "adjust.quickswap": "L/R Quickswapping",
"adjust.reduce_flashing": "Reduce Flashing",
"adjust.heartcolor": "Heart Color", "adjust.heartcolor": "Heart Color",
"adjust.heartcolor.red": "Red", "adjust.heartcolor.red": "Red",
@@ -131,6 +132,7 @@
"randomizer.gameoptions.nobgm": "Disable Music & MSU-1", "randomizer.gameoptions.nobgm": "Disable Music & MSU-1",
"randomizer.gameoptions.quickswap": "L/R Quickswapping", "randomizer.gameoptions.quickswap": "L/R Quickswapping",
"randomizer.gameoptions.reduce_flashing": "Reduce Flashing",
"randomizer.gameoptions.heartcolor": "Heart Color", "randomizer.gameoptions.heartcolor": "Heart Color",
"randomizer.gameoptions.heartcolor.red": "Red", "randomizer.gameoptions.heartcolor.red": "Red",

View File

@@ -1,7 +1,8 @@
{ {
"checkboxes": { "checkboxes": {
"nobgm": { "type": "checkbox" }, "nobgm": { "type": "checkbox" },
"quickswap": { "type": "checkbox" } "quickswap": { "type": "checkbox" },
"reduce_flashing": {"type": "checkbox"}
}, },
"leftRomOptionsFrame": { "leftRomOptionsFrame": {
"heartcolor": { "heartcolor": {

View File

@@ -105,7 +105,8 @@ SETTINGSTOPROCESS = {
"heartbeep": "heartbeep", "heartbeep": "heartbeep",
"menuspeed": "fastmenu", "menuspeed": "fastmenu",
"owpalettes": "ow_palettes", "owpalettes": "ow_palettes",
"uwpalettes": "uw_palettes" "uwpalettes": "uw_palettes",
"reduce_flashing": "reduce_flashing"
}, },
"generation": { "generation": {
"createspoiler": "create_spoiler", "createspoiler": "create_spoiler",

View File

@@ -101,7 +101,8 @@ def adjust_page(top, parent, settings):
"owpalettes": "ow_palettes", "owpalettes": "ow_palettes",
"uwpalettes": "uw_palettes", "uwpalettes": "uw_palettes",
"quickswap": "quickswap", "quickswap": "quickswap",
"nobgm": "disablemusic" "nobgm": "disablemusic",
"reduce_flashing": "reduce_flashing",
} }
guiargs = Namespace() guiargs = Namespace()
for option in options: for option in options: