Ocarina of Time: options and general cleanup (#3767)
* working? * missed one * fix old start inventory usage * missed global random usage --------- Co-authored-by: NewSoupVi <57900059+NewSoupVi@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#Much of this is heavily inspired from and/or based on az64's / Deathbasket's MM randomizer
|
||||
|
||||
import random
|
||||
import os
|
||||
from .Utils import compare_version, data_path
|
||||
|
||||
@@ -175,7 +174,7 @@ def process_sequences(rom, sequences, target_sequences, disabled_source_sequence
|
||||
return sequences, target_sequences
|
||||
|
||||
|
||||
def shuffle_music(sequences, target_sequences, music_mapping, log):
|
||||
def shuffle_music(sequences, target_sequences, music_mapping, log, rand):
|
||||
sequence_dict = {}
|
||||
sequence_ids = []
|
||||
|
||||
@@ -191,7 +190,7 @@ def shuffle_music(sequences, target_sequences, music_mapping, log):
|
||||
# Shuffle the sequences
|
||||
if len(sequences) < len(target_sequences):
|
||||
raise Exception(f"Not enough custom music/fanfares ({len(sequences)}) to omit base Ocarina of Time sequences ({len(target_sequences)}).")
|
||||
random.shuffle(sequence_ids)
|
||||
rand.shuffle(sequence_ids)
|
||||
|
||||
sequences = []
|
||||
for target_sequence in target_sequences:
|
||||
@@ -328,7 +327,7 @@ def rebuild_sequences(rom, sequences):
|
||||
rom.write_byte(base, j.instrument_set)
|
||||
|
||||
|
||||
def shuffle_pointers_table(rom, ids, music_mapping, log):
|
||||
def shuffle_pointers_table(rom, ids, music_mapping, log, rand):
|
||||
# Read in all the Music data
|
||||
bgm_data = {}
|
||||
bgm_ids = []
|
||||
@@ -341,7 +340,7 @@ def shuffle_pointers_table(rom, ids, music_mapping, log):
|
||||
bgm_ids.append(bgm[0])
|
||||
|
||||
# shuffle data
|
||||
random.shuffle(bgm_ids)
|
||||
rand.shuffle(bgm_ids)
|
||||
|
||||
# Write Music data back in random ordering
|
||||
for bgm in ids:
|
||||
@@ -424,13 +423,13 @@ def randomize_music(rom, ootworld, music_mapping):
|
||||
# process_sequences(rom, sequences, target_sequences, disabled_source_sequences, disabled_target_sequences, bgm_ids)
|
||||
# if ootworld.background_music == 'random_custom_only':
|
||||
# sequences = [seq for seq in sequences if seq.cosmetic_name not in [x[0] for x in bgm_ids] or seq.cosmetic_name in music_mapping.values()]
|
||||
# sequences, log = shuffle_music(sequences, target_sequences, music_mapping, log)
|
||||
# sequences, log = shuffle_music(sequences, target_sequences, music_mapping, log, ootworld.random)
|
||||
|
||||
# if ootworld.fanfares in ['random', 'random_custom_only'] or ff_mapped or ocarina_mapped:
|
||||
# process_sequences(rom, fanfare_sequences, fanfare_target_sequences, disabled_source_sequences, disabled_target_sequences, ff_ids, 'fanfare')
|
||||
# if ootworld.fanfares == 'random_custom_only':
|
||||
# fanfare_sequences = [seq for seq in fanfare_sequences if seq.cosmetic_name not in [x[0] for x in fanfare_sequence_ids] or seq.cosmetic_name in music_mapping.values()]
|
||||
# fanfare_sequences, log = shuffle_music(fanfare_sequences, fanfare_target_sequences, music_mapping, log)
|
||||
# fanfare_sequences, log = shuffle_music(fanfare_sequences, fanfare_target_sequences, music_mapping, log, ootworld.random)
|
||||
|
||||
# if disabled_source_sequences:
|
||||
# log = disable_music(rom, disabled_source_sequences.values(), log)
|
||||
@@ -438,10 +437,10 @@ def randomize_music(rom, ootworld, music_mapping):
|
||||
# rebuild_sequences(rom, sequences + fanfare_sequences)
|
||||
# else:
|
||||
if ootworld.background_music == 'randomized' or bgm_mapped:
|
||||
log = shuffle_pointers_table(rom, bgm_ids, music_mapping, log)
|
||||
log = shuffle_pointers_table(rom, bgm_ids, music_mapping, log, ootworld.random)
|
||||
|
||||
if ootworld.fanfares == 'randomized' or ff_mapped or ocarina_mapped:
|
||||
log = shuffle_pointers_table(rom, ff_ids, music_mapping, log)
|
||||
log = shuffle_pointers_table(rom, ff_ids, music_mapping, log, ootworld.random)
|
||||
# end_else
|
||||
if disabled_target_sequences:
|
||||
log = disable_music(rom, disabled_target_sequences.values(), log)
|
||||
|
||||
Reference in New Issue
Block a user