Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ▽▽▽ XRXSv2. メッセージ表示フルグレードアップVX ▽▽▽
- #
- # publish 2010/ 3/ 2
- # update - 11/ 1/10a
- #
- #==============================================================================
- # カスタマイズポイント
- #==============================================================================
- class Window_Message < Window_Selectable
- #
- # 基本行数
- #
- MAX_LINE = 4
- #
- # \p[] - キャラポップの高さ
- #
- CHARPOP_HEIGHT = 40
- #
- # \name[] - 名前枠 X,Y座標
- #
- NAME_WINDOW_OFFSET_X = 0
- NAME_WINDOW_OFFSET_Y = -24
- WINDOW_RECT = Rect.new(0, 0, 544, 128)
- P_WINDOW = 2 # ポーズサイン位置 0 = 中央下 1 = 右下 2 = 文末
- P_WINDOW_XY = [-24,-24]# XY座標修正[X, Y]
- end
- module Y6
- module MESSAGE
- #==========================================================================
- # Sectio I. Basic Settings
- # -------------------------------------------------------------------------
- # The following below will adjust the basic settings and that will affect
- # the majority of the script.
- #==========================================================================
- # This adjusts the pixel width given to your icons so they won't throw
- # certain monospaced fonts out of alignment.
- ICON_WIDTH = 24
- # This button is the button used to make message windows instantly skip
- # forward. Hold down for the effect. Note that when held down, this will
- # speed up the messages, but still wait for the pauses. However, it will
- # automatically go to the next page when prompted.
- TEXT_SKIP = Input::A # Input::A is the shift button on keyboard.
- #==========================================================================
- # Section IV. Sound Settings
- # -------------------------------------------------------------------------
- # When text is being played out on the screen by a message. This can be
- # changed in game through the following script calls:
- # $game_message.text_sound = "name" Filename of sound to be played.
- # $game_message.text_volume = 40 Volume of sound to be played.
- # $game_message.text_pitch = 100 Pitch of sound to be played.
- #==========================================================================
- # This adjusts the default sound that's played when text appears. If you
- # don't want to use this feature, just set this value to nil.
- SOUND_DEFAULT = "Cursor"
- # This adjusts the volume of the sound that's played when text appears.
- SOUND_VOLUME = 60
- # The sound pitch varies each time it's played by this amount. This is so
- # that the sound doesn't become monotonous and actually offers variability.
- # Set this value to 0 if you don't want any changes.
- SOUND_PITCH_OFFSET = 3
- end
- end
- #==============================================================================
- # 参照機能
- #==============================================================================
- class Game_Temp
- attr_accessor :last_gain_material
- attr_accessor :last_gain_holder
- end
- #==============================================================================
- # フルグレードアップベース - 制御文字・基本機能
- #==============================================================================
- class Window_Message < Window_Selectable
- alias flip_init initialize
- def initialize
- flip_init
- shake_reset # シェイク #flippy
- self.x = WINDOW_RECT.x
- self.y = WINDOW_RECT.y
- self.width = WINDOW_RECT.width
- self.height = WINDOW_RECT.height
- end
- #--------------------------------------------------------------------------
- # ● 特殊文字の変換 + 準備
- #--------------------------------------------------------------------------
- alias xrxsv2_convert_special_characters convert_special_characters
- def convert_special_characters
- # 初期化
- contents.font.size = Font.default_size
- contents.font.bold = Font.default_italic
- contents.font.italic = Font.default_bold
- contents.font.shadow = Font.default_shadow
- @type_wait = 0
- @line_widths = []
- @line_aligns = []
- self.pop_character = nil
- # ウィンドウ保持指定\holdがあるか?
- @window_hold = (@text.gsub!(/\\hold/) { "" } != nil)
- # \info
- @info_mode = (@text.gsub!(/\\info/) { "" } != nil)
- # 改行削除指定\_があるか?
- if (/\\_(.*?)\x00/.match(@text)) != nil
- $game_message.choice_start -= 1
- @text.gsub!(/\\_(.*?)\x00/) { $1.to_s }
- end
- # \name 判定
- if @text.sub!(/\\[Nn]ame\[(.*?)\]/) { "" }
- name = $1
- bitmap = @name_sprite.bitmap
- w = [bitmap.text_size(name).width, 1].max
- bitmap.dispose
- @name_sprite.bitmap = Bitmap.new(w, 32)
- bitmap = @name_sprite.bitmap
- bitmap.draw_text(0, 0, bitmap.width, bitmap.height, name)
- @name_window.width = w + 16
- @name_window.create_contents
- @name_window.openness = 0
- @name_window.open
- @name_window.visible = true
- @name_sprite.visible = true
- elsif @text.sub!(/\\[Nn][Bb]\[(.*?)\]/) { "" }
- name = $1
- bitmap = @name_sprite.bitmap
- w = [bitmap.text_size(name).width, 1].max
- bitmap.dispose
- @name_sprite.bitmap = Bitmap.new(w, 32)
- bitmap = @name_sprite.bitmap
- bitmap.draw_text(0, 0, bitmap.width, bitmap.height, name)
- @name_window.width = w + 16
- @name_window.create_contents
- @name_window.openness = 0
- @name_window.open
- @name_window.visible = true
- @name_sprite.visible = true
- else
- @name_window.visible = false
- @name_sprite.visible = false
- @name_sprite.bitmap.dispose
- @name_sprite.bitmap = Bitmap.new(32,32)
- end
- # キャラボップモード
- if @text.gsub!(/\\[Pp]\[-1\]/) { "" }
- self.pop_character = -1
- elsif @text.gsub!(/\\[Pp]\[-2\]/) { "" }
- self.pop_character = -2
- elsif @text.gsub!(/\\[Pp]\[([0-9]+)\]/) { "" }
- self.pop_character = $1.to_i
- elsif @text.gsub!(/\\[Pp]/) { "" }
- self.pop_character = 0
- end
- if @text.gsub!(/\\[Tt]/) { "" }
- @think = true
- else
- @think = false
- end
- # 制御文字処理
- xrxsv2_convert_special_characters
- @text.gsub!(/\\[Ss]\[([0-9]+)\]/i) { "\x11[#{$1}]" }
- @text.gsub!(/\\size\[([0-9]+)\]/i) { "\x12[#{$1}]" }
- @text.gsub!(/\\[Oo]\[([0-9]+)\]/i) { "\x13[#{$1}]" }
- @text.gsub!(/\\icon\[([0-9]+)\]/i) { "\x17[#{$1}]" }
- @text.gsub!(/\\[Ii]\[([0-9]+)\]/i) { "\x17[#{$1}]" }
- @text.gsub!(/\\last_holder/i) { "\x18" }
- @text.gsub!(/\\last_material/i) { "\x19" }
- @text.gsub!(/\\[Ff][Bb]/) { "\x14" }
- @text.gsub!(/\\[Ff][Ii]/) { "\x15" }
- @text.gsub!(/\\[Ff][Hh]/) { "\x16" }
- @text.gsub!(/\\[Nn][Ll]/) { "\x00" }
- @text.gsub!(/\\[Ii][Ii]\[(\d+)\]/i) {
- "\x17{#{$data_items[$1.to_i].icon_index}}" +
- "#{$data_items[$1.to_i].name}"}
- @text.gsub!(/\\[Ii][Ww]\[(\d+)\]/i) {
- "\x17{#{$data_weapons[$1.to_i].icon_index}}" +
- "#{$data_weapons[$1.to_i].name}"}
- @text.gsub!(/\\[Ii][Aa]\[(\d+)\]/i) {
- "\x17{#{$data_armors[$1.to_i].icon_index}}" +
- "#{$data_armors[$1.to_i].name}"}
- @text.gsub!(/\\[Ii][Ss]\[(\d+)\]/i) {
- "\x17{#{$data_skills[$1.to_i].icon_index}}" +
- "#{$data_skills[$1.to_i].name}"}
- @text.gsub!(/\\[Ii][Tt]\[(\d+)\]/i) {
- "\x17{#{$data_states[$1.to_i].icon_index}}" +
- "#{$data_states[$1.to_i].name}"}
- @text.gsub!(/\\[Ss][Hh]\[(\d+),(\d+),(\d+)\]/i) {"\xa4[#{[$1]},#{[$2]},#{[$3]}]"}
- #
- # ライン情報の取得
- rxs = ["\x01","\x02","\x03","\x04","\x05","\x06","\x07","\x08",
- /\[([0-9]+)\]/,
- "\x11","\x12","\x13","\x14", "\x15", "\x16", "\x17", "\x18","\x19", "\xa4"]
- lines = @text.split("\x00")
- @lines_max = lines.size
- for i in 0...@lines_max
- line = lines[i]
- for rx in rxs
- line.gsub!(rx) {""}
- end
- @line_aligns[i] =
- line.sub!(/\\center/) {""} ? CENTER :
- line.sub!(/\\right/) {""} ? RIGHT :
- AUTO
- # 行の横幅の取得と設定
- cx = contents.text_size(line).width
- @line_widths[i] = cx
- end
- # 位置揃え制御文字の削除
- @text.gsub!(/\\center/) {""}
- @text.gsub!(/\\right/) {""}
- # キャラポップ時のウィンドウリサイズ
- reszie_window_for_pop
- end
- #--------------------------------------------------------------------------
- # ● メッセージの更新 *
- #--------------------------------------------------------------------------
- def update_message
- @wait_count = @type_wait
- loop do
- @line_show_fast = true if Input.press?(Y6::MESSAGE::TEXT_SKIP)
- c = @text.slice!(/./m)
- case update_message_type(c)
- when 1
- break
- when 2
- next
- end
- break unless @show_fast or @line_show_fast
- end
- end
- #--------------------------------------------------------------------------
- # 一文字の描画 (返り値 1:break, 2:next)
- #--------------------------------------------------------------------------
- def update_message_type(c)
- case c
- when nil # 描画すべき文字がない
- finish_message # 更新終了
- return 1
- when "\x00" # 改行
- new_line
- max = MAX_LINE
- max = 14 if self.pop_character != nil
- if @line_count >= max # 行数が最大のとき
- unless @text.empty? # さらに続きがあるなら
- self.pause = true # 入力待ちを入れる
- return 1
- end
- end
- when "\x01" # \C[n] (文字色変更)
- @text.sub!(/\[([0-9]+)\]/, "")
- contents.font.color = text_color($1.to_i)
- return 2
- when "\x11" # \s[n] (スピード変更)
- @text.sub!(/\[([0-9]+)\]/, "")
- @type_wait = $1.to_i
- return 2
- when "\x12" # \size
- @text.sub!(/\[([0-9]+)\]/, "")
- contents.font.size = $1.to_i
- return 2
- when "\x13" # \O
- @text.sub!(/\[([0-9]+)\]/, "")
- contents.font.color.alpha = $1.to_i
- return 2
- when "\x02" # \G (所持金表示)
- @gold_window.refresh
- @gold_window.open
- when "\x03" # \. (ウェイト 1/4 秒)
- @wait_count = 15
- return 1
- when "\x04" # \| (ウェイト 1 秒)
- @wait_count = 60
- return 1
- when "\x05" # \! (入力待ち)
- self.pause = true
- return 1
- when "\x06" # \> (瞬間表示 ON)
- @line_show_fast = true
- when "\x07" # \< (瞬間表示 OFF)
- @line_show_fast = false
- when "\x08" # \^ (入力待ちなし)
- @pause_skip = true
- when "\x14" #\B
- contents.font.bold ^= true
- when "\x15" #\I
- contents.font.italic ^= true
- when "\x16" #\D
- contents.font.shadow ^= true
- when "\x17"
- @text.sub!(/\{(\d+)\}/, "")
- icon = $1.to_i
- icon_width = (24 - Y6::MESSAGE::ICON_WIDTH) / 2
- draw_icon(icon, @contents_x - icon_width, @contents_y)
- @contents_x += Y6::MESSAGE::ICON_WIDTH
- when "\x18"
- name = ($game_temp.last_gain_holder.name rescue "")
- update_message_type_draw_at(name)
- when "\x19"
- item = ($game_temp.last_gain_material.item rescue nil)
- draw_item_name(item, @contents_x, @contents_y)
- @contents_x += 196
- when "\xa4" # \SH[p,s,d] #flippy
- @text.sub!(/\[(\d+),(\d+),(\d+)\]/, "")
- start_shake($1.to_i, $2.to_i, $3.to_i)
- else # 普通の文字
- play_text_sound unless c == " "
- update_message_type_draw_at(c)
- end
- return 0
- end
- def update_message_type_draw_at(c)
- return if c.to_s.size == 0
- c_width = contents.text_size(c).width
- c_height = contents.text_size(c).height
- contents.draw_text(@contents_x, @contents_y - (c_height - WLH) / 2, c_width, c_height, c)
- @contents_x += c_width
- end
- #--------------------------------------------------------------------------
- # ● 改ページ処理
- #--------------------------------------------------------------------------
- alias xrxsv2_new_page new_page
- def new_page
- xrxsv2_new_page
- update_charpop_window
- end
- #--------------------------------------------------------------------------
- # ● 改行処理
- #--------------------------------------------------------------------------
- alias xrxsv2_new_line new_line
- def new_line
- xrxsv2_new_line
- set_align
- end
- #--------------------------------------------------------------------------
- # 位置揃え
- #--------------------------------------------------------------------------
- def set_align
- w = @line_widths[@line_count].to_i
- a = @line_aligns[@line_count]
- case a
- when CENTER
- @contents_x = @contents_x + ((contents.width - @contents_x) - w) / 2
- when RIGHT
- @contents_x = contents.width - w
- end
- end
- #--------------------------------------------------------------------------
- # ● メッセージの終了
- #--------------------------------------------------------------------------
- alias xrxsv2_terminate_message terminate_message
- def terminate_message
- xrxsv2_terminate_message
- process_hold
- end
- #--------------------------------------------------------------------------
- # 定数
- #--------------------------------------------------------------------------
- AUTO = 0
- LEFT = 1
- CENTER = 2
- RIGHT = 3
- #--------------------------------------------------------------------------
- # overwrite method: input_pause
- #--------------------------------------------------------------------------
- def input_pause
- if Input.trigger?(Input::B) or Input.trigger?(Input::C) or
- Input.press?(Y6::MESSAGE::TEXT_SKIP)
- self.pause = false
- if @text != nil and not @text.empty?
- new_page if @line_count >= MAX_LINE
- else
- terminate_message
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● シェイクの開始 #flippy
- #--------------------------------------------------------------------------
- def start_shake(power, speed, duration)
- @shake_power = power
- @shake_speed = speed
- @shake_duration = duration
- end
- #--------------------------------------------------------------------------
- # ● シェイクリセット #flippy
- #--------------------------------------------------------------------------
- def shake_reset
- @shake = @shake_power = 0
- @shake_speed = @shake_duration = 0
- @shake_direction = 1
- end
- #--------------------------------------------------------------------------
- # ● シェイクの更新 #flippy
- #--------------------------------------------------------------------------
- def update_shake
- delta = (@shake_power * @shake_speed * @shake_direction) / 10.0
- if @shake_duration <= 1 and @shake * (@shake + delta) < 0
- @shake = 0
- else
- @shake += delta
- end
- @shake_direction = -1 if @shake > @shake_power * 2
- @shake_direction = 1 if @shake < - @shake_power * 2
- @shake_duration -= 1 if @shake_duration >= 1
- self.x = self.x; self.y = self.y
- end
- end
- #==============================================================================
- # アクティブイベント取得
- #==============================================================================
- class Game_Interpreter
- attr_reader :event_id
- end
- #==============================================================================
- # 各種機能の追加 - キャラポップ/ネーム/ホールド
- #==============================================================================
- class Window_Message < Window_Selectable
- #--------------------------------------------------------------------------
- # ● カーソルの更新 *
- #--------------------------------------------------------------------------
- def update_cursor
- if @index >= 0
- x = ($game_message.face_name.empty? ? 0 : 112)
- y = ($game_message.choice_start + @index) * WLH - 1
- w = contents.width - x
- if self.pop_character != nil
- x += 28
- w -= 20
- end
- self.cursor_rect.set(x, y, w, WLH)
- else
- self.cursor_rect.empty
- end
- end
- #--------------------------------------------------------------------------
- # キャラクターの取得
- # parameter : パラメータ
- #--------------------------------------------------------------------------
- def get_character(parameter)
- @pety = false
- # パラメータで分岐
- case parameter
- when -1 # プレイヤー
- return $game_player
- when -2
- return $game_party.pet
- when 0 # 現在アクティブなイベント
- id = $game_map.interpreter.event_id
- events = $game_map.events
- return events == nil ? nil : events[id]
- else # 特定のイベント
- events = $game_map.events
- return events == nil ? nil : events[parameter]
- end
- end
- #--------------------------------------------------------------------------
- # (メッセージ終了時)ホールドの処理
- #--------------------------------------------------------------------------
- def process_hold
- if @window_hold
- @held_windows.push(Window_Copy.new(self))
- @held_windows.push(Window_Copy.new(@name_window))
- @held_windows.push(Sprite_Copy.new(@name_sprite))
- @held_windows.push(Sprite_Copy.new(@back_sprite))
- for sprite in @extra_sprites
- next if sprite.disposed?
- @held_windows.push(Sprite_Copy.new(sprite))
- end
- @extra_sprites.clear
- self.openness = 0
- @name_window.openness = 0
- @back_sprite.visible = false
- else
- @held_windows.each {|object| object.dispose}
- @held_windows.clear
- end
- @name_window.close
- @name_sprite.visible = false
- end
- #--------------------------------------------------------------------------
- # キャラポップ位置の設定と取得
- #--------------------------------------------------------------------------
- def pop_character=(character_id)
- @pop_character = character_id
- end
- def pop_character
- return @pop_character
- end
- #--------------------------------------------------------------------------
- # キャラポップ時のウィンドウリサイズ
- #--------------------------------------------------------------------------
- def reszie_window_for_pop
- if self.pop_character != nil
- max_x = @line_widths.max.to_i
- n = max_x + 32
- n += $game_message.face_name.empty? ? 0 : 122
- m = $game_message.face_name.empty? ? 0 : 96
- w = @name_sprite.bitmap.width
- self.width = [n, w].max
- self.height = [@lines_max * WLH, m].max + 32
- create_contents
- update_charpop_window
- elsif @info_mode
- @line_aligns[0] = CENTER
- self.x = - 8
- self.width = Graphics.width + 16
- self.height = 56
- create_contents
- else
- self.x = 0
- self.width = Graphics.width
- self.height = MAX_LINE * WLH + 32
- create_contents
- end
- end
- #--------------------------------------------------------------------------
- # ● 背景スプライトの作成
- #--------------------------------------------------------------------------
- alias xrxsv2_create_back_sprite create_back_sprite
- def create_back_sprite
- xrxsv2_create_back_sprite
- @back_sprite.zoom_x = 1.0 * Graphics.width / @back_sprite.bitmap.width
- @name_window = Window_Base.new(0,0,112,36)
- @name_window.visible = false
- @name_sprite = Sprite.new
- @name_sprite.bitmap = Bitmap.new(32,32)
- @name_sprite.visible = false
- self.x = self.x
- self.y = self.y
- self.z = self.z
- @held_windows = []
- @extra_sprites = []
- end
- #--------------------------------------------------------------------------
- # ● 背景スプライトの解放
- #--------------------------------------------------------------------------
- alias xrxsv2_dispose_back_sprite dispose_back_sprite
- def dispose_back_sprite
- xrxsv2_dispose_back_sprite
- @name_window.dispose
- @name_sprite.dispose
- for window in @held_windows
- window.dispose
- end
- end
- #--------------------------------------------------------------------------
- # ● 背景スプライトの更新
- #--------------------------------------------------------------------------
- alias xrxsv2_update_back_sprite update_back_sprite
- def update_back_sprite
- @name_window.update
- xrxsv2_update_back_sprite
- update_charpop_window
- end
- #--------------------------------------------------------------------------
- # ウィンドウの位置と不透明度の設定 (キャラポップ)
- #--------------------------------------------------------------------------
- def update_charpop_window
- if self.pop_character
- character = get_character(self.pop_character)
- return if character == nil
- # [X座標]
- n = self.width / 2
- n = [n, @name_skin.width + 16].max if @current_name != nil
- w = @name_sprite.bitmap.width
- x = character.screen_x - [[n, w].max, self.width - 32].min
- if character.screen_y <= 128
- @position = 2
- elsif character.screen_y >= 288
- @position = 0
- end
- # [Y座標]
- case @position
- when 0
- y = character.screen_y - CHARPOP_HEIGHT - self.height
- else
- y = character.screen_y + 16
- end
- x_max = Graphics.width - 4 - self.width
- x_min = 4
- y_max = Graphics.height - self.height
- y_min = 4
- self.x = [[x, x_max].min, x_min].max
- self.y = [[y, y_max].min, y_min].max
- self.x += @shake if @shake != nil
- end
- end
- #--------------------------------------------------------------------------
- # 位置の連動
- #--------------------------------------------------------------------------
- def x=(n)
- super(n)
- n += @shake if @shake != nil
- if @name_window
- @name_window.x = n + NAME_WINDOW_OFFSET_X
- @name_sprite.x = n + NAME_WINDOW_OFFSET_X + 8
- end
- end
- def y=(n)
- super
- if @name_window
- @name_window.y = n + NAME_WINDOW_OFFSET_Y
- @name_sprite.y = n + NAME_WINDOW_OFFSET_Y + 2
- end
- end
- def z=(n)
- super
- if @name_window
- @name_window.z = n + 1
- @name_sprite.z = n + 2
- end
- end
- end
- #==============================================================================
- # 伸縮対応
- #==============================================================================
- class Window_Message < Window_Selectable
- #--------------------------------------------------------------------------
- # ● ウィンドウの背景と位置の設定 [再定義]
- #--------------------------------------------------------------------------
- def reset_window
- @background = $game_message.background
- @position = $game_message.position
- if @background == 0 # 通常ウィンドウ
- self.opacity = 255
- else # 背景を暗くする、透明にする
- self.opacity = 0
- end
- case @position
- when 0 # 上
- self.y = 0
- @gold_window.y = 360
- when 1 # 中
- self.y = (Graphics.height - self.height) / 2
- @gold_window.y = 0
- when 2 # 下
- self.y = Graphics.height - self.height
- @gold_window.y = 0
- end
- end
- end
- #==============================================================================
- # □ Window_Copy
- #------------------------------------------------------------------------------
- # 指定のウィンドウのコピーを作成します。
- #==============================================================================
- class Window_Copy < Window_Base
- #--------------------------------------------------------------------------
- # ○ オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize(window)
- super(window.x, window.y, window.width, window.height)
- self.contents = window.contents.dup unless window.contents.nil?
- self.opacity = window.opacity
- self.back_opacity = window.back_opacity
- self.z = window.z - 3
- self.visible = window.visible
- end
- end
- #==============================================================================
- # □ Sprite_Copy
- #------------------------------------------------------------------------------
- # 指定のスプライトのコピーを作成します。
- #==============================================================================
- class Sprite_Copy < Sprite
- #--------------------------------------------------------------------------
- # ○ オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize(sprite)
- super()
- self.bitmap = sprite.bitmap.dup unless sprite.bitmap.nil?
- self.opacity = sprite.opacity
- self.x = sprite.x
- self.y = sprite.y
- self.z = sprite.z - 3
- self.ox = sprite.ox
- self.oy = sprite.oy
- self.zoom_x = sprite.zoom_x
- self.visible = sprite.visible
- end
- end
- class Window_Message < Window_Selectable
- #--------------------------------------------------------------------------
- # new method: play_text_sound
- #--------------------------------------------------------------------------
- def play_text_sound
- return if $game_message.text_sound == nil
- return if @line_show_fast or @show_fast
- name = $game_message.text_sound
- $game_message.text_volume = 60 if $game_message.text_volume == nil
- vol = $game_message.text_volume
- $game_message.text_pitch = 100 if $game_message.text_pitch == nil
- pitch = $game_message.text_pitch
- pitch += rand(Y6::MESSAGE::SOUND_PITCH_OFFSET)
- pitch -= rand(Y6::MESSAGE::SOUND_PITCH_OFFSET)
- RPG::SE.new(name, vol, pitch).play
- end
- alias flip_update update
- def update
- update_shake if @shake_duration >= 1 or @shake != 0 # シェイク更新
- flip_update
- end
- alias flip_reset_window reset_window
- def reset_window
- flip_reset_window
- text = @text.clone # テキスト
- loop do
- c = text.slice!(/./m) # 次の文字を取得
- case c
- when nil
- break # 残りの文字が無い場合、ループ中断
- when "\xa4"
- text.sub!(/\[\d+,\d+,\d+\]/, "")# \SH[p,s,d]
- end
- end
- end
- end
- #==============================================================================
- # ** Game_Message
- #==============================================================================
- class Game_Message
- #--------------------------------------------------------------------------
- # public instance variables
- #--------------------------------------------------------------------------
- attr_accessor :text_sound
- attr_accessor :text_volume
- attr_accessor :text_pitch
- attr_accessor :choice_text
- #--------------------------------------------------------------------------
- # alias method: initialize
- #--------------------------------------------------------------------------
- alias initialize_cms initialize unless $@
- def initialize
- @text_sound = Y6::MESSAGE::SOUND_DEFAULT
- @text_volume = Y6::MESSAGE::SOUND_VOLUME
- @text_pitch = 100
- initialize_cms
- end
- #--------------------------------------------------------------------------
- # alias method: clear
- #--------------------------------------------------------------------------
- alias clear_cms clear unless $@
- def clear
- @choice_text = []
- clear_cms
- end
- end # Game_Message
- #==============================================================================
- # +++ 「+ふきだし表示」VX +++
- # by パラ犬 http://2d6.parasite.jp/
- # ×
- # row http://xms.rdy.jp/
- #
- # publish 2010/ 3/ 2
- # update -
- #
- #------------------------------------------------------------------------------
- # ほぼどんなメッセージウィンドウに対しても後付け可能な「ふきだし表示」です。
- # また、テール部分のみの自動追尾機能を持ちます。
- # ふきだし表示をするには、
- # テール用画像「Window-top」「Window-under」を
- # 「Graphics/System」フォルダにインポートしておく必要があります。
- #==============================================================================
- # ■ Window_Message
- #==============================================================================
- class Window_Message < Window_Selectable
- #--------------------------------------------------------------------------
- # ● メッセージの開始
- #--------------------------------------------------------------------------
- alias parashelf_start_message start_message
- def start_message
- parashelf_start_message
- update_tail
- end
- #--------------------------------------------------------------------------
- # クローズ [オーバーライド]
- #--------------------------------------------------------------------------
- def close
- super
- del_tail
- end
- #--------------------------------------------------------------------------
- # ● 特殊文字の変換
- #--------------------------------------------------------------------------
- alias parashelf_convert_special_characters convert_special_characters
- def convert_special_characters
- parashelf_convert_special_characters
- set_tail
- end
- #--------------------------------------------------------------------------
- # ● 背景スプライトの更新
- #--------------------------------------------------------------------------
- alias parashelf_update_back_sprite update_back_sprite
- def update_back_sprite
- parashelf_update_back_sprite
- update_tail
- end
- #--------------------------------------------------------------------------
- # ○ フレーム更新 (ふきだしテール)
- #--------------------------------------------------------------------------
- def update_tail
- # ふきだしモードではイベントの動きに追従
- if $mes_id != nil and @tail != nil
- tale_pos = get_tale_pos
- @tail.x = tale_pos[0]
- @tail.y = tale_pos[1]
- skin = "Window"
- case @position
- when 0 # 上
- @tail.bitmap = Cache.system(skin + "-top") if @think == false
- @tail.bitmap = Cache.system(skin + "-top-think") if @think == true
- when 2 # 下
- @tail.bitmap = Cache.system(skin + "-under") if @think == false
- @tail.bitmap = Cache.system(skin + "-under-think") if @think == true
- end
- # 可視状態
- @tail.visible = self.openness == 255
- end
- end
- #--------------------------------------------------------------------------
- # ○ ふきだしテールを表示
- #--------------------------------------------------------------------------
- def set_tail
- del_tail
- # $mes_id が空のときと戦闘中はふきだしを表示しない
- if $mes_id != nil and not $game_temp.in_battle
- # ふきだしのテールを描画
- skin = "Window"
- if @background == 0
- # 位置を取得
- tale_pos = get_tale_pos
- @tail = Sprite.new
- case @position
- when 0 # 上
- @tail.bitmap = Cache.system(skin + "-top") if @think == false
- @tail.bitmap = Cache.system(skin + "-top-think") if @think == true
- @tail.x = tale_pos[0]
- @tail.y = tale_pos[1]
- @tail.z = self.z + 1
- when 1 # 中
- @tail.dispose
- @tail = nil
- when 2 # 下
- @tail.bitmap = Cache.system(skin + "-under") if @think == false
- @tail.bitmap = Cache.system(skin + "-under-think") if @think == true
- @tail.x = tale_pos[0]
- @tail.y = tale_pos[1]
- @tail.z = self.z + 1
- end
- # エクストラスプライトに登録
- @extra_sprites = [] if @extra_sprites.nil?
- @extra_sprites.push(@tail) if @tail != nil
- # 更新
- update_tail
- end
- end
- end
- #--------------------------------------------------------------------------
- # ○ テールの位置を計算
- #--------------------------------------------------------------------------
- def get_tale_pos
- character = get_character($mes_id)
- x = [[character.screen_x - 16, self.x].max, self.x + self.width - 32].min
- case @position
- when 0
- y = self.y + self.height - 16 #24 #16
- when 2
- y = self.y - 16 #8 #16
- end
- return [x, y]
- end
- #--------------------------------------------------------------------------
- # ○ ふきだしを破棄
- #--------------------------------------------------------------------------
- def del_tail
- if @tail != nil
- @tail.dispose
- @tail = nil
- end
- end
- end
- #
- # ▼▲▼ XRXS 9拡張CO-X. ふきだし自動設定 ▼▲▼
- #==============================================================================
- # ■ Window_Message
- #==============================================================================
- class Window_Message < Window_Selectable
- #--------------------------------------------------------------------------
- # ○ ポップキャラクターの設定
- #--------------------------------------------------------------------------
- def pop_character=(character_id)
- @pop_character = character_id
- $mes_id = character_id
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement