# # 文章の表示拡張Ver1.01(RGSS2) #  (C)2008 TYPE74RX-T # #============================================================================== # ★ 再定義ポイント #------------------------------------------------------------------------------ # class Window_Message # def update_message #============================================================================== #============================================================================== # ■ Game_Temp #------------------------------------------------------------------------------ #  セーブデータに含まれない、一時的なデータを扱うクラスです。このクラスのイン # スタンスは $game_temp で参照されます。 #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias rx_rgss2h1_initialize initialize def initialize #メソッドを呼び戻す rx_rgss2h1_initialize # イベント ID 取得用 @rx_target_event_id = 0 end #-------------------------------------------------------------------------- # ★ イベント ID #-------------------------------------------------------------------------- def rx_target_event_id return @rx_target_event_id end #-------------------------------------------------------------------------- # ★ イベント ID の設定 #-------------------------------------------------------------------------- def rx_target_event_id=(id) @rx_target_event_id = id end end #============================================================================== # ■ Game_Interpreter #------------------------------------------------------------------------------ #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、 # Game_Troop クラス、Game_Event クラスの内部で使用されます。 #============================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # ★ イベント ID #-------------------------------------------------------------------------- def event_id return @event_id end #-------------------------------------------------------------------------- # ★ イベント ID の設定 #-------------------------------------------------------------------------- def event_id=(id) @event_id = id end #-------------------------------------------------------------------------- # ● 文章の表示 #-------------------------------------------------------------------------- alias rx_rgss2h1_command_101 command_101 def command_101 $game_temp.rx_target_event_id = @event_id #メソッドを呼び戻す rx_rgss2h1_command_101 end end #============================================================================== # ■ Window_Message #------------------------------------------------------------------------------ #  文章表示に使うメッセージウィンドウです。 #============================================================================== class Window_Message < Window_Selectable #-------------------------------------------------------------------------- # ● 特殊文字の変換 #-------------------------------------------------------------------------- alias rx_rgss2h1_convert_special_characters convert_special_characters def convert_special_characters # メソッドを呼び戻す rx_rgss2h1_convert_special_characters @text.gsub!(/\\A\[([0-9]+)\]/i) { "\x09[#{$1}]" } # アニメーション ID @text.gsub!(/\\AT\[([-10-9]+)\]/i) { "\x10[#{$1}]" } # アニメ対象イベント ID end #-------------------------------------------------------------------------- # ● メッセージの更新 #-------------------------------------------------------------------------- def update_message loop do c = @text.slice!(/./m) # 次の文字を取得 case c when nil # 描画すべき文字がない finish_message # 更新終了 break when "\x00" # 改行 new_line if @line_count >= MAX_LINE # 行数が最大のとき unless @text.empty? # さらに続きがあるなら self.pause = true # 入力待ちを入れる break end end when "\x01" # \C[n] (文字色変更) @text.sub!(/\[([0-9]+)\]/, "") contents.font.color = text_color($1.to_i) next when "\x02" # \G (所持金表示) @gold_window.refresh @gold_window.open when "\x03" # \. (ウェイト 1/4 秒) @wait_count = 15 break when "\x04" # \| (ウェイト 1 秒) @wait_count = 60 break when "\x05" # \! (入力待ち) self.pause = true break when "\x06" # \> (瞬間表示 ON) @line_show_fast = true when "\x07" # \< (瞬間表示 OFF) @line_show_fast = false when "\x08" # \^ (入力待ちなし) @pause_skip = true # ★ ====================挿入ここから==================== when "\x09" # \A[n] アニメーション表示 @text.sub!(/\[([0-9]+)\]/, "") if @rx_char != nil @rx_char.animation_id = $1.to_i end when "\x10" # \AT[n] アニメーションターゲット @text.sub!(/\[([-10-9]+)\]/, "") if $game_temp.rx_target_event_id != nil rx_event_id = $1.to_i else break end case rx_event_id when -1 # プレイヤー @rx_char = $game_player when 0 # このイベント events = $game_map.events if events != nil @rx_char = events[$game_temp.rx_target_event_id] end else # 特定のイベント events = $game_map.events if events != nil @rx_char = events[rx_event_id] end end # ★ ====================挿入ここまで==================== else # 普通の文字 contents.draw_text(@contents_x, @contents_y, 40, WLH, c) c_width = contents.text_size(c).width @contents_x += c_width end break unless @show_fast or @line_show_fast end end end