mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Added decent spacing to all scripts thanks to Rubocop
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#####################################
|
||||
# Needed because RGSS doesn't call at_exit procs on exit
|
||||
# Exit is not called when game is reset (using F12)
|
||||
$AtExitProcs=[] if !$AtExitProcs
|
||||
$AtExitProcs = [] if !$AtExitProcs
|
||||
|
||||
def exit(code = 0)
|
||||
for p in $AtExitProcs
|
||||
@@ -127,7 +127,7 @@ def getPlayTime2(filename)
|
||||
data = fgetdw.call(file)
|
||||
return -1 if data != 0x61746164 # "data"
|
||||
datasize = fgetdw.call(file)
|
||||
time = (datasize*1.0)/bytessec
|
||||
time = (datasize * 1.0) / bytessec
|
||||
return time
|
||||
elsif fdw == 0x5367674F # "OggS"
|
||||
file.pos = 0
|
||||
|
||||
@@ -3,13 +3,13 @@ def pbStringToAudioFile(str)
|
||||
file = $1
|
||||
volume = $2.to_i
|
||||
pitch = $3.to_i
|
||||
return RPG::AudioFile.new(file,volume,pitch)
|
||||
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,7 +21,7 @@ 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
|
||||
@@ -49,21 +49,21 @@ 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)
|
||||
if param.name && param.name!=""
|
||||
param = pbResolveAudioFile(param, volume, pitch)
|
||||
if param.name && param.name != ""
|
||||
if $game_system
|
||||
$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
|
||||
|
||||
@@ -80,12 +80,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
|
||||
|
||||
################################################################################
|
||||
@@ -99,21 +99,21 @@ 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.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
|
||||
|
||||
@@ -122,7 +122,7 @@ 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")
|
||||
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 +130,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,21 +149,21 @@ 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.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
|
||||
|
||||
@@ -180,12 +180,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
|
||||
|
||||
################################################################################
|
||||
@@ -199,22 +199,22 @@ 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.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
|
||||
|
||||
@@ -239,7 +239,7 @@ def pbPlayCursorSE
|
||||
if !nil_or_empty?($data_system&.cursor_se&.name)
|
||||
pbSEPlay($data_system.cursor_se)
|
||||
elsif FileTest.audio_exist?("Audio/SE/GUI sel cursor")
|
||||
pbSEPlay("GUI sel cursor",80)
|
||||
pbSEPlay("GUI sel cursor", 80)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -248,7 +248,7 @@ def pbPlayDecisionSE
|
||||
if !nil_or_empty?($data_system&.decision_se&.name)
|
||||
pbSEPlay($data_system.decision_se)
|
||||
elsif FileTest.audio_exist?("Audio/SE/GUI sel decision")
|
||||
pbSEPlay("GUI sel decision",80)
|
||||
pbSEPlay("GUI sel decision", 80)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -257,7 +257,7 @@ def pbPlayCancelSE
|
||||
if !nil_or_empty?($data_system&.cancel_se&.name)
|
||||
pbSEPlay($data_system.cancel_se)
|
||||
elsif FileTest.audio_exist?("Audio/SE/GUI sel cancel")
|
||||
pbSEPlay("GUI sel cancel",80)
|
||||
pbSEPlay("GUI sel cancel", 80)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -266,13 +266,13 @@ def pbPlayBuzzerSE
|
||||
if !nil_or_empty?($data_system&.buzzer_se&.name)
|
||||
pbSEPlay($data_system.buzzer_se)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user