mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Tweaked Jukebox functionality, simplified code relating to night versions of BGMs
This commit is contained in:
@@ -54,13 +54,9 @@ class Scene_Map
|
||||
playingBGS = $game_system.playing_bgs
|
||||
return if !playingBGM && !playingBGS
|
||||
map = load_data(sprintf("Data/Map%03d.rxdata", mapid))
|
||||
if playingBGM && map.autoplay_bgm
|
||||
if (PBDayNight.isNight? rescue false)
|
||||
pbBGMFade(0.8) if playingBGM.name != map.bgm.name && playingBGM.name != map.bgm.name + "_n"
|
||||
elsif playingBGM.name != map.bgm.name
|
||||
if playingBGM && map.autoplay_bgm && playingBGM.name != map.bgm_name
|
||||
pbBGMFade(0.8)
|
||||
end
|
||||
end
|
||||
if playingBGS && map.autoplay_bgs && playingBGS.name != map.bgs.name
|
||||
pbBGMFade(0.8)
|
||||
end
|
||||
|
||||
@@ -96,6 +96,7 @@ class Game_Map
|
||||
def encounter_step; return @map.encounter_step; end
|
||||
def data; return @map.data; end
|
||||
def tileset_id; return @map.tileset_id; end
|
||||
def bgm; return @map.bgm; end
|
||||
|
||||
def name
|
||||
return pbGetMapNameFromId(@map_id)
|
||||
@@ -104,37 +105,32 @@ class Game_Map
|
||||
def metadata
|
||||
return GameData::MapMetadata.try_get(@map_id)
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Returns the name of this map's BGM. If it's night time, returns the night
|
||||
# version of the BGM (if it exists).
|
||||
#-----------------------------------------------------------------------------
|
||||
def bgm_name
|
||||
if PBDayNight.isNight? && FileTest.audio_exist?("Audio/BGM/" + @map.bgm.name + "_n")
|
||||
return @map.bgm.name + "_n"
|
||||
end
|
||||
return @map.bgm.name
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Autoplays background music
|
||||
# Plays music called "[normal BGM]_n" if it's night time and it exists
|
||||
#-----------------------------------------------------------------------------
|
||||
def autoplayAsCue
|
||||
if @map.autoplay_bgm
|
||||
if PBDayNight.isNight? && FileTest.audio_exist?("Audio/BGM/" + @map.bgm.name + "_n")
|
||||
pbCueBGM(@map.bgm.name + "_n", 1.0, @map.bgm.volume, @map.bgm.pitch)
|
||||
else
|
||||
pbCueBGM(@map.bgm, 1.0)
|
||||
end
|
||||
end
|
||||
if @map.autoplay_bgs
|
||||
pbBGSPlay(@map.bgs)
|
||||
end
|
||||
pbCueBGM(bgm_name, 1.0, @map.bgm.volume, @map.bgm.pitch) if @map.autoplay_bgm
|
||||
pbBGSPlay(@map.bgs) if @map.autoplay_bgs
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Plays background music
|
||||
# Plays music called "[normal BGM]_n" if it's night time and it exists
|
||||
#-----------------------------------------------------------------------------
|
||||
def autoplay
|
||||
if @map.autoplay_bgm
|
||||
if PBDayNight.isNight? && FileTest.audio_exist?("Audio/BGM/" + @map.bgm.name + "_n")
|
||||
pbBGMPlay(@map.bgm.name + "_n", @map.bgm.volume, @map.bgm.pitch)
|
||||
else
|
||||
pbBGMPlay(@map.bgm)
|
||||
end
|
||||
end
|
||||
if @map.autoplay_bgs
|
||||
pbBGSPlay(@map.bgs)
|
||||
end
|
||||
pbBGMPlay(bgm_name, @map.bgm.volume, @map.bgm.pitch) if @map.autoplay_bgm
|
||||
pbBGSPlay(@map.bgs) if @map.autoplay_bgs
|
||||
end
|
||||
|
||||
def valid?(x, y)
|
||||
|
||||
@@ -68,10 +68,12 @@ class PokemonJukeboxScreen
|
||||
cmdLullaby = -1
|
||||
cmdOak = -1
|
||||
cmdCustom = -1
|
||||
commands[cmdMarch = commands.length] = _INTL("March")
|
||||
commands[cmdLullaby = commands.length] = _INTL("Lullaby")
|
||||
commands[cmdOak = commands.length] = _INTL("Oak")
|
||||
commands[cmdCustom = commands.length] = _INTL("Custom...")
|
||||
cmdTurnOff = -1
|
||||
commands[cmdMarch = commands.length] = _INTL("Play: Pokémon March")
|
||||
commands[cmdLullaby = commands.length] = _INTL("Play: Pokémon Lullaby")
|
||||
commands[cmdOak = commands.length] = _INTL("Play: Oak")
|
||||
commands[cmdCustom = commands.length] = _INTL("Play: Custom...")
|
||||
commands[cmdTurnOff = commands.length] = _INTL("Stop")
|
||||
commands[commands.length] = _INTL("Exit")
|
||||
@scene.pbStartScene(commands)
|
||||
loop do
|
||||
@@ -106,7 +108,6 @@ class PokemonJukeboxScreen
|
||||
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)
|
||||
loop do
|
||||
cmd2 = @scene.pbScene
|
||||
@@ -115,11 +116,17 @@ class PokemonJukeboxScreen
|
||||
break
|
||||
end
|
||||
pbPlayDecisionSE
|
||||
$game_system.setDefaultBGM(files[cmd2]) # ((cmd2 == 0) ? nil : files[cmd2])
|
||||
$game_system.setDefaultBGM(files[cmd2])
|
||||
$PokemonMap.whiteFluteUsed = false if $PokemonMap
|
||||
$PokemonMap.blackFluteUsed = false if $PokemonMap
|
||||
end
|
||||
@scene.pbSetCommands(nil, cmdCustom)
|
||||
elsif cmdTurnOff >= 0 && cmd == cmdTurnOff
|
||||
pbPlayDecisionSE
|
||||
$game_system.setDefaultBGM(nil)
|
||||
pbBGMPlay(pbResolveAudioFile($game_map.bgm_name, $game_map.bgm.volume, $game_map.bgm.pitch))
|
||||
$PokemonMap.whiteFluteUsed = false if $PokemonMap
|
||||
$PokemonMap.blackFluteUsed = false if $PokemonMap
|
||||
else # Exit
|
||||
pbPlayCloseMenuSE
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user