=begin ▼ レスポンス向上 ver. 1.3 RPGツクールVXAce用スクリプト 制作 : 木星ペンギン URL : http://woodpenguin.blog.fc2.com/ ------------------------------------------------------------------------------ 概要 ゲームプレイ中、キー入力を受け付けない時間を短縮します。 ------------------------------------------------------------------------------ 内容 01 : メニュー背景にぼかし効果をかけない 02 : 顔グラフィックをキャッシュに保存 03 : 各シーン変更時のトランジションやフェードの時間調整 04 : 方向キーのリピート速度向上 05 : トランジション中もキー入力を受け付けるようにする 06 : 場所移動にトランジション擬似再現を使用 07 : 戦闘終了時の暗転を無くす =end #////////////////////////////////////////////////////////////////////////////// # # 01 : メニュー背景にぼかし効果をかけない # #////////////////////////////////////////////////////////////////////////////// module SceneManager #-------------------------------------------------------------------------- # ☆ 背景として使うためのスナップショット作成 #-------------------------------------------------------------------------- def self.snapshot_for_background @background_bitmap.dispose if @background_bitmap @background_bitmap = Graphics.snap_to_bitmap #@background_bitmap.blur end end #////////////////////////////////////////////////////////////////////////////// # # 02 : 顔グラフィックをキャッシュに保存 # #////////////////////////////////////////////////////////////////////////////// class Window_Base < Window #-------------------------------------------------------------------------- # ☆ 顔グラフィックの描画 #-------------------------------------------------------------------------- def draw_face(face_name, face_index, x, y, enabled = true) bitmap = Cache.face(face_name) rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96) contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha) #bitmap.dispose end end #////////////////////////////////////////////////////////////////////////////// # # 03 : 各シーン変更時のトランジションやフェードの時間調整 # #////////////////////////////////////////////////////////////////////////////// class Scene_Base #-------------------------------------------------------------------------- # ☆ トランジション速度の取得 #-------------------------------------------------------------------------- def transition_speed return 10 end end class Scene_Title #-------------------------------------------------------------------------- # ☆ トランジション速度の取得 #-------------------------------------------------------------------------- def transition_speed return 20 end end class Scene_Map #-------------------------------------------------------------------------- # ☆ トランジション速度の取得 #-------------------------------------------------------------------------- def transition_speed return 15 end #-------------------------------------------------------------------------- # ☆ 戦闘前トランジション実行 #-------------------------------------------------------------------------- def perform_battle_transition d = 60 # ←ここを変更 Graphics.transition(d, "Graphics/System/BattleStart", 100) Graphics.freeze end #-------------------------------------------------------------------------- # ☆ フェードアウト速度の取得 #-------------------------------------------------------------------------- def fadeout_speed return 30 end #-------------------------------------------------------------------------- # ☆ フェードイン速度の取得 #-------------------------------------------------------------------------- def fadein_speed return 30 end #-------------------------------------------------------------------------- # ☆ タイトル画面遷移用フェードアウト速度の取得 #-------------------------------------------------------------------------- def fadeout_speed_to_title return 60 end end #////////////////////////////////////////////////////////////////////////////// # # 04 : 方向キーのリピート速度向上 # #////////////////////////////////////////////////////////////////////////////// class << Input @@press_count = {DOWN:0, LEFT:0, RIGHT:0, UP:0} WDTK_INTERVAL = 4 # リピートの間隔 #-------------------------------------------------------------------------- # ◯ フレーム更新 #-------------------------------------------------------------------------- alias _wdtk_resinp_update update def update _wdtk_resinp_update @@press_count.each do |key, value| @@press_count[key] = (press?(key) ? value + 1 : 0) end end #-------------------------------------------------------------------------- # ◯ 新たに押されたかどうか (リピート) #-------------------------------------------------------------------------- alias _wdtk_resinp_repeat? repeat? def repeat?(sym) if (c = @@press_count[sym]) c == 1 || (c > WDTK_INTERVAL * 2 && c % WDTK_INTERVAL == 0) else _wdtk_resinp_repeat?(sym) end end end #////////////////////////////////////////////////////////////////////////////// # # 05 : トランジション中もキー入力を受け付けるようにする # #////////////////////////////////////////////////////////////////////////////// module SceneManager #-------------------------------------------------------------------------- # ● モジュールのインスタンス変数 #-------------------------------------------------------------------------- @echo_bitmap = nil # エコー用ビットマップ #-------------------------------------------------------------------------- # ● エコーとして使うためのスナップショット作成 #-------------------------------------------------------------------------- def self.snapshot_for_echo @echo_bitmap.dispose if @echo_bitmap @echo_bitmap = Graphics.snap_to_bitmap end #-------------------------------------------------------------------------- # ● エコー用ビットマップを取得 #-------------------------------------------------------------------------- def self.echo_bitmap @echo_bitmap end end class Scene_Base #-------------------------------------------------------------------------- # ○ フレーム更新(基本) #-------------------------------------------------------------------------- alias _wdtk_resinp_update_basic update_basic def update_basic _wdtk_resinp_update_basic update_echo end #-------------------------------------------------------------------------- # ○ 終了前処理 #-------------------------------------------------------------------------- alias _wdtk_resinp_pre_terminate pre_terminate def pre_terminate SceneManager.snapshot_for_echo _wdtk_resinp_pre_terminate dispose_echo end #-------------------------------------------------------------------------- # ○ トランジション実行 #-------------------------------------------------------------------------- alias _wdtk_resinp_perform_transition perform_transition def perform_transition if Graphics.brightness == 0 Graphics.brightness = 255 @viewport.color.set(0, 0, 0, 255) SceneManager.snapshot_for_echo end Graphics.transition(0) start_echo end #-------------------------------------------------------------------------- # ● エコーの開始 #-------------------------------------------------------------------------- def start_echo(duration = transition_speed) @echo_sprite ||= Sprite.new @echo_sprite.bitmap = SceneManager.echo_bitmap @echo_sprite.z = 999 @echo_sprite.opacity = 255 @echo_duration = duration end #-------------------------------------------------------------------------- # ● エコーの解放 #-------------------------------------------------------------------------- def dispose_echo if @echo_sprite @echo_sprite.dispose @echo_sprite = nil end end #-------------------------------------------------------------------------- # ● エコーの更新 #-------------------------------------------------------------------------- def update_echo if @echo_sprite @echo_sprite.opacity -= 256 / @echo_duration dispose_echo if @echo_sprite.opacity == 0 end end end class Scene_Title < Scene_Base #-------------------------------------------------------------------------- # ● トランジション実行 #-------------------------------------------------------------------------- def perform_transition _wdtk_resinp_perform_transition end end #////////////////////////////////////////////////////////////////////////////// # # 06 : 場所移動にトランジション擬似再現を使用 # #////////////////////////////////////////////////////////////////////////////// class Scene_Map < Scene_Base #-------------------------------------------------------------------------- # ● 定数 #-------------------------------------------------------------------------- TRANSFER_SW_ID = 0 # トランジション擬似再現を有効にするスイッチ ID # 0 で常時 ON #-------------------------------------------------------------------------- # ◯ 場所移動前の処理 #-------------------------------------------------------------------------- alias _wdtk_resinp_pre_transfer pre_transfer def pre_transfer _wdtk_resinp_pre_transfer if TRANSFER_SW_ID == 0 || $game_switches[TRANSFER_SW_ID] SceneManager.snapshot_for_echo if $game_temp.fade_type != 0 end end #-------------------------------------------------------------------------- # ◯ 場所移動後の処理 #-------------------------------------------------------------------------- alias _wdtk_resinp_post_transfer post_transfer def post_transfer if TRANSFER_SW_ID == 0 || $game_switches[TRANSFER_SW_ID] case $game_temp.fade_type when 0 Graphics.wait(fadein_speed / 2) Graphics.brightness = 255 @viewport.color.set(0, 0, 0, 255) SceneManager.snapshot_for_echo @viewport.color.set(0, 0, 0, 0) start_echo(fadein_speed) when 1 Graphics.wait(fadein_speed / 2) @viewport.color.set(0, 0, 0, 0) start_echo(fadein_speed) when 2 start_echo end @map_name_window.open else _wdtk_resinp_post_transfer end end end #////////////////////////////////////////////////////////////////////////////// # # 07 : 戦闘終了時の暗転を無くす # #////////////////////////////////////////////////////////////////////////////// class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ☆ 終了前処理 #-------------------------------------------------------------------------- def pre_terminate super #Graphics.fadeout(30) if SceneManager.scene_is?(Scene_Map) #Graphics.fadeout(60) if SceneManager.scene_is?(Scene_Title) end end