Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module SES
- module ExternalText
- # ----------------------------------------------------------------------
- # Overwrite Tags
- # ----------------------------------------------------------------------
- Tags = {
- /^\[Key\]\s*(.+)/i =>
- %Q{ key = $1.to_s; text[key] = [["",0,nil,nil,""],"",[2,0],""] },
- /^\[Face\]\s*(.+),(?:\s*)(\d+)/i =>
- %Q{ text[key][0][0], text[key][0][1] = $1.to_s, $2.to_i },
- /^\[AFace\]\s*(\d+)/i =>
- %Q{ text[key][0][2] = $1.to_i },
- /^\[PFace\]\s*(\d+)/i =>
- %Q{ text[key][0][3] = $1.to_i },
- /^\[DFace\]\s*(.+)/i =>
- %Q{ text[key][0][0] = SES::ExternalText::Faces[$1.to_s][0]
- text[key][0][1] = SES::ExternalText::Faces[$1.to_s][1] },
- /^\[Name\]\s*(.+)/i =>
- %Q{ text[key][0][4] = $1.to_s },
- /^\[FName\]\s*(.+)/ =>
- %Q{ text[key][0][4] = $1.to_s
- text[key][0][0] = SES::ExternalText::Faces[$1.to_s][0]
- text[key][0][1] = SES::ExternalText::Faces[$1.to_s][1] },
- /^\[Position\]\s*(Top|Center|Bottom)/i =>
- %Q{ text[key][2][0] = if $1.downcase == "top" then 0
- elsif $1.downcase == "center" then 1
- else 2 end },
- /^\[Background\]\s*(Normal|Dim|Transparent)/i =>
- %Q{ text[key][2][1] = if $1.downcase == "normal" then 0
- elsif $1.downcase == "dim" then 1
- else 2 end },
- # Added Right Namebox ~
- /^\[Rname\]\s*(.+)/i =>
- %Q{ text[key][3] = $1.to_s},
- }
- end
- end
- class Game_Message
- attr_accessor :rname
- alias modified_ext_text_clear clear
- def clear
- modified_ext_text_clear
- @rname = ""
- end
- # ----------------------------------------------------------------------
- # Overwrite Load Text
- # ----------------------------------------------------------------------
- def load_text(data, name = true)
- if data[0][2]
- actor = $game_actors[data[0][2]].actor
- @face_name, @face_index = actor.face_name, actor.face_index
- elsif data[0][3]
- actor = $game_party.members[data[0][3]]
- @face_name, @face_index = actor.face_name, actor.face_index
- else
- @face_name, @face_index = data[0][0], data[0][1]
- end
- @position, @background = data[2][0], data[2][1]
- if name
- if SES::ExternalText::NameStyle == :box
- @name = data[0][4]
- @rname = data[3]
- else
- name2 = data[0][4] << "\\c[0]"
- end
- end
- text = data[1]
- new_page
- lines, i, cc = [""], 0, ""
- (lines[0] = name2; i += 1; lines[i] = "") if name && name2
- text.split(/\s/).each do |w|
- cc = get_color(w) || cc
- if too_wide?(lines[i] + w) || w =~ /(.*)\[Line\].*/i
- w.gsub!(/\[Line\]/i) { "" }
- i += 1; lines[i] = ""
- if i % 4 == 0
- lines[i] << (name2 || "") << cc;
- (i += 1; lines[i] = "") if name
- end
- end
- lines[i] << "#{w} "
- end
- return lines
- end
- end
- class Window_NameBox < Window_Base
- # ----------------------------------------------------------------------
- # Overwrite update
- # ----------------------------------------------------------------------
- def update
- super
- update_name
- end
- def update_name
- set_name($game_message.name) if @name != $game_message.name
- end
- end
- # ----------------------------------------------------------------------
- # Right namebox window class
- # ----------------------------------------------------------------------
- class Window_Rnamebox < Window_NameBox
- def initialize
- super
- update_xpos
- end
- def set_name(name)
- super(name)
- update_xpos
- end
- def update_xpos
- self.x = Graphics.width - width
- end
- def update_name
- set_name($game_message.rname) if @name != $game_message.rname
- end
- end
- # ----------------------------------------------------------------------
- # Overwrite create namebox
- # ----------------------------------------------------------------------
- class Scene_Map
- def create_namebox
- @namebox = Window_NameBox.new
- @rnamebox = Window_Rnamebox.new
- end
- end
- class Scene_Battle
- def create_namebox
- @namebox = Window_NameBox.new
- @rnamebox = Window_Rnamebox.new
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment