Update 6.8

This commit is contained in:
chardub
2026-07-10 15:42:06 -04:00
parent 5b85e72cb2
commit 6a6f126a18
7871 changed files with 493194 additions and 224826 deletions
+100 -62
View File
@@ -1,15 +1,15 @@
def pbStringToAudioFile(str)
if str[/^(.*)\:\s*(\d+)\s*\:\s*(\d+)\s*$/] # Of the format "XXX: ###: ###"
file = $1
if str[/^(.*)\:\s*(\d+)\s*\:\s*(\d+)\s*$/] # Of the format "XXX: ###: ###"
file = $1
volume = $2.to_i
pitch = $3.to_i
return RPG::AudioFile.new(file,volume,pitch)
elsif str[/^(.*)\:\s*(\d+)\s*$/] # Of the format "XXX: ###"
file = $1
pitch = $3.to_i
return RPG::AudioFile.new(file, volume, pitch)
elsif str[/^(.*)\:\s*(\d+)\s*$/] # Of the format "XXX: ###"
file = $1
volume = $2.to_i
return RPG::AudioFile.new(file,volume,100)
return RPG::AudioFile.new(file, volume, 100)
else
return RPG::AudioFile.new(str,100,100)
return RPG::AudioFile.new(str, 100, 100)
end
end
@@ -21,16 +21,16 @@ end
# filename:volume:pitch
# volume -- Volume of the file, up to 100
# pitch -- Pitch of the file, normally 100
def pbResolveAudioFile(str,volume=nil,pitch=nil)
def pbResolveAudioFile(str, volume = nil, pitch = nil)
if str.is_a?(String)
str = pbStringToAudioFile(str)
str.volume = volume || 100
str.pitch = pitch || 100
str.pitch = pitch || 100
end
if str.is_a?(RPG::AudioFile)
if volume || pitch
return RPG::AudioFile.new(str.name,volume || str.volume || 100 ,
pitch || str.pitch || 100)
return RPG::AudioFile.new(str.name, volume || str.volume || 100,
pitch || str.pitch || 100)
else
return str
end
@@ -38,6 +38,21 @@ def pbResolveAudioFile(str,volume=nil,pitch=nil)
return str
end
def audioFileExists(type, filename)
case type
when :BGM
path = "Audio/BGM/"
when :SE
path = "Audio/SE/"
when :ME
path = "Audio/ME/"
when :BGS
path = "Audio/BGS/"
end
full_path = canonicalize(path +filename)
return RTP.exists?(full_path, ["", ".wav", ".mp3", ".ogg"])
end
################################################################################
# Plays a BGM file.
@@ -49,31 +64,48 @@ end
# filename:volume:pitch
# volume -- Volume of the file, up to 100
# pitch -- Pitch of the file, normally 100
def pbBGMPlay(param,volume=nil,pitch=nil)
def pbBGMPlay(param, volume = nil, pitch = nil)
return if !param
param=pbResolveAudioFile(param,volume,pitch)
param = pbResolveAudioFile(param, volume, pitch)
param = pbResolveAudioFile("ultra_metropolis", volume, pitch) if darknessEffectOnCurrentMap() && !$PokemonTemp.during_battle
if param.name && param.name!=""
param = pbResolveAudioFile("ship", volume, pitch) if $PokemonGlobal && $PokemonGlobal.boat
if isWearingHat(HAT_TRUMPET) && Settings::HOENN
trumpet_track = "trumpet/" + param.name
if audioFileExists(:BGM,trumpet_track)
trumpet_param = pbResolveAudioFile(trumpet_track)
param = trumpet_param if trumpet_param.is_a?(RPG::AudioFile)
end
end
if param.name && param.name != ""
if $PokemonSystem
$PokemonSystem.encountered_music = [] if !$PokemonSystem.encountered_music
unless $PokemonSystem.encountered_music.include?(param.name)
$PokemonSystem.encountered_music << param.name
echoln "registering new music!#{param.name}"
end
end
if $game_system && $game_system.respond_to?("bgm_play")
$game_system.bgm_play(param)
return
elsif (RPG.const_defined?(:BGM) rescue false)
b=RPG::BGM.new(param.name,param.volume,param.pitch)
b = RPG::BGM.new(param.name, param.volume, param.pitch)
if b && b.respond_to?("play")
b.play
return
end
end
Audio.bgm_play(canonicalize("Audio/BGM/"+param.name),param.volume,param.pitch)
Audio.bgm_play(canonicalize("Audio/BGM/" + param.name), param.volume, param.pitch)
end
end
# Fades out or stops BGM playback. 'x' is the time in seconds to fade out.
def pbBGMFade(x=0.0); pbBGMStop(x);end
def pbBGMFade(x = 0.0)
; pbBGMStop(x);
end
# Fades out or stops BGM playback. 'x' is the time in seconds to fade out.
def pbBGMStop(timeInSeconds=0.0)
if $game_system && timeInSeconds>0.0 && $game_system.respond_to?("bgm_fade")
def pbBGMStop(timeInSeconds = 0.0)
if $game_system && timeInSeconds > 0.0 && $game_system.respond_to?("bgm_fade")
$game_system.bgm_fade(timeInSeconds)
return
elsif $game_system && $game_system.respond_to?("bgm_stop")
@@ -81,12 +113,12 @@ def pbBGMStop(timeInSeconds=0.0)
return
elsif (RPG.const_defined?(:BGM) rescue false)
begin
(timeInSeconds>0.0) ? RPG::BGM.fade((timeInSeconds*1000).floor) : RPG::BGM.stop
(timeInSeconds > 0.0) ? RPG::BGM.fade((timeInSeconds * 1000).floor) : RPG::BGM.stop
return
rescue
end
end
(timeInSeconds>0.0) ? Audio.bgm_fade((timeInSeconds*1000).floor) : Audio.bgm_stop
(timeInSeconds > 0.0) ? Audio.bgm_fade((timeInSeconds * 1000).floor) : Audio.bgm_stop
end
################################################################################
@@ -100,29 +132,31 @@ end
# filename:volume:pitch
# volume -- Volume of the file, up to 100
# pitch -- Pitch of the file, normally 100
def pbMEPlay(param,volume=nil,pitch=nil)
def pbMEPlay(param, volume = nil, pitch = nil)
return if !param
param=pbResolveAudioFile(param,volume,pitch)
if param.name && param.name!=""
param = pbResolveAudioFile(param, volume, pitch)
if param.name && param.name != ""
if $game_system && $game_system.respond_to?("me_play")
$game_system.me_play(param)
return
elsif (RPG.const_defined?(:ME) rescue false)
b=RPG::ME.new(param.name,param.volume,param.pitch)
b = RPG::ME.new(param.name, param.volume, param.pitch)
if b && b.respond_to?("play")
b.play; return
end
end
Audio.me_play(canonicalize("Audio/ME/"+param.name),param.volume,param.pitch)
Audio.me_play(canonicalize("Audio/ME/" + param.name), param.volume, param.pitch)
end
end
# Fades out or stops ME playback. 'x' is the time in seconds to fade out.
def pbMEFade(x=0.0); pbMEStop(x);end
def pbMEFade(x = 0.0)
; pbMEStop(x);
end
# Fades out or stops ME playback. 'x' is the time in seconds to fade out.
def pbMEStop(timeInSeconds=0.0)
if $game_system && timeInSeconds>0.0 && $game_system.respond_to?("me_fade")
def pbMEStop(timeInSeconds = 0.0)
if $game_system && timeInSeconds > 0.0 && $game_system.respond_to?("me_fade")
$game_system.me_fade(timeInSeconds)
return
elsif $game_system && $game_system.respond_to?("me_stop")
@@ -130,12 +164,12 @@ def pbMEStop(timeInSeconds=0.0)
return
elsif (RPG.const_defined?(:ME) rescue false)
begin
(timeInSeconds>0.0) ? RPG::ME.fade((timeInSeconds*1000).floor) : RPG::ME.stop
(timeInSeconds > 0.0) ? RPG::ME.fade((timeInSeconds * 1000).floor) : RPG::ME.stop
return
rescue
end
end
(timeInSeconds>0.0) ? Audio.me_fade((timeInSeconds*1000).floor) : Audio.me_stop
(timeInSeconds > 0.0) ? Audio.me_fade((timeInSeconds * 1000).floor) : Audio.me_stop
end
################################################################################
@@ -149,29 +183,31 @@ end
# filename:volume:pitch
# volume -- Volume of the file, up to 100
# pitch -- Pitch of the file, normally 100
def pbBGSPlay(param,volume=nil,pitch=nil)
def pbBGSPlay(param, volume = nil, pitch = nil)
return if !param
param=pbResolveAudioFile(param,volume,pitch)
if param.name && param.name!=""
param = pbResolveAudioFile(param, volume, pitch)
if param.name && param.name != ""
if $game_system && $game_system.respond_to?("bgs_play")
$game_system.bgs_play(param)
return
elsif (RPG.const_defined?(:BGS) rescue false)
b=RPG::BGS.new(param.name,param.volume,param.pitch)
b = RPG::BGS.new(param.name, param.volume, param.pitch)
if b && b.respond_to?("play")
b.play; return
end
end
Audio.bgs_play(canonicalize("Audio/BGS/"+param.name),param.volume,param.pitch)
Audio.bgs_play(canonicalize("Audio/BGS/" + param.name), param.volume, param.pitch)
end
end
# Fades out or stops BGS playback. 'x' is the time in seconds to fade out.
def pbBGSFade(x=0.0); pbBGSStop(x);end
def pbBGSFade(x = 0.0)
; pbBGSStop(x);
end
# Fades out or stops BGS playback. 'x' is the time in seconds to fade out.
def pbBGSStop(timeInSeconds=0.0)
if $game_system && timeInSeconds>0.0 && $game_system.respond_to?("bgs_fade")
def pbBGSStop(timeInSeconds = 0.0)
if $game_system && timeInSeconds > 0.0 && $game_system.respond_to?("bgs_fade")
$game_system.bgs_fade(timeInSeconds)
return
elsif $game_system && $game_system.respond_to?("bgs_play")
@@ -179,12 +215,12 @@ def pbBGSStop(timeInSeconds=0.0)
return
elsif (RPG.const_defined?(:BGS) rescue false)
begin
(timeInSeconds>0.0) ? RPG::BGS.fade((timeInSeconds*1000).floor) : RPG::BGS.stop
(timeInSeconds > 0.0) ? RPG::BGS.fade((timeInSeconds * 1000).floor) : RPG::BGS.stop
return
rescue
end
end
(timeInSeconds>0.0) ? Audio.bgs_fade((timeInSeconds*1000).floor) : Audio.bgs_stop
(timeInSeconds > 0.0) ? Audio.bgs_fade((timeInSeconds * 1000).floor) : Audio.bgs_stop
end
################################################################################
@@ -198,30 +234,32 @@ end
# filename:volume:pitch
# volume -- Volume of the file, up to 100
# pitch -- Pitch of the file, normally 100
def pbSEPlay(param,volume=nil,pitch=nil)
def pbSEPlay(param, volume = nil, pitch = nil)
return if !param
param = pbResolveAudioFile(param,volume,pitch)
if param.name && param.name!=""
param = pbResolveAudioFile(param, volume, pitch)
if param.name && param.name != ""
if $game_system && $game_system.respond_to?("se_play")
$game_system.se_play(param)
return
end
if (RPG.const_defined?(:SE) rescue false)
b = RPG::SE.new(param.name,param.volume,param.pitch)
b = RPG::SE.new(param.name, param.volume, param.pitch)
if b && b.respond_to?("play")
b.play
return
end
end
Audio.se_play(canonicalize("Audio/SE/"+param.name),param.volume,param.pitch)
Audio.se_play(canonicalize("Audio/SE/" + param.name), param.volume, param.pitch)
end
end
# Stops SE playback.
def pbSEFade(x=0.0); pbSEStop(x);end
def pbSEFade(x = 0.0)
; pbSEStop(x);
end
# Stops SE playback.
def pbSEStop(_timeInSeconds=0.0)
def pbSEStop(_timeInSeconds = 0.0)
if $game_system
$game_system.se_stop
elsif (RPG.const_defined?(:SE) rescue false)
@@ -236,58 +274,58 @@ end
# Plays a sound effect that plays when the player moves the cursor.
def pbPlayCursorSE
if $data_system && $data_system.respond_to?("cursor_se") &&
$data_system.cursor_se && $data_system.cursor_se.name!=""
$data_system.cursor_se && $data_system.cursor_se.name != ""
pbSEPlay($data_system.cursor_se)
elsif $data_system && $data_system.respond_to?("sounds") &&
$data_system.sounds && $data_system.sounds[0] && $data_system.sounds[0].name!=""
$data_system.sounds && $data_system.sounds[0] && $data_system.sounds[0].name != ""
pbSEPlay($data_system.sounds[0])
elsif FileTest.audio_exist?("Audio/SE/GUI sel cursor")
pbSEPlay("GUI sel cursor",80)
pbSEPlay("GUI sel cursor", 80)
end
end
# Plays a sound effect that plays when a decision is confirmed or a choice is made.
def pbPlayDecisionSE
if $data_system && $data_system.respond_to?("decision_se") &&
$data_system.decision_se && $data_system.decision_se.name!=""
$data_system.decision_se && $data_system.decision_se.name != ""
pbSEPlay($data_system.decision_se)
elsif $data_system && $data_system.respond_to?("sounds") &&
$data_system.sounds && $data_system.sounds[1] && $data_system.sounds[1].name!=""
$data_system.sounds && $data_system.sounds[1] && $data_system.sounds[1].name != ""
pbSEPlay($data_system.sounds[1])
elsif FileTest.audio_exist?("Audio/SE/GUI sel decision")
pbSEPlay("GUI sel decision",80)
pbSEPlay("GUI sel decision", 80)
end
end
# Plays a sound effect that plays when a choice is canceled.
def pbPlayCancelSE
if $data_system && $data_system.respond_to?("cancel_se") &&
$data_system.cancel_se && $data_system.cancel_se.name!=""
$data_system.cancel_se && $data_system.cancel_se.name != ""
pbSEPlay($data_system.cancel_se)
elsif $data_system && $data_system.respond_to?("sounds") &&
$data_system.sounds && $data_system.sounds[2] && $data_system.sounds[2].name!=""
$data_system.sounds && $data_system.sounds[2] && $data_system.sounds[2].name != ""
pbSEPlay($data_system.sounds[2])
elsif FileTest.audio_exist?("Audio/SE/GUI sel cancel")
pbSEPlay("GUI sel cancel",80)
pbSEPlay("GUI sel cancel", 80)
end
end
# Plays a buzzer sound effect.
def pbPlayBuzzerSE
if $data_system && $data_system.respond_to?("buzzer_se") &&
$data_system.buzzer_se && $data_system.buzzer_se.name!=""
$data_system.buzzer_se && $data_system.buzzer_se.name != ""
pbSEPlay($data_system.buzzer_se)
elsif $data_system && $data_system.respond_to?("sounds") &&
$data_system.sounds && $data_system.sounds[3] && $data_system.sounds[3].name!=""
$data_system.sounds && $data_system.sounds[3] && $data_system.sounds[3].name != ""
pbSEPlay($data_system.sounds[3])
elsif FileTest.audio_exist?("Audio/SE/GUI sel buzzer")
pbSEPlay("GUI sel buzzer",80)
pbSEPlay("GUI sel buzzer", 80)
end
end
# Plays a sound effect that plays when the player moves the cursor.
def pbPlayCloseMenuSE
if FileTest.audio_exist?("Audio/SE/GUI menu close")
pbSEPlay("GUI menu close",80)
pbSEPlay("GUI menu close", 80)
end
end