Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cosmetic Plando: Music Groups, Favorites, Excludes #1760

Merged
merged 7 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions Cosmetics.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def patch_music(rom, settings, log, symbols):
# patch music
if settings.background_music != 'normal' or settings.fanfares != 'normal' or log.src_dict.get('bgm', {}):
music.restore_music(rom)
log.bgm, errors = music.randomize_music(rom, settings, log.src_dict.get('bgm', {}))
log.errors.extend(errors)
music.randomize_music(rom, settings, log)
else:
music.restore_music(rom)
# Remove battle music
Expand Down Expand Up @@ -1010,6 +1009,7 @@ def __init__(self, settings):
self.misc_colors = {}
self.sfx = {}
self.bgm = {}
self.bgm_groups = {}

self.src_dict = {}
self.errors = []
Expand All @@ -1036,6 +1036,12 @@ def __init__(self, settings):
logging.getLogger('').warning("Cosmetic Plandomizer enabled, but no file provided.")
self.settings.enable_cosmetic_file = False

self.bgm_groups['favorites'] = CollapseList(self.src_dict.get('bgm_groups', {}).get('favorites', []).copy())
self.bgm_groups['exclude'] = CollapseList(self.src_dict.get('bgm_groups', {}).get('exclude', []).copy())
self.bgm_groups['groups'] = AlignedDict(self.src_dict.get('bgm_groups', {}).get('groups', {}).copy(), 1)
for key, value in self.bgm_groups['groups'].items():
self.bgm_groups['groups'][key] = CollapseList(value.copy())

if self.src_dict.get('settings', {}):
valid_settings = []
for setting in setting_infos:
Expand All @@ -1062,11 +1068,12 @@ def to_json(self):
'ui_colors': self.ui_colors,
'misc_colors': self.misc_colors,
'sfx': self.sfx,
'bgm_groups': self.bgm_groups,
'bgm': self.bgm,
}

if (not self.settings.enable_cosmetic_file):
del self_dict[':enable_cosmetic_file'] # Done this way for ordering purposes.
del self_dict[':enable_cosmetic_file'] # Done this way for ordering purposes.
if (not self.errors):
del self_dict[':errors']

Expand Down
Loading