#=========================================================================== # ◆ A1 Scripts ◆ # VXAceで他ツクールのRTPを使用(RGSS3) # # バージョン : 3.00 (2020/06/14) # 作者 : A1 # URL     : http://a1tktk.web.fc2.com/ #--------------------------------------------------------------------------- # 機能: # ・RPGツクール2000/2003/XP/VXのRTPを使用します # ・RPGツクール2000/2003/XP 規格の素材をVXAce素材に合わせて使用します #--------------------------------------------------------------------------- # 更新履歴   :2011/12/15 Ver1.00 リリース #    :2011/12/31 Ver2.00 マップの設定で遠景設定機能追加 #    :2011/12/31 Ver2.00 イベント名で使用素材設定機能追加 #    :2011/12/31 Ver2.00 RPGツクール2000機能「透明化」追加 #    :2011/12/31 Ver2.00 RTPのパス取得チェック関数追加 #    :2012/01/02 Ver2.10 A1共通スクリプトVer3.30対応 #    :2020/06/14 Ver3.00 A1共通スクリプトVer5.30対応 #    :2020/06/14 Ver3.00 BGM演奏を注釈のみで実行可能に修正 #--------------------------------------------------------------------------- # 設置場所 #  なるべく上の方 # A1共通スクリプト・Win32API共通スクリプト以下 # # 必要スクリプト # A1共通スクリプトVer3.30以上 # API共通スクリプト # イベントコマンド拡張 # # 必要ファイル # System ディレクトリに opacity.dat が必要 #--------------------------------------------------------------------------- # 使い方 # 設定項目を設定することにより、設定したRTPを使います # # 注釈で使用する素材を指定します # # 演奏 [種類],[RTP名]_[ファイル名],[volume(省略可)],[pitch(省略可)] # # 指定したオーディオファイルを演奏します # 例: # ◆注釈:演奏 BGM,2003_2003地下迷宮 # # 「移動ルートの設定」の「スクリプト」で使用する素材を指定します # # next_character([RTP名]_[ファイル名],[Index]) # 例: # ◆移動ルートの設定:[EV001] (ウェイト) # :◇スクリプト:next_character(2000_主人公1,0) # :◇グラフィック:(なし) # # データベースのメモで使用する素材を指定します # # 例:「アクター」のデータベース # # <顔 2000_主人公1,0> # <歩行 2000_主人公1,0> # # 例:「敵キャラ」のデータベース # # <素材 2003_アンデッドナイト> # # 例:「アイテム」「スキル」「ステート」のデータベース (VX/VXAce規格のみ) # # # # 例:「タイルセット」のデータベース (VX/VXAce規格のみ) # # # # # # # # # # # # 「マップ設定」のメモで遠景を指定します # # 例:<遠景設定 2000_空1> # 例:<遠景拡大 1280,960> # # 「マップ設定」のメモで自動切替のBGMを指定します # # 例: # # イベント名でキャラクターグラフィック・Indexを指定します # # [P(no) name,index] no :ページNo # name :キャラクターグラフィックファイル名 # index:キャラクターグラフィックIndex # # 例:イベント名[P1 2000_主人公1,0] ※このイベントの、イベントページ1のグラフィックを # RPGツクール2000RTPの「主人公1」Index0にします # 例:イベント名[P0 2000_主人公1,0] ※このイベントの、全てのページのグラフィックを # RPGツクール2000RTPの「主人公1」Index0にします # # イベント名でキャラクターグラフィックの透明度を設定します # # [P(no)Op opacity] opacity :透明度 # # 例:イベント名[P1Op 128] ※このイベントの、イベントページ1のグラフィックを半透明にします # 例:イベント名[P0Op 128] ※このイベントの、全てのページのグラフィックを半透明にします # # RTPのパス取得チェック関数 # $a1_common.chk_other_rtp # # 2000/2003/XP/VX 全てのRTPパスを取得できた場合 true を返します #--------------------------------------------------------------------------- # 免責 # このツールを使用したことにより何らかの損害が生じても、当方は一切責任を負いません # 自己責任でご利用ください # # 念のため、使用前には必ずバックアップを取っておいてください。 #============================================================================== $imported ||= {} $imported["A1_UseOtherRTP"] = 3.00 if $imported["A1_Common_Script"] >= 5.30 and $imported["A1_Win32API"] old_common_script("VXAceで他ツクールのRTP使用", "5.30") if common_version < 5.30 #============================================================================== # ■ 設定項目 #============================================================================== module A1_System::UseOtherRTP #-------------------------------------------------------------------------- # スタート時、他のRTPを使用する #-------------------------------------------------------------------------- USE_OTHER_RTP = true #-------------------------------------------------------------------------- # RPGツクールVX RTPの Graphics/System ディレクトリを使用する #-------------------------------------------------------------------------- USE_VX_SYSTEM = false #-------------------------------------------------------------------------- # タイトル画面とAudio関連に以下の設定を使用する #-------------------------------------------------------------------------- USE_SYSTEM_SET = true #-------------------------------------------------------------------------- # 使用するタイトル画面のファイル名 # [RTP名]_[ファイル名] #-------------------------------------------------------------------------- GRAPHICS = { "Title1" => "2000_タイトル1", "Title2" => "", } #-------------------------------------------------------------------------- # 使用するBGMのファイル名 # [RTP名]_[ファイル名] #-------------------------------------------------------------------------- BGM = { "Title" => ["2000_オープニング1", 100, 100], # タイトル画面 "Battle" => ["2000_戦闘1", 100, 100], # バトル "Bort" => ["2000_乗り物1", 100, 100], # 小型船 "Ship" => ["2000_乗り物1", 100, 100], # 大型船 "AirShip" => ["2000_乗り物3", 100, 100], # 飛空船 } #-------------------------------------------------------------------------- # 使用するMEのファイル名 # [RTP名]_[ファイル名] #-------------------------------------------------------------------------- ME = { "BattleEnd" => ["2000_J戦闘終了4", 100, 100], # バトル終了 "GameOver" => ["2000_ゲームオーバー3", 100, 100], # ゲームオーバー } #-------------------------------------------------------------------------- # 使用するSEのファイル名 # [RTP名]_[ファイル名] #-------------------------------------------------------------------------- SE = [ ["2000_カーソル1", 80, 100], # カーソル移動 ["2000_決定1", 80, 100], # 決定 ["2000_キャンセル1", 80, 100], # キャンセル ["2000_ブザー1", 80, 100], # ブザー ["2000_決定1", 80, 100], # 装備 ["2000_決定2", 80, 100], # セーブ ["2000_決定2", 80, 100], # ロード ["2000_戦闘1", 80, 100], # 戦闘開始 ["2000_逃走", 80, 100], # 逃走 ["2000_攻撃1", 80, 100], # 敵の通常攻撃 ["2000_ダメージ2", 80, 100], # 敵ダメージ ["2000_消滅1", 80, 100], # 敵消滅 ["2000_消滅1", 80, 100], # ボス消滅 1 ["2000_消滅1", 80, 100], # ボス消滅 2 ["2000_ダメージ1", 80, 100], # 味方ダメージ ["2000_消滅2", 80, 100], # 味方戦闘不能 ["2000_回復3", 80, 100], # 回復 ["2000_回避2", 80, 100], # ミス ["2000_回避2", 80, 100], # 攻撃回避 ["2000_回避2", 80, 100], # 魔法回避 ["2000_フラッシュ1", 80, 100], # 魔法反射 ["2000_決定1", 80, 100], # ショップ ["2000_アイテム1", 80, 100], # アイテム使用 ["2000_アイテム2", 80, 100], # スキル使用 ] end #============================================================================== # ■ RPG::Map #============================================================================== class RPG::Map #-------------------------------------------------------------------------- # ○ 遠景の設定 #-------------------------------------------------------------------------- def parallax_name @ex_parallax ||= $a1_common.note_data_one(self.note, "遠景設定", "") @parallax_name = @ex_parallax unless @ex_parallax.empty? $game_temp.parallax_fix = true if $a1_common.note_data(self.note, "遠景FIX") return @parallax_name end #-------------------------------------------------------------------------- # ○ 遠景の拡大率 #-------------------------------------------------------------------------- def resize_parallax @resize_parallax ||= $a1_common.note_data_array_value(self.note, "遠景拡大", []) return nil if @resize_parallax.empty? return @resize_parallax end #-------------------------------------------------------------------------- # ○ BGM #-------------------------------------------------------------------------- def bgm bgm_info = $a1_common.note_data_array_value(self.note, "BGM", []) return @bgm if bgm_info.empty? volume = bgm_info[1] ? bgm_info[1] : 100 pitch = bgm_info[2] ? bgm_info[2] : 100 @bgm = RPG::BGM.new(bgm_info[0],volume,pitch) return @bgm end end #============================================================================== # ■ RPG::BaseItem #============================================================================== class RPG::BaseItem #-------------------------------------------------------------------------- # ○ VXアイコンセット使用設定 #-------------------------------------------------------------------------- def set_vx_iconset @vx_icon = false @vx_icon = true if $a1_common.note_data(self.note, "VXアイコン") end #-------------------------------------------------------------------------- # ○ VXアイコンセット使用 #-------------------------------------------------------------------------- def vx_icon? @vx_icon ||= set_vx_iconset return @vx_icon end #-------------------------------------------------------------------------- # ○ アイコンIndex取得 #-------------------------------------------------------------------------- def icon_index @icon_index *= -1 if vx_icon? == true and @icon_index > 0 return @icon_index end end #============================================================================== # ■ Game_Option #============================================================================== class Game_Option #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :use_other_rtp #-------------------------------------------------------------------------- # ☆ オブジェクト初期化 #-------------------------------------------------------------------------- alias a1_other_rtp_go_initialize initialize def initialize a1_other_rtp_go_initialize @use_other_rtp = false end end #============================================================================== # ■ DataManager #------------------------------------------------------------------------------ #  データベースとゲームオブジェクトを管理するモジュールです。ゲームで使用する # ほぼ全てのグローバル変数はこのモジュールで初期化されます。 #============================================================================== module DataManager #-------------------------------------------------------------------------- # ○ 定数 #-------------------------------------------------------------------------- SYSTEM_BGM = A1_System::UseOtherRTP::BGM SYSTEM_ME = A1_System::UseOtherRTP::ME SYSTEM_SE = A1_System::UseOtherRTP::SE GRAPHICS = A1_System::UseOtherRTP::GRAPHICS USE_SYSTEM_SET = A1_System::UseOtherRTP::USE_SYSTEM_SET #-------------------------------------------------------------------------- # ○ エイリアス用特異メソッド #-------------------------------------------------------------------------- class << self alias :a1_other_rtp_create_game_objects :create_game_objects end #-------------------------------------------------------------------------- # ☆ 各種ゲームオブジェクトの作成 #-------------------------------------------------------------------------- def self.create_game_objects a1_other_rtp_create_game_objects load_other_rtp load_system_objects if USE_SYSTEM_SET end #-------------------------------------------------------------------------- # ○ 他RTPシステムオブジェクトのロード #-------------------------------------------------------------------------- def self.load_system_objects SYSTEM_SE.each_with_index {|se, i|$data_system.sounds[i] = $a1_common.set_audio(se,"SE")} $data_system.title_bgm = $a1_common.set_audio(SYSTEM_BGM["Title"], "BGM") $data_system.battle_bgm = $a1_common.set_audio(SYSTEM_BGM["Battle"], "BGM") $data_system.battle_end_me = $a1_common.set_audio(SYSTEM_ME["BattleEnd"], "ME") $data_system.gameover_me = $a1_common.set_audio(SYSTEM_ME["GameOver"], "ME") $data_system.battle_bgm = $a1_common.set_audio(SYSTEM_BGM["Battle"], "BGM") $data_system.title1_name = GRAPHICS["Title1"] $data_system.title2_name = GRAPHICS["Title2"] end #-------------------------------------------------------------------------- # ○ 他RTPのパスを取得 #-------------------------------------------------------------------------- def self.load_other_rtp $data_vxrtp ||= $a1_win32api.get_vxrtp_path $data_xprtp ||= $a1_win32api.get_xprtp_path $data_2003rtp ||= $a1_win32api.get_2003rtp_path $data_2000rtp ||= $a1_win32api.get_2000rtp_path end end #============================================================================== # ■ A1_System::CommonModule #============================================================================== class A1_System::CommonModule #-------------------------------------------------------------------------- # ○ 他RTPのパスを確認 #-------------------------------------------------------------------------- def chk_other_rtp $data_vxrtp && $data_xprtp && $data_2003rtp && $data_2000rtp end #-------------------------------------------------------------------------- # ○ 他RTPのパスを取得 #-------------------------------------------------------------------------- def othor_rtp_path(filename) rtp_path = "" info = vx_rtp_path(filename, $2, $1) if filename =~ /^([\$|!]?[\$|!]?)VX_(.+)/ info = not_vx_rtp_path(filename, rtp_path) unless info rtp_path = info[0] return exit_game($1.gsub("_","")) if rtp_path == nil return [rtp_path, info[1], filename] end #-------------------------------------------------------------------------- # ○ VX以外のパスを取得 #-------------------------------------------------------------------------- def not_vx_rtp_path(filename, rtp_path) rtp_path = $data_xprtp if filename =~ /^[\$|!]?[\$|!]?XP_(.+)/ rtp_path = $data_2003rtp if filename =~ /^2003_(.+)/ if $1 == nil rtp_path = $data_2000rtp if filename =~ /^2000_(.+)/ if $1 == nil return [rtp_path, $1] end #-------------------------------------------------------------------------- # ○ VXのパスを取得 #-------------------------------------------------------------------------- def vx_rtp_path(filename, name, sp = "") rtp_path = $data_vxrtp rtp_name = sprintf("%s%s", sp, name) return [rtp_path, rtp_name] end #-------------------------------------------------------------------------- # ○ メッセージを表示してゲーム終了 #-------------------------------------------------------------------------- def exit_game(rtp_name) msgbox("RPGツクール#{rtp_name}のRTPが見つかりません") exit end #-------------------------------------------------------------------------- # ○ 200x素材のパスを取得(透明度付与素材) #-------------------------------------------------------------------------- def load_200x_ex_path(rtp_info, folder_name, folder_vx, folder_2k) src_name = "#{rtp_info[0].gsub("\\","/")}#{folder_2k}/#{rtp_info[1]}.png" folder_name = "Graphics/#{folder_vx}/" rtp_info[1] = "Temp#{folder_vx}#{rtp_info[1]}" dst_name = "#{folder_name}#{rtp_info[1]}.png" rtp_info[0] = "" #add_opacity(src_name, dst_name) unless FileTest.exist?(dst_name) add_opacity(src_name, dst_name) unless FileCheck.bitmap_exist?(dst_name) return folder_name end #-------------------------------------------------------------------------- # ○ 200x素材のパスを取得 #-------------------------------------------------------------------------- def convert_200x(rtp_info, folder_name) return "Music/" if folder_name =~ /.*BGM.*/ return "Music/" if folder_name =~ /.*BGS.*/ return "Music/" if folder_name =~ /.*ME.*/ return "Sound/" if folder_name =~ /.*SE.*/ return "Backdrop/" if folder_name =~ /.*Battlebacks1.*/ return nil if folder_name =~ /.*Battlebacks2.*/ return "FaceSet/" if folder_name =~ /.*Faces.*/ return "Panorama/" if folder_name =~ /.*Parallaxes.*/ return "System/" if folder_name =~ /.*System.*/ return "Picture/" if folder_name =~ /.*Pictures.*/ return "ChipSet/" if folder_name =~ /.*Tilesets.*/ return "Title/" if folder_name =~ /.*Titles1.*/ return nil if folder_name =~ /.*Titles2.*/ return "BattleCharSet/" if folder_name == "BattleCharSet" return "BattleWeapon/" if folder_name == "BattleWeapon" return "GameOver/" if folder_name == "GameOver" return "System2/" if folder_name == "System2" return load_200x_ex_path(rtp_info, folder_name, $1, "CharSet") if folder_name =~ /.*(Characters).*/ return load_200x_ex_path(rtp_info, folder_name, $1, "Monster") if folder_name =~ /.*(Battlers).*/ return load_200x_ex_path(rtp_info, folder_name, $1, "Battle") if folder_name =~ /.*(Animations).*/ return folder_name end #-------------------------------------------------------------------------- # ○ XP素材のパスを取得 #-------------------------------------------------------------------------- def convert_xp(rtp_info, folder_name) return "/Graphics/Battlebacks/" if folder_name =~ /.*Battlebacks1.*/ return nil if folder_name =~ /.*Battlebacks2.*/ return nil if folder_name =~ /.*Faces.*/ return "/Graphics/Panoramas/" if folder_name =~ /.*Parallaxes.*/ return "/Graphics/Autotiles/" if folder_name == "Autotiles" return "/Graphics/Fogs/" if folder_name == "Fogs" return "/Graphics/Gameovers/" if folder_name == "Gameovers" return "/Graphics/Icons/" if folder_name == "Icons" return "/Graphics/Titles/" if folder_name == "Titles" return "/Graphics/Transitions/" if folder_name == "Transitions" return "/Graphics/Windowskins/" if folder_name == "Windowskins" return folder_name end #-------------------------------------------------------------------------- # ○ VX素材のパスを取得 #-------------------------------------------------------------------------- def convert_vx(rtp_info, folder_name) return nil if folder_name =~ /.*Battlebacks1.*/ return nil if folder_name =~ /.*Battlebacks2.*/ return nil if folder_name =~ /.*Titles2.*/ return "/Graphics/System/" if folder_name =~ /.*Titles1.*/ return convert_vx_tileset(rtp_info, folder_name, filename) if folder_name =~ /.*Tilesets.*/ return folder_name end #-------------------------------------------------------------------------- # ○ VXタイルセット素材のパスを取得 #-------------------------------------------------------------------------- def convert_vx_tileset(rtp_info, folder_name, filename) rtp_info[1] = "TileA1" if filename =~ /.*_A1.*/ rtp_info[1] = "TileA2" if filename =~ /.*_A2.*/ rtp_info[1] = "TileA3" if filename =~ /.*_A3.*/ rtp_info[1] = "TileA4" if filename =~ /.*_A4.*/ rtp_info[1] = "TileA5" if filename =~ /.*_A5.*/ rtp_info[1] = "TileB" if filename =~ /.*_B.*/ rtp_info[1] = "TileC" if filename =~ /.*_C.*/ rtp_info[1] = "TileD" if filename =~ /.*_D.*/ rtp_info[1] = "TileE" if filename =~ /.*_E.*/ return "/Graphics/System/" end #-------------------------------------------------------------------------- # ○ VXP素材のパスを取得 #-------------------------------------------------------------------------- def convert_vxp(rtp_info, folder_name, filename) folder_name = "/#{folder_name}" return convert_xp(rtp_info, folder_name) if rtp_info[2] =~ /^[\$|!]?[\$|!]?XP_.*/ return convert_vx(rtp_info, folder_name) if rtp_info[2] =~ /^[\$|!]?[\$|!]?VX_.*/ end #-------------------------------------------------------------------------- # ○ 200Xからコンバート? #-------------------------------------------------------------------------- def convert_200x?(file_name) file_name =~ /^2000_.*/ || file_name =~ /^2003_.*/ end #-------------------------------------------------------------------------- # ○ 素材のパスを取得 #-------------------------------------------------------------------------- def load_material_path(rtp_info, folder_name, filename) convert_folder = convert_200x(rtp_info, folder_name) if convert_200x?(rtp_info[2]) convert_folder = convert_vxp(rtp_info, folder_name, filename) unless convert_folder rtp_path = rtp_info[0].gsub("\\","/") if rtp_path[rtp_path.length - 1] != "/" && convert_folder[0] != "/" && rtp_path != "" load_path = "#{rtp_path}/#{convert_folder}#{rtp_info[1]}" else load_path = "#{rtp_path}#{convert_folder}#{rtp_info[1]}" end path = "#{convert_folder}#{filename}" return [load_path, path, filename] end #-------------------------------------------------------------------------- # ○ 画像に透過情報を付与 #-------------------------------------------------------------------------- def add_opacity(src_name, dst_name) srcFile = File.open( src_name, "rb" ) dstFile = File.open( dst_name, "wb" ) opacity_data = File.open( "System/opacity.dat", "rb" ) dstFile.write( srcFile.read(815) ) dstFile.write( opacity_data.read ) dstFile.write( srcFile.read ) srcFile.close dstFile.close opacity_data.close end #-------------------------------------------------------------------------- # ☆ 他のRTPを使うかチェック #-------------------------------------------------------------------------- def chk_use_other_rtp(folder_name, filename) return false if filename.empty? return false if material_exist?(folder_name, filename) if filename =~ /^[\$|!]?[\$|!]?VX_.*/ return false unless chk_directory(folder_name, "VX") else return false unless chk_directory(folder_name, "2000") end return true end #-------------------------------------------------------------------------- # ☆ 他のRTPを使うかチェック #-------------------------------------------------------------------------- def chk_directory(folder_name, kind) case kind when "VX" return false if folder_name =~ /.*Battlebacks1.*/ return false if folder_name =~ /.*Battlebacks2.*/ else return false if folder_name =~ /.*System.*/ return false if folder_name =~ /.*Tilesets.*/ end return true end #-------------------------------------------------------------------------- # ☆ どのRTPか取得 #-------------------------------------------------------------------------- def rtp_kind(file_name) return $1 if file_name =~ /^2000_.*/ return $1 if file_name =~ /^2003_.*/ return $1 if file_name =~ /^[\$|!]?[\$|!]?XP_.*/ return $1 if file_name =~ /^[\$|!]?[\$|!]?VX_.*/ return "" end end #============================================================================== # ■ RPG::Tileset #============================================================================== class RPG::Tileset #-------------------------------------------------------------------------- # ☆ タイルセットのファイル名取得 #-------------------------------------------------------------------------- def tileset_names keys = ["TileA1", "TileA2", "TileA3", "TileA4", "TileA5", "TileB", "TileC", "TileD", "TileE"] keys.each_with_index {|key, i| @tileset_names[i] = $a1_common.note_data_one(self.note, key, @tileset_names[i]) } return @tileset_names end end #============================================================================== # ■ RPG::BGM #============================================================================== class RPG::BGM < RPG::AudioFile #-------------------------------------------------------------------------- # ☆ BGMの演奏 #-------------------------------------------------------------------------- alias a1_other_rtp_bgm_play play def play(pos = 0) play_other_rtp("Audio/BGM/", :bgm_play, method(:a1_other_rtp_bgm_play), pos) @@last = self.clone end end #============================================================================== # ■ RPG::BGS #============================================================================== class RPG::BGS < RPG::AudioFile #-------------------------------------------------------------------------- # ☆ BGSの演奏 #-------------------------------------------------------------------------- alias a1_other_rtp_bgs_play play def play(pos = 0) play_other_rtp("Audio/BGS/", :bgs_play, method(:a1_other_rtp_bgs_play), pos) @@last = self.clone end end #============================================================================== # ■ RPG::ME #============================================================================== class RPG::ME < RPG::AudioFile #-------------------------------------------------------------------------- # ☆ MEの演奏 #-------------------------------------------------------------------------- alias a1_other_rtp_me_play play def play play_other_rtp("Audio/ME/", :me_play, method(:a1_other_rtp_me_play)) end end #============================================================================== # ■ RPG::SE #============================================================================== class RPG::SE < RPG::AudioFile #-------------------------------------------------------------------------- # ☆ SEの演奏 #-------------------------------------------------------------------------- alias a1_other_rtp_se_play play def play play_other_rtp("Audio/SE/", :se_play, method(:a1_other_rtp_se_play)) end end #============================================================================== # ■ RPG::AudioFile #============================================================================== class RPG::AudioFile #-------------------------------------------------------------------------- # ○ 他のRTPの演奏 #-------------------------------------------------------------------------- def play_other_rtp(folder_name, audio_symbol, method, pos = nil) @rtp_cache ||= {} return call_method(method, pos) unless proc_next?(folder_name) rtp_path = @rtp_cache[@name] return Audio.call_method(audio_symbol, rtp_path, @volume, @pitch) if rtp_path != nil rtp_info = $a1_common.othor_rtp_path(@name) return call_method(method, pos) if rtp_info[0].empty? file_name_ex = @name.clone file_name_ex.gsub!(folder_name,"") load_path = $a1_common.load_material_path(rtp_info, folder_name, file_name_ex)[0] return call_method(method, pos) if @name == nil @rtp_cache[@name] = load_path Audio.call_method(audio_symbol, load_path, @volume, @pitch) end #-------------------------------------------------------------------------- # ○ 次の実行に進む? #-------------------------------------------------------------------------- def proc_next?(folder_name) return false if @name.empty? return false if $a1_common.material_exist?(folder_name, @name, true) return false unless $a1_common.chk_use_other_rtp(folder_name, @name) return true end #-------------------------------------------------------------------------- # ○ メソッドのコール #-------------------------------------------------------------------------- def call_method(method, pos) return method.call unless pos method.call(pos) end end #============================================================================== # ■ Audio #============================================================================== module Audio #-------------------------------------------------------------------------- # ○ メソッドのコール #-------------------------------------------------------------------------- def self.call_method(audio_symbol, path, volume, pitch, pos = nil) return method(audio_symbol).call(path, volume, pitch) unless pos return method(audio_symbol).call(path, volume, pitch, pos) end end #============================================================================== # ■ Game_Map #------------------------------------------------------------------------------ #  マップを扱うクラスです。スクロールや通行可能判定などの機能を持っています。 # このクラスのインスタンスは $game_map で参照されます。 #============================================================================== class Game_Map #-------------------------------------------------------------------------- # ○ 遠景の拡大率 #-------------------------------------------------------------------------- def resize_parallax return @map.resize_parallax end end #============================================================================== # ■ Cache #------------------------------------------------------------------------------ #  各種グラフィックを読み込み、Bitmap オブジェクトを作成、保持するモジュール # です。読み込みの高速化とメモリ節約のため、作成した Bitmap オブジェクトを内部 # のハッシュに保存し、同じビットマップが再度要求されたときに既存のオブジェクト # を返すようになっています。 #============================================================================== module Cache #-------------------------------------------------------------------------- # ○ エイリアス用特異メソッド #-------------------------------------------------------------------------- class << self alias :a1_other_rtp_load_bitmap :load_bitmap alias :a1_other_rtp_character :character alias :a1_other_rtp_face :face alias :a1_other_rtp_system :system end #-------------------------------------------------------------------------- # ☆ システム グラフィックの取得 #-------------------------------------------------------------------------- def self.system(filename) return a1_other_rtp_system(filename) unless A1_System::UseOtherRTP::USE_VX_SYSTEM return a1_other_rtp_system(filename) if filename.empty? return a1_other_rtp_system("VX_" + filename) end #-------------------------------------------------------------------------- # ○ 改修版load_bitmapを使う? #-------------------------------------------------------------------------- def self.use_load_bitmap_ex?(folder_name, filename) return false if folder_name =~ /.*Pictures.*/ return false if filename.empty? return true end #-------------------------------------------------------------------------- # ○ リサイズビットマップのロードの実行 #-------------------------------------------------------------------------- def self.proc_load_resize_bitmap(path, key, resize, hue = 0) return load_resize_bitmap(path, key, resize) if hue == 0 return load_resize_hue_changed_bitmap(path, key, hue, resize) end #-------------------------------------------------------------------------- # ○ 他のRTPを使わない時のロード #-------------------------------------------------------------------------- def self.no_use_other_rtp(folder_name, filename, filename_ex, hue = 0) path = sprintf("%s%s", folder_name, filename_ex) resize = resize_info(path, filename) return a1_other_rtp_load_bitmap(folder_name, filename_ex, hue) if resize == nil return proc_load_resize_bitmap(path, path, resize, hue) end #-------------------------------------------------------------------------- # ☆ ビットマップの読み込み #-------------------------------------------------------------------------- def self.load_bitmap(folder_name, filename, hue = 0) @cache ||= {} @rtp_cache ||= {} return a1_other_rtp_load_bitmap(folder_name, filename, hue) unless use_load_bitmap_ex?(folder_name, filename) rtp = @rtp_cache[folder_name + filename] return proc_load_resize_bitmap(rtp[0], rtp[1], rtp[2], hue) if rtp != nil filename_ex = filename.clone filename_ex.gsub!("$","") if filename_ex =~ /^[\$]?XP_.*/ return no_use_other_rtp(folder_name, filename, filename_ex, hue = 0) unless $a1_common.chk_use_other_rtp(folder_name, filename_ex) rtp_info = $a1_common.othor_rtp_path(filename_ex) return a1_other_rtp_load_bitmap(folder_name, filename_ex, hue) if rtp_info[0].empty? path_info = $a1_common.load_material_path(rtp_info, folder_name, filename_ex) return a1_other_rtp_load_bitmap(folder_name, "", hue) if path_info == nil path = path_info[1] resize = resize_info(path, path_info[2]) @rtp_cache[folder_name + filename] = [path_info[0], path, resize] return proc_load_resize_bitmap(path_info[0], path, resize, hue) end #-------------------------------------------------------------------------- # ☆ リサイズ情報取得 #-------------------------------------------------------------------------- def self.resize_info(path, filename) resize = nil if filename =~ /2000_.*/ or path =~ /2003_.*/ case path when /.*Graphics\/Animations.*/; resize = [-2, -2] when /.*Graphics\/Characters.*/; resize = [-2, -2] when /.*Graphics\/Faces.*/; resize = [-2, 0] when /.*FaceSet\/.*/; resize = [-2, -2] when /.*Graphics\/Battlers.*/; resize = [-2, -2] when /.*Backdrop\/.*/; resize = [Graphics.width, 0] when /.*Panorama\/.*/; resize = $game_temp.parallax_fix ? [Graphics.width, Graphics.height] : $game_map.resize_parallax end elsif filename =~ /^[\$]?XP_.*/ case path when /\/Graphics\/Characters\/.*/; resize = [-1.1, -1.1] end elsif filename =~ /^[\$]?FSM_.*/ case path when /.*Graphics\/Characters.*/; resize = [-1, -1] end end return resize end end #============================================================================== # ■ Game_Temp #------------------------------------------------------------------------------ #  セーブデータに含まれない、一時的なデータを扱うクラスです。このクラスのイン # スタンスは $game_temp で参照されます。 #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :parallax_fix #-------------------------------------------------------------------------- # ☆ オブジェクト初期化 #-------------------------------------------------------------------------- alias a1_other_rtp_gt_initialize initialize def initialize a1_other_rtp_gt_initialize @parallax_fix = false end end #============================================================================== # ■ Window_Base #------------------------------------------------------------------------------ #  ゲーム中の全てのウィンドウのスーパークラスです。 #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ☆ アイコンの描画 #-------------------------------------------------------------------------- alias a1_other_rtp_wb_draw_icon draw_icon def draw_icon(icon_index, x, y, enabled = true) return a1_other_rtp_wb_draw_icon(icon_index, x, y, enabled) if icon_index >= 0 icon_index = icon_index.abs bitmap = Cache.system("VX_Iconset") rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24) contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha) end #-------------------------------------------------------------------------- # ☆ 歩行グラフィックの描画 #-------------------------------------------------------------------------- alias a1_other_rtp_wb_draw_character draw_character def draw_character(character_name, character_index, x, y, enabled = true) return unless character_name horz = 3 ch_plus = 0 if character_name =~ /^[\$]?XP_.*/ horz = 4 elsif character_name =~ /^2000_.*/ or character_name =~ /^2003_.*/ ch_plus = 2 else return a1_other_rtp_wb_draw_character(character_name, character_index, x, y, enabled) end bitmap = Cache.character(character_name) sign = character_name[/^[\!\$]./] if sign && sign.include?('$') cw = bitmap.width / horz ch = bitmap.height / 4 else cw = bitmap.width / (4 * horz) ch = bitmap.height / 8 end n = character_index src_rect = Rect.new((n%4*horz+1)*cw, (n/4*4+ch_plus)*ch, cw, ch) contents.blt(x - cw / 2, y - ch, bitmap, src_rect, enabled ? 255 : 64) end #-------------------------------------------------------------------------- # ○ 歩行グラフィックの頭だけ描画 #-------------------------------------------------------------------------- alias a1_other_rtp_wb_draw_character_head draw_character_head def draw_character_head(character_name, character_index, x, y, opacity = 255) return unless character_name horz = 3 ch_plus = 0 if character_name =~ /^[\$]?XP_.*/ horz = 4 elsif character_name =~ /^2000_.*/ or character_name =~ /^2003_.*/ ch_plus = 2 else return a1_other_rtp_wb_draw_character_head(character_name, character_index, x, y, opacity) end bitmap = Cache.character(character_name) sign = character_name[/^[\!\$]./] if sign && sign.include?('$') cw = bitmap.width / horz ch = bitmap.height / 4 else cw = bitmap.width / (4 * horz) ch = bitmap.height / 8 end n = character_index src_rect = Rect.new((n%4*horz+1)*cw, (n/4*4+ch_plus)*ch, cw, ch / 1.4) contents.blt(x - cw / 2, y - ch, bitmap, src_rect, opacity) end end #============================================================================== # ■ Sprite_Character #------------------------------------------------------------------------------ #  キャラクター表示用のスプライトです。Game_Character クラスのインスタンスを # 監視し、スプライトの状態を自動的に変化させます。 #============================================================================== class Sprite_Character < Sprite_Base #-------------------------------------------------------------------------- # ☆ キャラクターのビットマップを設定 #-------------------------------------------------------------------------- alias a1_other_rtp_sc_set_character_bitmap set_character_bitmap def set_character_bitmap if @character_name =~ /^[\$]?XP_.*/ self.bitmap = Cache.character(@character_name) sign = @character_name[/^[\!\$]./] if sign && sign.include?('$') @cw = bitmap.width / 4 @ch = bitmap.height / 4 else @cw = bitmap.width / 16 @ch = bitmap.height / 8 end self.ox = @cw / 2 self.oy = @ch else a1_other_rtp_sc_set_character_bitmap end end #-------------------------------------------------------------------------- # ☆ 転送元矩形の更新 #-------------------------------------------------------------------------- alias a1_other_rtp_sc_update_src_rect update_src_rect def update_src_rect return a1_other_rtp_sc_update_src_rect if @tile_id != 0 if @character.character_name =~ /^2000_.*/ or @character.character_name =~ /^2003_.*/ index = @character.character_index pattern = @character.pattern < 3 ? @character.pattern : 1 case @character.direction when 2; direction = 6 when 4; direction = 8 when 6; direction = 4 when 8; direction = 2 end sx = (index % 4 * 3 + pattern) * @cw sy = (index / 4 * 4 + (direction - 2) / 2) * @ch self.src_rect.set(sx, sy, @cw, @ch) elsif @character.character_name =~ /^[\$]?XP_.*/ index = @character.character_index pattern = @character.pattern < 4 ? @character.pattern : 1 direction = @character.direction sx = (index % 4 * 4 + pattern) * @cw sy = (index / 4 * 4 + (direction - 2) / 2) * @ch self.src_rect.set(sx, sy+1, @cw, @ch) else a1_other_rtp_sc_update_src_rect end end end #============================================================================== # ■ Game_Enemy #------------------------------------------------------------------------------ #  敵キャラを扱うクラスです。このクラスは Game_Troop クラス($game_troop)の # 内部で使用されます。 #============================================================================== class Game_Enemy < Game_Battler #-------------------------------------------------------------------------- # ☆ オブジェクト初期化 #-------------------------------------------------------------------------- alias a1_other_rtp_gen_initialize initialize def initialize(index, enemy_id) a1_other_rtp_gen_initialize(index, enemy_id) @battler_name = $a1_common.note_data_one(enemy.note, "グラフィック", @battler_name) end end #============================================================================== # ■ Game_Actor #------------------------------------------------------------------------------ #  アクターを扱うクラスです。このクラスは Game_Actors クラス($game_actors) # の内部で使用され、Game_Party クラス($game_party)からも参照されます。 #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ☆ グラフィックの初期化 #-------------------------------------------------------------------------- alias a1_other_rtp_ga_init_graphics init_graphics def init_graphics a1_other_rtp_ga_init_graphics note_character = $a1_common.note_data_array_str(actor.note, "歩行", nil) note_face = $a1_common.note_data_array_str(actor.note, "顔", nil) init_character(note_character) if note_character init_face(note_face) if note_face end #-------------------------------------------------------------------------- # ○ 歩行グラフィックの初期化 #-------------------------------------------------------------------------- def init_character(note_data) @character_name = note_data[0] @character_index = note_data[1].to_i end #-------------------------------------------------------------------------- # ○ 顔グラフィックの初期化 #-------------------------------------------------------------------------- def init_face(note_data) @face_name = note_data[0] @face_index = note_data[1].to_i end end #============================================================================== # ■ Scene_Map #------------------------------------------------------------------------------ #  マップ画面の処理を行うクラスです。 #============================================================================== class Scene_Map < Scene_Base #-------------------------------------------------------------------------- # ☆ 戦闘前トランジション実行 #-------------------------------------------------------------------------- alias a1_other_rtp_sm_perform_battle_transition perform_battle_transition def perform_battle_transition return a1_other_rtp_sm_perform_battle_transition unless A1_System::UseOtherRTP::USE_VX_SYSTEM Graphics.transition(T_DULATION, $data_vxrtp.gsub("\\","/") + "/Graphics/System/BattleStart.png", 100) Graphics.freeze end end #============================================================================== # ■ Game_Character #------------------------------------------------------------------------------ #  主に移動ルートなどの処理を追加したキャラクターのクラスです。Game_Player、 # Game_Follower、GameVehicle、Game_Event のスーパークラスとして使用されます。 #============================================================================== class Game_Character < Game_CharacterBase #-------------------------------------------------------------------------- # ○ 次に表示するキャラクターを設定 #-------------------------------------------------------------------------- def next_character(name, index) return if @move_route.list[@move_route_index + 1].code != ROUTE_CHANGE_GRAPHIC @move_route.list[@move_route_index + 1].parameters[0] = name @move_route.list[@move_route_index + 1].parameters[1] = index end end #============================================================================== # ■ RPG::Event::Page::Graphic #============================================================================== class RPG::Event::Page::Graphic #-------------------------------------------------------------------------- # ○ 透明度 #-------------------------------------------------------------------------- def opacity @opacity ||= 255 return @opacity end #-------------------------------------------------------------------------- # ○ 透明度 #-------------------------------------------------------------------------- def opacity=(value) @opacity = value end end #============================================================================== # ■ Game_Event #============================================================================== class RPG::Event #-------------------------------------------------------------------------- # ○ イベントページのグラフィックをセットアップ #-------------------------------------------------------------------------- def setup_pages_graphic @name.scan(/\[P(\d+)[ ](\S+)[,](\d+)\]/).each {|info| page_no = info[0].to_i return change_all_graphic(info) if page_no == 0 change_graphic(@pages[page_no - 1], info) } @name.scan(/\[P(\d+)Op[ ](\d+)\]/).each {|info| page_no = info[0].to_i return change_all_opacity(info[1].to_i) if page_no == 0 change_opacity(@pages[page_no - 1], info[1].to_i) } end #-------------------------------------------------------------------------- # ○ 全てのイベントページのグラフィックを変更 #-------------------------------------------------------------------------- def change_all_graphic(info) @pages.each {|page| change_graphic(page, info) } end #-------------------------------------------------------------------------- # ○ イベントページのグラフィックを変更 #-------------------------------------------------------------------------- def change_graphic(page, info) return if page == nil page.graphic.character_name = info[1] if info[1] page.graphic.character_index = info[2].to_i if info[2] end #-------------------------------------------------------------------------- # ○ 全てのイベントページの透明度を変更 #-------------------------------------------------------------------------- def change_all_opacity(opacity) @pages.each {|page| change_opacity(page, opacity) } end #-------------------------------------------------------------------------- # ○ イベントページの透明度を変更 #-------------------------------------------------------------------------- def change_opacity(page, opacity) return if page == nil page.graphic.opacity = opacity end end #============================================================================== # ■ Game_Event #------------------------------------------------------------------------------ #  イベントを扱うクラスです。条件判定によるイベントページ切り替えや、並列処理 # イベント実行などの機能を持っており、Game_Map クラスの内部で使用されます。 #============================================================================== class Game_Event < Game_Character #-------------------------------------------------------------------------- # ☆ オブジェクト初期化 # event : RPG::Event #-------------------------------------------------------------------------- alias a1_other_rtp_ge_initialize initialize def initialize(map_id, event) event.setup_pages_graphic a1_other_rtp_ge_initialize(map_id, event) end #-------------------------------------------------------------------------- # ☆ イベントページの設定をセットアップ #-------------------------------------------------------------------------- alias a1_other_rtp_ge_setup_page_settings setup_page_settings def setup_page_settings a1_other_rtp_ge_setup_page_settings @opacity = @page.graphic.opacity end end #============================================================================== # ■ A1_System::CommonModule #============================================================================== class A1_System::CommonModule #-------------------------------------------------------------------------- # ☆ 注釈コマンド定義 #-------------------------------------------------------------------------- alias a1_other_rtp_define_command define_command def define_command a1_other_rtp_define_command @cmd_108["演奏"] = :play_audio end end #============================================================================== # ■ Game_Interpreter #------------------------------------------------------------------------------ #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、 # Game_Troop クラス、Game_Event クラスの内部で使用されます。 #============================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # ○ 演奏 #-------------------------------------------------------------------------- def play_audio(params) audio_kind = params[0] audio_name = params[1] volume = params[2] ? params[2].to_i : 100 pitch = params[3] ? params[3].to_i : 100 case audio_kind when "BGM"; RPG::BGM.new(audio_name, volume, pitch).play when "BGS"; RPG::BGS.new(audio_name, volume, pitch).play when "ME"; RPG::ME.new(audio_name, volume, pitch).play when "SE"; RPG::SE.new(audio_name, volume, pitch).play end end end end