Fixed duplicated and missorted track listings in Jukebox

This commit is contained in:
Maruno17
2022-01-24 23:32:05 +00:00
parent 98f311c394
commit 8f69c555da

View File

@@ -71,7 +71,7 @@ class PokemonJukeboxScreen
commands[cmdMarch = commands.length] = _INTL("March") commands[cmdMarch = commands.length] = _INTL("March")
commands[cmdLullaby = commands.length] = _INTL("Lullaby") commands[cmdLullaby = commands.length] = _INTL("Lullaby")
commands[cmdOak = commands.length] = _INTL("Oak") commands[cmdOak = commands.length] = _INTL("Oak")
commands[cmdCustom = commands.length] = _INTL("Custom") commands[cmdCustom = commands.length] = _INTL("Custom...")
commands[commands.length] = _INTL("Exit") commands[commands.length] = _INTL("Exit")
@scene.pbStartScene(commands) @scene.pbStartScene(commands)
loop do loop do
@@ -96,36 +96,28 @@ class PokemonJukeboxScreen
$PokemonMap.blackFluteUsed = false if $PokemonMap $PokemonMap.blackFluteUsed = false if $PokemonMap
elsif cmdCustom >= 0 && cmd == cmdCustom elsif cmdCustom >= 0 && cmd == cmdCustom
pbPlayDecisionSE pbPlayDecisionSE
files = [_INTL("(Default)")] files = []
Dir.chdir("Audio/BGM/") { Dir.chdir("Audio/BGM/") {
# Dir.glob("*.mp3") { |f| files.push(f) }
# Dir.glob("*.MP3") { |f| files.push(f) }
Dir.glob("*.ogg") { |f| files.push(f) } Dir.glob("*.ogg") { |f| files.push(f) }
Dir.glob("*.OGG") { |f| files.push(f) }
Dir.glob("*.wav") { |f| files.push(f) } Dir.glob("*.wav") { |f| files.push(f) }
Dir.glob("*.WAV") { |f| files.push(f) }
Dir.glob("*.mid") { |f| files.push(f) } Dir.glob("*.mid") { |f| files.push(f) }
Dir.glob("*.MID") { |f| files.push(f) }
Dir.glob("*.midi") { |f| files.push(f) } Dir.glob("*.midi") { |f| files.push(f) }
Dir.glob("*.MIDI") { |f| files.push(f) }
} }
files.map! { |f| f.chomp(File.extname(f)) }
files.uniq!
files.sort! { |a, b| a.downcase <=> b.downcase }
# files.insert(0, _INTL("(Default)"))
@scene.pbSetCommands(files, 0) @scene.pbSetCommands(files, 0)
loop do loop do
cmd2 = @scene.pbScene cmd2 = @scene.pbScene
if cmd2 < 0 if cmd2 < 0
pbPlayCancelSE pbPlayCancelSE
break break
elsif cmd2 == 0
pbPlayDecisionSE
$game_system.setDefaultBGM(nil)
$PokemonMap.whiteFluteUsed = false if $PokemonMap
$PokemonMap.blackFluteUsed = false if $PokemonMap
else
pbPlayDecisionSE
$game_system.setDefaultBGM(files[cmd2])
$PokemonMap.whiteFluteUsed = false if $PokemonMap
$PokemonMap.blackFluteUsed = false if $PokemonMap
end end
pbPlayDecisionSE
$game_system.setDefaultBGM(files[cmd2]) # ((cmd2 == 0) ? nil : files[cmd2])
$PokemonMap.whiteFluteUsed = false if $PokemonMap
$PokemonMap.blackFluteUsed = false if $PokemonMap
end end
@scene.pbSetCommands(nil, cmdCustom) @scene.pbSetCommands(nil, cmdCustom)
else # Exit else # Exit