class Window_Message
def reset_window
if $game_temp.in_battle
self.y = 16
else
case $game_system.message_position
when 0 # 上
self.y = 16
when 1 # 中
if $game_temp.message_text != nil
text = $game_temp.message_text.clone
begin
last_text = text.clone
text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
end until text == last_text
text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
$game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
end
text.gsub!(/\\\\/) { "\000" }
text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "" }
text.gsub!(/\\[Gg]/) { "" }
text.gsub!("\000") { "\\" }
texts = text.chomp.split("\n")
c_width = texts.size == 0 ? 32 : 8 + texts.map{|s| self.contents.text_size(s).width}.max
c_height = texts.size == 0 ? 32 : texts.size * 32
self.width = 32 + c_width
self.height = 32 + c_height
self.contents.dispose if self.contents != nil
self.contents = Bitmap.new(c_width, c_height)
self.x = 320 - width / 2
self.y = 240 - height / 2
else
self.y = 160
end
when 2 # 下
self.y = 304
end
end
if $game_system.message_frame == 0
self.opacity = 255
else
self.opacity = 0
end
self.back_opacity = 160
end
end