 51c38fc628
			
		
	
	51c38fc628
	
	
	
		
			
			* first commit (not including OoT data files yet) * added some basic options * rule parser works now at least * make sure to commit everything this time * temporary change to BaseClasses for oot * overworld location graph builds mostly correctly * adding oot data files * commenting out world options until later since they only existed to make the RuleParser work * conversion functions between AP ids and OOT ids * world graph outputs * set scrub prices * itempool generates, entrances connected, way too many options added * fixed set_rules and set_shop_rules * temp baseclasses changes * Reaches the fill step now, old event-based system retained in case the new way breaks * Song placements and misc fixes everywhere * temporary changes to make oot work * changed root exits for AP fill framework * prevent infinite recursion due to OoT sharing usage of the address field * age reachability works hopefully, songs are broken again * working spoiler log generation on beatable-only * Logic tricks implemented * need this for logic tricks * fixed map/compass being placed on Serenade location * kill unreachable events before filling the world * add a bunch of utility functions to prepare for rom patching * move OptionList into generic options * fixed some silly bugs with OptionList * properly seed all random behavior (so far) * ROM generation working * fix hints trying to get alttp dungeon hint texts * continue fixing hints * add oot to network data package * change item and location IDs to 66000 and 67000 range respectively * push removed items to precollected items * fixed various issues with cross-contamination with multiple world generation * reenable glitched logic (hopefully) * glitched world files age-check fix * cleaned up some get_locations calls * added token shuffle and scrub shuffle, modified some options slightly to make the parsing work * reenable MQ dungeons * fix forest mq exception * made targeting style an option for now, will be cosmetic later * reminder to move targeting to cosmetics * some oot option maintenance * enabled starting time of day * fixed issue breaking shop slots in multiworld generation * added "off" option for text shuffle and hints * shopsanity functionality restored * change patch file extension * remove unnecessary utility functions + imports * update MIT license * change option to "patch_uncompressed_rom" instead of "compress_rom" * compliance with new AutoWorld systems * Kill only internal events, remove non-internal big poe event in code * re-add the big poe event and handle it correctly * remove extra method in Range option * fix typo * Starting items, starting with consumables option * do not remove nonexistent item * move set_shop_rules to after shop items are placed * some cleanup * add retries for song placement * flagged Skull Mask and Mask of Truth as advancement items * update OoT to use LogicMixin * Fixed trying to assign starting items from the wrong players * fixed song retry step * improved option handling, comments, and starting item replacements * DefaultOnToggle writes Yes or No to spoiler * enable compression of output if Compress executable is present * clean up compression * check whether (de)compressor exists before running the process * allow specification of rom path in host.yaml * check if decompressed file already exists before decompressing again * fix triforce hunt generation * rename all the oot state functions with prefix * OoT: mark triforce pieces as completion goal for triforce hunt * added overworld and any-dungeon shuffle for dungeon items * Hide most unshuffled locations and events from the list of locations in spoiler * build oot option ranges with a generic function instead of defining each separately * move oot output-type control to host.yaml instead of individual yamls * implement dungeon song shuffle * minor improvements to overworld dungeon item shuffle * remove random ice trap names in shops, mostly to avoid maintaining a massive censor list * always output patch file to folder, remove option to generate ROM in preparation for removal * re-add the fix for infinite recursion due to not being light or dark world * change AP-sendable to Ocarina of Time model, since the triforce piece has some extra code apparently * oot: remove item_names and location_names * oot: minor fixes * oot: comment out ROM patching * oot: only add CollectionState objects on creation if actually needed * main entrance shuffle method and entrances-based rules * fix entrances based rules * disable master quest and big poe count options for client compatibility * use get_player_name instead of get_player_names * fix OptionList * fix oot options for new option system * new coop section in oot rom: expand player names to 16 bytes, write AP_PLAYER_NAME at end of PLAYER_NAMES * fill AP player name in oot rom with 0 instead of 0xDF * encode player name with ASCII for fixed-width * revert oot player name array to 8 bytes per name * remove Pierre location if fast scarecrow is on * check player name length * "free_scarecrow" not "fast_scarecrow" * OoT locations now properly store the AP ID instead of the oot internal ID * oot __version__ updates in lockstep with AP version * pull in unmodified oot cosmetic files * also grab JSONDump since it's needed apparently * gather extra needed methods, modify imports * delete cosmetics log, replace all instances of SettingsList with OOTWorld * cosmetic options working, except for sound effects (due to ear-safe issues) * SFX, Music, and Fanfare randomization reenabled * move OoT data files into the worlds folder * move Compress and Decompress into oot data folder * Replace get_all_state with custom method to avoid the cache * OoT ROM: increment item counter before setting incoming item/player values to 0, preventing desync issues * set data_version to 0 * make Kokiri Sword shuffle off by default * reenable "Random Choice" for various cosmetic options * kill Ruto's Letter turnin if open fountain also fix for shopsanity * place Buy Goron/Zora Tunic first in shop shuffle * make ice traps appear as other items instead of breaking generation * managed to break ice traps on non-major-only * only handle ice traps if they are on * fix shopsanity for non-oot games, and write player name instead of player number * light arrows hint uses player name instead of player number * Reenable "skip child zelda" option * fix entrances_based_rules * fix ganondorf hint if starting with light arrows * fix dungeonitem shuffle and shopsanity interaction * remove has_all_of, has_any_of, count_of in BaseClasses, replace usage with has_all, has_any, has_group * force local giveable item on ZL if skip_child_zelda and shuffle_song_items is any * keep bosses and bombchu bowling chus out of data package * revert workaround for infinite recursion and fix it properly * fix shared shop id caches during patching process * fix shop text box overflows, as much as possible * add default oot host.yaml option * add .apz5, .n64, .z64 to gitignore * Properly document and name all (functioning) OOT options * clean up some imports * remove unnecessary files from oot's data * fix typo in gitignore * readd the Compress and Decompress utilities, since they are needed for generation * cleanup of imports and some minor optimizations * increase shop offset for item IDs to 0xCB * remove shop item AP ids entirely * prevent triforce pieces for other players from being received by yourself * add "excluded" property to Location * Hint system adapted and reenabled; hints still unseeded * make hints deterministic with lists instead of sets * do not allow hints to point to Light Arrows on non-vanilla bridge * foreign locations hint as their full name in OoT rather than their region * checkedLocations now stores hint names by player ID, so that the same location in different worlds can have hints associated * consolidate versioning in Utils * ice traps appear as major items rather than any progression item * set prescription and claim check as defaults for adult trade item settings * add oot options to playerSettings * allow case-insensitive logic tricks in yaml * fix oot shopsanity option formatting * Write OoT override info even if local item, enabling local checks to show up immediately in the client * implement CollectionState.can_live_dmg for oot glitched logic * filter item names for invalid characters when patching shops * make ice traps appear according to the settings of the world they are shuffled into, rather than the original world * set hidden-spoiler items and locations with Shop items to events * make GF carpenters, Gerudo Card, Malon, ZL, and Impa events if the relevant settings are enabled, preventing them from appearing in the client on game start * Fix oot Glitched and No Logic generation * fix indenting * Greatly reduce displayed cosmetic options * Change oot data version to 1 * add apz5 distribution to webhost * print player name if an ALttP dungeon contains a good item for OoT world * delete unneeded commented code * remove OcarinaSongs import to satisfy lint
		
			
				
	
	
		
			213 lines
		
	
	
		
			16 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			213 lines
		
	
	
		
			16 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| # SOUNDS.PY
 | |
| #
 | |
| # A data-oriented module created to avoid cluttering (and entangling) other,
 | |
| # more important modules with sound data.
 | |
| #
 | |
| # Tags
 | |
| # To easily fetch related sounds by their properties. This seems generally
 | |
| # better than the alternative of defining long lists by hand. You still can, of
 | |
| # course. Categorizing sounds with more useful tags will require some work. Do
 | |
| # this as needed.
 | |
| #
 | |
| # Sounds
 | |
| # These are a collection of data structures relating to sounds. Already I'm sure
 | |
| # you get the picture.
 | |
| #
 | |
| # Sound Pools
 | |
| # These are just groups of sounds, to be referenced by sfx settings. Could
 | |
| # potentially merit enumerating later on. ¯\_(ツ)_/¯
 | |
| #
 | |
| # Sound Hooks
 | |
| # These are intended to gear themselves toward configurable settings, rather
 | |
| # than to document every location where a particular sound is used. For example,
 | |
| # suppose we want a setting to override all of Link's vocalizations. The sound
 | |
| # hook would contain a bunch of addresses, whether they share the same default
 | |
| # value or not.
 | |
| 
 | |
| from enum import Enum
 | |
| from collections import namedtuple
 | |
| 
 | |
| 
 | |
| class Tags(Enum):
 | |
|     LOOPED     = 0
 | |
|     QUIET      = 1
 | |
|     IMMEDIATE  = 2      # Delayed sounds are commonly undesirable
 | |
|     BRIEF      = 3      # Punchy sounds, good for rapid fire
 | |
|     NEW        = 4
 | |
|     PAINFUL    = 5      # Eardrum-piercing sounds
 | |
|     NAVI       = 6      # Navi sounds (hand chosen)
 | |
|     HPLOW      = 7      # Low HP sounds (hand chosen)
 | |
|     HOVERBOOT  = 8      # Hover boot sounds (hand chosen)
 | |
|     NIGHTFALL  = 9      # Nightfall sounds (hand chosen)
 | |
|     MENUSELECT = 10     # Menu selection sounds (hand chosen, could use some more)
 | |
|     MENUMOVE   = 11     # Menu movement sounds  (hand chosen, could use some more)
 | |
|     HORSE      = 12     # Horse neigh sounds (hand chosen)
 | |
|     INC_NE     = 20     # Incompatible with NAVI_ENEMY? (Verify)
 | |
|                         # I'm now thinking it has to do with a limit of concurrent sounds)
 | |
| 
 | |
| Sound = namedtuple('Sound',   'id      keyword                  label                        tags')
 | |
| class Sounds(Enum):
 | |
|     NONE               = Sound(0x0000, 'none',                  'None',                      [Tags.NAVI, Tags.HPLOW])
 | |
|     ARMOS_GROAN        = Sound(0x3848, 'armos',                 'Armos',                     [Tags.HORSE, Tags.PAINFUL])
 | |
|     BARK               = Sound(0x28D8, 'bark',                  'Bark',                      [Tags.BRIEF, Tags.NAVI, Tags.HPLOW, Tags.HOVERBOOT])
 | |
|     BOMB_BOUNCE        = Sound(0x282F, 'bomb-bounce',           'Bomb Bounce',               [Tags.QUIET, Tags.HPLOW])
 | |
|     BONGO_HIGH         = Sound(0x3951, 'bongo-bongo-high',      'Bongo Bongo High',          [Tags.MENUSELECT])
 | |
|     BONGO_LOW          = Sound(0x3950, 'bongo-bongo-low',       'Bongo Bongo Low',           [Tags.QUIET, Tags.HPLOW, Tags.MENUMOVE])
 | |
|     BOTTLE_CORK        = Sound(0x286C, 'bottle-cork',           'Bottle Cork',               [Tags.IMMEDIATE, Tags.BRIEF, Tags.QUIET])
 | |
|     BOW_TWANG          = Sound(0x1830, 'bow-twang',             'Bow Twang',                 [Tags.HPLOW, Tags.MENUMOVE])
 | |
|     BUBBLE_LOL         = Sound(0x38CA, 'bubble-laugh',          'Bubble Laugh',              [])
 | |
|     BUSINESS_SCRUB     = Sound(0x3882, 'business-scrub',        'Business Scrub',            [Tags.PAINFUL, Tags.NAVI, Tags.HPLOW])
 | |
|     CARROT_REFILL      = Sound(0x4845, 'carrot-refill',         'Carrot Refill',             [Tags.NAVI, Tags.HPLOW])
 | |
|     CARTOON_FALL       = Sound(0x28A0, 'cartoon-fall',          'Cartoon Fall',              [Tags.PAINFUL, Tags.HOVERBOOT])
 | |
|     CHANGE_ITEM        = Sound(0x0835, 'change-item',           'Change Item',               [Tags.IMMEDIATE, Tags.BRIEF, Tags.MENUSELECT])
 | |
|     CHEST_OPEN         = Sound(0x2820, 'chest-open',            'Chest Open',                [Tags.PAINFUL])
 | |
|     CHILD_CRINGE       = Sound(0x683A, 'child-cringe',          'Child Cringe',              [Tags.PAINFUL, Tags.IMMEDIATE, Tags.MENUSELECT])
 | |
|     CHILD_GASP         = Sound(0x6836, 'child-gasp',            'Child Gasp',                [Tags.PAINFUL])
 | |
|     CHILD_HURT         = Sound(0x6825, 'child-hurt',            'Child Hurt',                [Tags.PAINFUL])
 | |
|     CHILD_OWO          = Sound(0x6823, 'child-owo',             'Child owo',                 [Tags.PAINFUL])
 | |
|     CHILD_PANT         = Sound(0x6829, 'child-pant',            'Child Pant',                [Tags.IMMEDIATE])
 | |
|     CHILD_SCREAM       = Sound(0x6828, 'child-scream',          'Child Scream',              [Tags.PAINFUL, Tags.IMMEDIATE, Tags.MENUSELECT, Tags.HORSE])
 | |
|     CUCCO_CLUCK        = Sound(0x2812, 'cluck',                 'Cluck',                     [Tags.BRIEF, Tags.NAVI, Tags.HPLOW])
 | |
|     CUCCO_CROW         = Sound(0x2813, 'cockadoodledoo',        'Cockadoodledoo',            [Tags.PAINFUL, Tags.NAVI, Tags.NIGHTFALL])
 | |
|     CURSED_ATTACK      = Sound(0x6868, 'cursed-attack',         'Cursed Attack',             [Tags.PAINFUL, Tags.IMMEDIATE])
 | |
|     CURSED_SCREAM      = Sound(0x6867, 'cursed-scream',         'Cursed Scream',             [Tags.PAINFUL])
 | |
|     DEKU_BABA_CHATTER  = Sound(0x3860, 'deku-baba',             'Deku Baba',                 [Tags.MENUMOVE])
 | |
|     DRAWBRIDGE_SET     = Sound(0x280E, 'drawbridge-set',        'Drawbridge Set',            [Tags.HPLOW])
 | |
|     DUSK_HOWL          = Sound(0x28AE, 'dusk-howl',             'Dusk Howl',                 [Tags.NAVI])
 | |
|     EPONA_CHILD        = Sound(0x2844, 'baby-epona',            'Epona (Baby)',              [Tags.PAINFUL])
 | |
|     EXPLODE_CRATE      = Sound(0x2839, 'exploding-crate',       'Exploding Crate',           [Tags.PAINFUL, Tags.NAVI])
 | |
|     EXPLOSION          = Sound(0x180E, 'explosion',             'Explosion',                 [Tags.PAINFUL, Tags.NAVI])
 | |
|     FANFARE_SMALL      = Sound(0x4824, 'fanfare-light',         'Fanfare (Light)',           [])
 | |
|     FANFARE_MED        = Sound(0x4831, 'fanfare-medium',        'Fanfare (Medium)',          [])
 | |
|     FIELD_SHRUB        = Sound(0x2877, 'field-shrub',           'Field Shrub',               [])
 | |
|     FLARE_BOSS_LOL     = Sound(0x3981, 'flare-dancer-laugh',    'Flare Dancer Laugh',        [Tags.PAINFUL, Tags.IMMEDIATE, Tags.HOVERBOOT])
 | |
|     FLARE_BOSS_STARTLE = Sound(0x398B, 'flare-dancer-startled', 'Flare Dancer Startled',     [])
 | |
|     GANON_TENNIS       = Sound(0x39CA, 'ganondorf-teh',         'Ganondorf "Teh!"',          [])
 | |
|     GOHMA_LARVA_CROAK  = Sound(0x395D, 'gohma-larva-croak',     'Gohma Larva Croak',         [])
 | |
|     GOLD_SKULL_TOKEN   = Sound(0x4843, 'gold-skull-token',      'Gold Skull Token',          [Tags.NIGHTFALL])
 | |
|     GORON_WAKE         = Sound(0x38FC, 'goron-wake',            'Goron Wake',                [])
 | |
|     GREAT_FAIRY        = Sound(0x6858, 'great-fairy',           'Great Fairy',               [Tags.PAINFUL, Tags.NAVI, Tags.NIGHTFALL, Tags.HORSE])
 | |
|     GUAY               = Sound(0x38B6, 'guay',                  'Guay',                      [Tags.BRIEF, Tags.NAVI, Tags.HPLOW])
 | |
|     GUNSHOT            = Sound(0x4835, 'gunshot',               'Gunshot',                   [])
 | |
|     HAMMER_BONK        = Sound(0x180A, 'hammer-bonk',           'Hammer Bonk',               [])
 | |
|     HORSE_NEIGH        = Sound(0x2805, 'horse-neigh',           'Horse Neigh',               [Tags.PAINFUL, Tags.NAVI])
 | |
|     HORSE_TROT         = Sound(0x2804, 'horse-trot',            'Horse Trot',                [Tags.HPLOW])
 | |
|     HOVER_BOOTS        = Sound(0x08C9, 'hover-boots',           'Hover Boots',               [Tags.LOOPED, Tags.PAINFUL])
 | |
|     HP_LOW             = Sound(0x481B, 'low-health',            'HP Low',                    [Tags.INC_NE, Tags.NAVI])
 | |
|     HP_RECOVER         = Sound(0x480B, 'recover-health',        'HP Recover',                [Tags.NAVI, Tags.HPLOW])
 | |
|     ICE_SHATTER        = Sound(0x0875, 'shattering-ice',        'Ice Shattering',            [Tags.PAINFUL, Tags.NAVI])
 | |
|     INGO_WOOAH         = Sound(0x6854, 'ingo-wooah',            'Ingo "Wooah!"',             [Tags.PAINFUL])
 | |
|     IRON_BOOTS         = Sound(0x080D, 'iron-boots',            'Iron Boots',                [Tags.BRIEF, Tags.HPLOW, Tags.QUIET])
 | |
|     IRON_KNUCKLE       = Sound(0x3929, 'iron-knuckle',          'Iron Knuckle',              [])
 | |
|     INGO_KAAH          = Sound(0x6855, 'kaah',                  'Kaah!',                     [Tags.PAINFUL]) 
 | |
|     MOBLIN_CLUB_GROUND = Sound(0x38E1, 'moblin-club-ground',    'Moblin Club Ground',        [Tags.PAINFUL]) 
 | |
|     MOBLIN_CLUB_SWING  = Sound(0x39EF, 'moblin-club-swing',     'Moblin Club Swing',         [Tags.PAINFUL]) 
 | |
|     MOO                = Sound(0x28DF, 'moo',                   'Moo',                       [Tags.NAVI, Tags.NIGHTFALL, Tags.HORSE, Tags.HPLOW])
 | |
|     MWEEP              = Sound(0x687A, 'mweep',                 'Mweep!',                    [Tags.BRIEF, Tags.NAVI, Tags.MENUMOVE, Tags.MENUSELECT, Tags.NIGHTFALL, Tags.HPLOW, Tags.HORSE, Tags.HOVERBOOT])
 | |
|     NAVI_HELLO         = Sound(0x6844, 'navi-hello',            'Navi "Hello!"',             [Tags.PAINFUL, Tags.NAVI])
 | |
|     NAVI_HEY           = Sound(0x685F, 'navi-hey',              'Navi "Hey!"',               [Tags.PAINFUL, Tags.HPLOW])
 | |
|     NAVI_RANDOM        = Sound(0x6843, 'navi-random',           'Navi Random',               [Tags.PAINFUL, Tags.HPLOW])
 | |
|     NOTIFICATION       = Sound(0x4820, 'notification',          'Notification',              [Tags.NAVI, Tags.HPLOW])
 | |
|     PHANTOM_GANON_LOL  = Sound(0x38B0, 'phantom-ganon-laugh',   'Phantom Ganon Laugh',       [])
 | |
|     PLANT_EXPLODE      = Sound(0x284E, 'plant-explode',         'Plant Explode',             [])
 | |
|     POE                = Sound(0x38EC, 'poe',                   'Poe',                       [Tags.PAINFUL, Tags.NAVI])
 | |
|     POT_SHATTER        = Sound(0x2887, 'shattering-pot',        'Pot Shattering',            [Tags.NAVI, Tags.HPLOW])
 | |
|     REDEAD_MOAN        = Sound(0x38E4, 'redead-moan',           'Redead Moan',               [Tags.NIGHTFALL])
 | |
|     REDEAD_SCREAM      = Sound(0x38E5, 'redead-scream',         'Redead Scream',             [Tags.PAINFUL, Tags.NAVI, Tags.HORSE])
 | |
|     RIBBIT             = Sound(0x28B1, 'ribbit',                'Ribbit',                    [Tags.NAVI, Tags.HPLOW])
 | |
|     RUPEE              = Sound(0x4803, 'rupee',                 'Rupee',                     [])
 | |
|     RUPEE_SILVER       = Sound(0x28E8, 'silver-rupee',          'Rupee (Silver)',            [Tags.HPLOW])
 | |
|     RUTO_CHILD_CRASH   = Sound(0x6860, 'ruto-crash',            'Ruto Crash',                [])
 | |
|     RUTO_CHILD_EXCITED = Sound(0x6861, 'ruto-excited',          'Ruto Excited',              [Tags.PAINFUL])
 | |
|     RUTO_CHILD_GIGGLE  = Sound(0x6863, 'ruto-giggle',           'Ruto Giggle',               [Tags.PAINFUL, Tags.NAVI])
 | |
|     RUTO_CHILD_LIFT    = Sound(0x6864, 'ruto-lift',             'Ruto Lift',                 [])
 | |
|     RUTO_CHILD_THROWN  = Sound(0x6865, 'ruto-thrown',           'Ruto Thrown',               [])
 | |
|     RUTO_CHILD_WIGGLE  = Sound(0x6866, 'ruto-wiggle',           'Ruto Wiggle',               [Tags.PAINFUL, Tags.HORSE])
 | |
|     SCRUB_NUTS_UP      = Sound(0x387C, 'scrub-emerge',          'Scrub Emerge',              [])
 | |
|     SHABOM_BOUNCE      = Sound(0x3948, 'shabom-bounce',         'Shabom Bounce',             [Tags.IMMEDIATE])
 | |
|     SHABOM_POP         = Sound(0x3949, 'shabom-pop',            'Shabom Pop',                [Tags.IMMEDIATE, Tags.BRIEF, Tags.HOVERBOOT])
 | |
|     SHELLBLADE         = Sound(0x3849, 'shellblade',            'Shellblade',                [])
 | |
|     SKULLTULA          = Sound(0x39DA, 'skulltula',             'Skulltula',                 [Tags.BRIEF, Tags.NAVI])
 | |
|     SOFT_BEEP          = Sound(0x4804, 'soft-beep',             'Soft Beep',                 [Tags.NAVI, Tags.HPLOW])
 | |
|     SPIKE_TRAP         = Sound(0x38E9, 'spike-trap',            'Spike Trap',                [Tags.LOOPED, Tags.PAINFUL])
 | |
|     SPIT_NUT           = Sound(0x387E, 'spit-nut',              'Spit Nut',                  [Tags.IMMEDIATE, Tags.BRIEF])
 | |
|     STALCHILD_ATTACK   = Sound(0x3831, 'stalchild-attack',      'Stalchild Attack',          [Tags.PAINFUL, Tags.HORSE])
 | |
|     STINGER_CRY        = Sound(0x39A3, 'stinger-squeak',        'Stinger Squeak',            [Tags.PAINFUL])
 | |
|     SWITCH             = Sound(0x2815, 'switch',                'Switch',                    [Tags.HPLOW])
 | |
|     SWORD_BONK         = Sound(0x181A, 'sword-bonk',            'Sword Bonk',                [Tags.HPLOW])
 | |
|     TALON_CRY          = Sound(0x6853, 'talon-cry',             'Talon Cry',                 [Tags.PAINFUL])
 | |
|     TALON_HMM          = Sound(0x6852, 'talon-hmm',             'Talon "Hmm"',               [])
 | |
|     TALON_SNORE        = Sound(0x6850, 'talon-snore',           'Talon Snore',               [Tags.NIGHTFALL])
 | |
|     TALON_WTF          = Sound(0x6851, 'talon-wtf',             'Talon Wtf',                 [])
 | |
|     TAMBOURINE         = Sound(0x4842, 'tambourine',            'Tambourine',                [Tags.QUIET, Tags.NAVI, Tags.HPLOW, Tags.HOVERBOOT])
 | |
|     TARGETING_ENEMY    = Sound(0x4830, 'target-enemy',          'Target Enemy',              [])
 | |
|     TARGETING_NEUTRAL  = Sound(0x480C, 'target-neutral',        'Target Neutral',            [])
 | |
|     THUNDER            = Sound(0x282E, 'thunder',               'Thunder',                   [Tags.NIGHTFALL])
 | |
|     TIMER              = Sound(0x481A, 'timer',                 'Timer',                     [Tags.INC_NE, Tags.NAVI, Tags.HPLOW])
 | |
|     TWINROVA_BICKER    = Sound(0x39E7, 'twinrova-bicker',       'Twinrova Bicker',           [Tags.LOOPED, Tags.PAINFUL])
 | |
|     WOLFOS_HOWL        = Sound(0x383C, 'wolfos-howl',           'Wolfos Howl',               [Tags.PAINFUL])
 | |
|     ZELDA_ADULT_GASP   = Sound(0x6879, 'adult-zelda-gasp',      'Zelda Gasp (Adult)',        [Tags.NAVI, Tags.HPLOW])
 | |
| 
 | |
| 
 | |
| # Sound pools
 | |
| standard    = [s for s in Sounds if Tags.LOOPED not in s.value.tags]
 | |
| looping     = [s for s in Sounds if Tags.LOOPED in s.value.tags]
 | |
| no_painful  = [s for s in standard if Tags.PAINFUL not in s.value.tags]
 | |
| navi        = [s for s in Sounds if Tags.NAVI in s.value.tags]
 | |
| hp_low      = [s for s in Sounds if Tags.HPLOW in s.value.tags]
 | |
| hover_boots = [s for s in Sounds if Tags.HOVERBOOT in s.value.tags]
 | |
| nightfall   = [s for s in Sounds if Tags.NIGHTFALL in s.value.tags]
 | |
| menu_select = [s for s in Sounds if Tags.MENUSELECT in s.value.tags]
 | |
| menu_cursor = [s for s in Sounds if Tags.MENUMOVE in s.value.tags]
 | |
| horse_neigh = [s for s in Sounds if Tags.HORSE in s.value.tags]
 | |
| 
 | |
| 
 | |
| SoundHook = namedtuple('SoundHook', 'name pool locations')
 | |
| class SoundHooks(Enum):
 | |
|     NAVI_OVERWORLD  = SoundHook('Navi - Overworld', navi,        [0xAE7EF2, 0xC26C7E])
 | |
|     NAVI_ENEMY      = SoundHook('Navi - Enemy',     navi,        [0xAE7EC6])
 | |
|     HP_LOW          = SoundHook('Low Health',       hp_low,      [0xADBA1A])
 | |
|     BOOTS_HOVER     = SoundHook('Hover Boots',      hover_boots, [0xBDBD8A])
 | |
|     NIGHTFALL       = SoundHook('Nightfall',        nightfall,   [0xAD3466, 0xAD7A2E])
 | |
|     MENU_SELECT     = SoundHook('Menu Select',      no_painful + menu_select,  [
 | |
|                         0xBA1BBE, 0xBA23CE, 0xBA2956, 0xBA321A, 0xBA72F6, 0xBA8106, 0xBA82EE,
 | |
|                         0xBA9DAE, 0xBA9EAE, 0xBA9FD2, 0xBAE6D6])
 | |
|     MENU_CURSOR     = SoundHook('Menu Cursor',      no_painful + menu_cursor,  [
 | |
|                         0xBA165E, 0xBA1C1A, 0xBA2406, 0xBA327E, 0xBA3936, 0xBA77C2, 0xBA7886,
 | |
|                         0xBA7A06, 0xBA7A6E, 0xBA7AE6, 0xBA7D6A, 0xBA8186, 0xBA822E, 0xBA82A2,
 | |
|                         0xBAA11E, 0xBAE7C6])
 | |
|     HORSE_NEIGH     = SoundHook('Horse Neigh',      horse_neigh, [
 | |
|                         0xC18832, 0xC18C32, 0xC19A7E, 0xC19CBE, 0xC1A1F2, 0xC1A3B6, 0xC1B08A,
 | |
|                         0xC1B556, 0xC1C28A, 0xC1CC36, 0xC1EB4A, 0xC1F18E, 0xC6B136, 0xC6BBA2,
 | |
|                         0xC1E93A, 0XC6B366, 0XC6B562])
 | |
| 
 | |
| 
 | |
| #   # Some enemies have a different cutting sound, making this a bit weird
 | |
| #   SWORD_SLASH     = SoundHook('Sword Slash',      standard,         [0xAC2942])
 | |
| 
 | |
| 
 | |
| def get_patch_dict():
 | |
|     return {s.value.keyword: s.value.id for s in Sounds}
 | |
| 
 | |
| 
 | |
| def get_hook_pool(sound_hook, earsafeonly = "FALSE"):
 | |
|     if earsafeonly == "TRUE":
 | |
|         list = [s for s in sound_hook.value.pool if Tags.PAINFUL not in s.value.tags]
 | |
|         return list
 | |
|     else:
 | |
|         return sound_hook.value.pool
 | |
| 
 | |
| 
 | |
| def get_setting_choices(sound_hook):
 | |
|     pool     = sound_hook.value.pool
 | |
|     choices  = {s.value.keyword: s.value.label for s in sorted(pool, key=lambda s: s.value.label)}
 | |
|     result   = {
 | |
|         'default':           'Default',
 | |
|         'completely-random': 'Completely Random',
 | |
|         'random-ear-safe':   'Random Ear-Safe',
 | |
|         'random-choice':     'Random Choice',
 | |
|         'none':              'None',
 | |
|         **choices,
 | |
|         }
 | |
|     return result
 |