diff --git a/Data/Scripts/007_Objects and windows/002_MessageConfig.rb b/Data/Scripts/007_Objects and windows/002_MessageConfig.rb index 62146dd6e..3eec6c873 100644 --- a/Data/Scripts/007_Objects and windows/002_MessageConfig.rb +++ b/Data/Scripts/007_Objects and windows/002_MessageConfig.rb @@ -232,7 +232,7 @@ end def pbRepositionMessageWindow(msgwindow, linecount=2) msgwindow.height=32*linecount+msgwindow.borderY msgwindow.y=(Graphics.height)-(msgwindow.height) - if $game_system && $game_system.respond_to?("message_position") + if $game_system case $game_system.message_position when 0 # up msgwindow.y=0 @@ -241,11 +241,7 @@ def pbRepositionMessageWindow(msgwindow, linecount=2) when 2 msgwindow.y=(Graphics.height)-(msgwindow.height) end - end - if $game_system && $game_system.respond_to?("message_frame") - if $game_system.message_frame != 0 - msgwindow.opacity = 0 - end + msgwindow.opacity = 0 if $game_system.message_frame != 0 end end diff --git a/Data/Scripts/007_Objects and windows/011_Messages.rb b/Data/Scripts/007_Objects and windows/011_Messages.rb index 029698490..382938bda 100644 --- a/Data/Scripts/007_Objects and windows/011_Messages.rb +++ b/Data/Scripts/007_Objects and windows/011_Messages.rb @@ -1,73 +1,8 @@ #=============================================================================== # #=============================================================================== -class Scene_Map - def updatemini - oldmws=$game_temp.message_window_showing - $game_temp.message_window_showing=true - loop do - $game_map.update - $game_player.update - $game_system.update - if $game_screen - $game_screen.update - else - $game_map.screen.update - end - break unless $game_temp.player_transferring - transfer_player - break if $game_temp.transition_processing - end - $game_temp.message_window_showing=oldmws - @spriteset.update if @spriteset - @message_window.update if @message_window - end -end - - - -class Scene_Battle - def updatemini - if self.respond_to?("update_basic") - update_basic(true) - update_info_viewport # Update information viewport - else - oldmws=$game_temp.message_window_showing - $game_temp.message_window_showing=true - # Update system (timer) and screen - $game_system.update - if $game_screen - $game_screen.update - else - $game_map.screen.update - end - # If timer has reached 0 - if $game_system.timer_working && $game_system.timer == 0 - # Abort battle - $game_temp.battle_abort = true - end - # Update windows - @help_window.update if @help_window - @party_command_window.update if @party_command_window - @actor_command_window.update if @actor_command_window - @status_window.update if @status_window - $game_temp.message_window_showing=oldmws - @message_window.update if @message_window - # Update sprite set - @spriteset.update if @spriteset - end - end -end - - - def pbMapInterpreter - if $game_map.respond_to?("interpreter") - return $game_map.interpreter - elsif $game_system - return $game_system.map_interpreter - end - return nil + return $game_system&.map_interpreter end def pbMapInterpreterRunning? @@ -76,27 +11,11 @@ def pbMapInterpreterRunning? end def pbRefreshSceneMap - if $scene && $scene.is_a?(Scene_Map) - if $scene.respond_to?("miniupdate") - $scene.miniupdate - else - $scene.updatemini - end - elsif $scene && $scene.is_a?(Scene_Battle) - $scene.updatemini - end + $scene.miniupdate if $scene && $scene.is_a?(Scene_Map) end def pbUpdateSceneMap - if $scene && $scene.is_a?(Scene_Map) && !pbIsFaded? - if $scene.respond_to?("miniupdate") - $scene.miniupdate - else - $scene.updatemini - end - elsif $scene && $scene.is_a?(Scene_Battle) - $scene.updatemini - end + $scene.miniupdate if $scene && $scene.is_a?(Scene_Map) && !pbIsFaded? end #=============================================================================== @@ -406,17 +325,7 @@ end # Money and coins windows #=============================================================================== def pbGetGoldString - moneyString="" - begin - moneyString=_INTL("${1}", $player.money.to_s_formatted) - rescue - if $data_system.respond_to?("words") - moneyString=_INTL("{1} {2}",$game_party.gold,$data_system.words.gold) - else - moneyString=_INTL("{1} {2}",$game_party.gold,Vocab.gold) - end - end - return moneyString + return _INTL("${1}", $player.money.to_s_formatted) end def pbDisplayGoldWindow(msgwindow) @@ -583,8 +492,7 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil) break if text == last_text end colortag = "" - if $game_system && $game_system.respond_to?("message_frame") && - $game_system.message_frame != 0 + if $game_system && $game_system.message_frame != 0 colortag = getSkinColor(msgwindow.windowskin,0,true) else colortag = getSkinColor(msgwindow.windowskin,0,isDarkSkin) diff --git a/Data/Scripts/008_Audio/002_Audio_Play.rb b/Data/Scripts/008_Audio/002_Audio_Play.rb index af7856ab8..b171f6af2 100644 --- a/Data/Scripts/008_Audio/002_Audio_Play.rb +++ b/Data/Scripts/008_Audio/002_Audio_Play.rb @@ -53,7 +53,7 @@ def pbBGMPlay(param,volume=nil,pitch=nil) return if !param param=pbResolveAudioFile(param,volume,pitch) if param.name && param.name!="" - if $game_system && $game_system.respond_to?("bgm_play") + if $game_system $game_system.bgm_play(param) return elsif (RPG.const_defined?(:BGM) rescue false) @@ -72,10 +72,10 @@ 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") + if $game_system && timeInSeconds > 0.0 $game_system.bgm_fade(timeInSeconds) return - elsif $game_system && $game_system.respond_to?("bgm_stop") + elsif $game_system $game_system.bgm_stop return elsif (RPG.const_defined?(:BGM) rescue false) @@ -103,7 +103,7 @@ def pbMEPlay(param,volume=nil,pitch=nil) return if !param param=pbResolveAudioFile(param,volume,pitch) if param.name && param.name!="" - if $game_system && $game_system.respond_to?("me_play") + if $game_system $game_system.me_play(param) return elsif (RPG.const_defined?(:ME) rescue false) @@ -153,7 +153,7 @@ def pbBGSPlay(param,volume=nil,pitch=nil) return if !param param=pbResolveAudioFile(param,volume,pitch) if param.name && param.name!="" - if $game_system && $game_system.respond_to?("bgs_play") + if $game_system $game_system.bgs_play(param) return elsif (RPG.const_defined?(:BGS) rescue false) @@ -172,10 +172,10 @@ 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") + if $game_system && timeInSeconds > 0.0 $game_system.bgs_fade(timeInSeconds) return - elsif $game_system && $game_system.respond_to?("bgs_play") + elsif $game_system $game_system.bgs_play(nil) return elsif (RPG.const_defined?(:BGS) rescue false) @@ -203,7 +203,7 @@ def pbSEPlay(param,volume=nil,pitch=nil) return if !param param = pbResolveAudioFile(param,volume,pitch) if param.name && param.name!="" - if $game_system && $game_system.respond_to?("se_play") + if $game_system $game_system.se_play(param) return end @@ -236,12 +236,8 @@ 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!="" + if !nil_or_empty?($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!="" - pbSEPlay($data_system.sounds[0]) elsif FileTest.audio_exist?("Audio/SE/GUI sel cursor") pbSEPlay("GUI sel cursor",80) end @@ -249,12 +245,8 @@ 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!="" + if !nil_or_empty?($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!="" - pbSEPlay($data_system.sounds[1]) elsif FileTest.audio_exist?("Audio/SE/GUI sel decision") pbSEPlay("GUI sel decision",80) end @@ -262,12 +254,8 @@ 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!="" + if !nil_or_empty?($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!="" - pbSEPlay($data_system.sounds[2]) elsif FileTest.audio_exist?("Audio/SE/GUI sel cancel") pbSEPlay("GUI sel cancel",80) end @@ -275,12 +263,8 @@ 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!="" + if !nil_or_empty?($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!="" - pbSEPlay($data_system.sounds[3]) elsif FileTest.audio_exist?("Audio/SE/GUI sel buzzer") pbSEPlay("GUI sel buzzer",80) end