a
#------------------------------------
# ** NAME BOX / NAME TEXT SETUP
#----------------------------------
NAMEBOX_SKIN = "Window" # Windowskin of Name Box (In folder 'Graphics/System')
NAMEBOX_OPACITY = 255 # Name Box Opacity (Lowest 0 - 255 Highest)
NAMEBOX_BACK_OPACITY = 180 # Name Box Background Opacity
NAMEBOX_X_PLUS = 115#20 # Move Name Box & Text Horizontally (both faces system)
NAMEBOX_X_PLUS_NF = 140 # Addtional Name Box X only for NeoFace Name Box
# When using NeoFace, X Plus will calculate by: NAMEBOX_X_PLUS + NAMEBOX_X_PLUS_NF
NAMEBOX_Y_PLUS = 0 # Move Name Box & Text Vertically
NAMEBOX_TEXT_LENGTH_PER_LETTER = 10 # Length of Text Per Letter (in pixel)
NAMEBOX_TEXT_FONT = "UmePlus Gothic" # Name Text Font's Name
NAMEBOX_TEXT_SIZE = 22 # Name Text Font's Size
NAMEBOX_TEXT_HEIGHT_PLUS = 2 # Increase Name Text Height (For Big Size Text)
NAMEBOX_TEXT_BOLD = false # Make Text in Name Box Bold
NAMEBOX_TEXT_OUTLINE = false # Make Black Outline around Text (Good with Opacity = 0)
NAMEBOX_TEXT_DEFAULT_COLOR = [173,216,230]#[255,255,255] # [Red,Green,Blue]: Name Text Color (RGB)
# You can easily find color code for RGB (RedGreenBlue) color in Google
# You are allow to change color in game by call script:
# $game_message.color = [Red,Green,Blue]
NAMEBOX_TEXT_AFTER_NAME = ":" # Add Text after Name, leave "" to disable.
NAMEBOX_BOX_WIDTH_PLUS = 6 # Increase Name Box Width
NAMEBOX_BOX_HEIGHT_PLUS = 7 # Increase Name Box Height
MOVE_NAMEBOX = true
# (true/false) Move Text Box to Right Side if showing Face in Right side.
#---------------------------------
# [END] SETUP SCRIPT PART
#-------------------------------
end
$worale = {} if $worale == nil
$worale["NeoFace"] = true
#==============================================================================
# Window_Message
#------------------------------------------------------------------------------
#==============================================================================
class Window_Message
alias msg_ini initialize
#------------------------------------
# EDITED FROM ORIGINAL METHODS
#----------------------------------
def initialize
msg_ini
@face = Sprite.new
@face.z = self.z + 5
@nametxt = Sprite.new
@nametxt.z = self.z + 15
@namebox = nil
@ori_x = 0
@name_text = nil
end
alias msg_conspecha convert_special_characters
def convert_special_characters
clear_namebox if @namebox != nil
msg_conspecha
# CHECK FOR CALL NAME BOX/ CALL REPEAT NAME BOX/ CHANGE SIDE
@text.scan(/\\na\[(.*?)\]/)
if $1.to_s != ""
@name_text = $1.to_s
@text.sub!(/\\na\[(.*?)\]/) {}
end
@text.gsub!(/\\nn\[(.*?)\]/) do
$game_message._name = $1.to_s
a = ""
end
@text.scan(/\\side\[([-,0-9]+)\]/)
if $1.to_s != ""
$game_message.side = $1.to_i
@text.sub!(/\\side\[([-,0-9]+)\]/) {}
end
@name_text = $game_message._name if @name_text == nil and $game_message._name != ""
end
def new_page
contents.clear
if @face.bitmap != nil
@face.bitmap.dispose
end
if $game_message.face_name.empty?
@contents_x = TEXT_X_PLUS
else
name = $game_message.face_name
index = $game_message.face_index
# CALL DRAW FACE METHOD
draw_face2(name, self.x, self.y, index)
# CHECK FOR MOVE EFFECT
if MOVE_EFFECT == true
@ori_x = @face.x
if $game_message.side == 0 or $game_message.side == 1
@face.x = 0 - @face.width
else
@face.x = 416 + @face.width
end
end
@contents_x = get_x_face
end
@contents_y = 0
@line_count = 0
@show_fast = false
@line_show_fast = false
@pause_skip = false
contents.font.color = text_color(0)
end
def start_message
@text = ""
for i in 0...$game_message.texts.size
@text += "" if i >= $game_message.choice_start
@text += $game_message.texts[i].clone + "\x00"
end
@item_max = $game_message.choice_max
convert_special_characters
reset_window
new_page
end
def new_line
if $game_message.face_name.empty? or MOVE_TEXT == false
@contents_x = TEXT_X_PLUS
else
@contents_x = get_x_face
end
@contents_x += CHOICE_INPUT_X_PLUS if $game_message.choice_max > 0
@contents_y += WLH
@line_count += 1
@line_show_fast = false
end
def update
super
if @name_text != nil
draw_name(@name_text,self.x,self.y)
end
update_gold_window
update_number_input_window
update_back_sprite
update_show_fast
if @face.bitmap != nil
# UPDATE FADE IN EFFECT
if @face.opacity < 255
@face.opacity += FADE_SPEED
end
# UPDATE MOVE IN EFFECT
if MOVE_EFFECT == true and @ori_x != @face.x
if (@ori_x > @face.x and @face.x + MOVE_SPEED < @ori_x) or (@ori_x < @face.x and @face.x - MOVE_SPEED > @ori_x)
@face.x += MOVE_SPEED if @ori_x > @face.x
@face.x -= MOVE_SPEED if @ori_x < @face.x
else
@face.x = @ori_x
end
end
end
unless @opening or @closing
if @wait_count > 0
@wait_count -= 1
elsif self.pause
input_pause
elsif self.active
input_choice
elsif @number_input_window.visible
input_number
elsif @text != nil
update_message
elsif continue?
start_message
open
$game_message.visible = true
else
close
if @face.bitmap != nil
@face.bitmap.dispose
end
clear_namebox if @namebox != nil
$game_message.visible = @closing
end
end
end
def start_number_input
digits_max = $game_message.num_input_digits_max
number = $game_variables[$game_message.num_input_variable_id]
@number_input_window.digits_max = digits_max
@number_input_window.number = number
if $game_message.face_name.empty? or MOVE_TEXT == false
@number_input_window.x = x - 23
else
case $game_message.side
when 0
@number_input_window.x = (x + 112) - 23
when 1
@number_input_window.x = (x + text_x) - 23
when 2
@number_input_window.x = x - 23
when -1
@number_input_window.x = x - 23
end
end
@number_input_window.x += CHOICE_INPUT_X_PLUS
@number_input_window.y = y + @contents_y
@number_input_window.active = true
@number_input_window.visible = true
@number_input_window.update
end
def update_cursor
if @index >= 0
if $game_message.face_name.empty?
x = TEXT_X_PLUS
else
x = get_x_face
end
y = ($game_message.choice_start + @index) * WLH
# CHANGE WIDTH OF CURSOR FOR CHOICE SELECT
if $game_message.face_name.empty? or MOVE_TEXT == false
facesize = x
else
facesize = get_x_face
facesize += @face.width if $game_message.side == 2
facesize += @face.width + 16 if $game_message.side == -1
end
self.cursor_rect.set(x, y, contents.width - facesize, WLH)
else
self.cursor_rect.empty
end
end
#--------------------------------
# ADDITIONAL METHODS
#------------------------------
# RETURN Text X-Coordinate, DEPENDS ON FACE SIDE
def get_x_face
if MOVE_TEXT == true
case $game_message.side
when 0
return 112 + TEXT_X_PLUS
when 1
return text_x
when 2
return TEXT_X_PLUS
else
return TEXT_X_PLUS
end
else
return TEXT_X_PLUS
end
end
# RETURN Text X-Coordinate for Face Side = 1
def text_x
return @face.width + TEXT_X_PLUS
end
# Clear Name Box & Name Text
def clear_namebox
@nametxt.bitmap.dispose
@namebox.dispose
@namebox = nil
@name_text = nil
end
#--------------------------------------
# DRAW FACE [Both Systems] METHOD
#------------------------------------
def draw_face2(face_name, x, y, index = 0)
if $game_message.side == 0 or $game_message.side == -1 or EightFaces_File == true
# USE 8 FACES PER FILE
bitmap = Cache.face(face_name)
rect = Rect.new(0,0,0,0)
rect.width = (bitmap.width / 4)
rect.height = (bitmap.height / 2)
rect.x = index % 4 * rect.width
rect.y = index / 4 * rect.height
@face.bitmap = Bitmap.new(rect.width,rect.height)
@face.bitmap.blt(0,0,bitmap,rect)
bitmap.dispose
else
# USE 1 FACES PER FILE
@face.bitmap = Cache.face(face_name)
end
# SET X/Y OF FACE DEPENDS ON FACE SIDE
if $game_message.side == 1
@face.mirror = false
@face.x = x + 6
@face.y = y - (@face.height - 123)
elsif $game_message.side == 2
@face.mirror = true
@face.x = x + (538 - @face.width)
@face.y = y - (@face.height - 123)
elsif $game_message.side == 0
@face.mirror = false
@face.x = x + 16
@face.y = y + 16
elsif $game_message.side == -1
@face.mirror = true
@face.x = self.contents.width - @face.width + 16
@face.y = y + 16
end
@face.x += FACE_X_PLUS
@face.y += FACE_Y_PLUS
@face.opacity = 0 if FADE_EFFECT == true
end
#--------------------------------------
# DRAW NAME BOX METHOD
#-----------------------------------
def draw_name(name,x,y)
name = name + NAMEBOX_TEXT_AFTER_NAME
namesize = calculate_name_size(name)
@nametxt.bitmap = Bitmap.new(16 + (namesize * NAMEBOX_TEXT_LENGTH_PER_LETTER), 24 + NAMEBOX_TEXT_HEIGHT_PLUS)
@nametxt.x = x + 8 + NAMEBOX_X_PLUS
@nametxt.x += NAMEBOX_X_PLUS_NF if $game_message.side == 1 or $game_message.side == 2
@nametxt.y = y - 20 + NAMEBOX_Y_PLUS
@nametxt.x = 544 - @nametxt.x - @nametxt.width if MOVE_NAMEBOX == true and ($game_message.side == 2 or $game_message.side == -1)
@namebox = Window.new
@namebox.windowskin = Cache.system(NAMEBOX_SKIN)
@namebox.z = self.z + 10
@namebox.opacity = NAMEBOX_OPACITY
@namebox.back_opacity = NAMEBOX_BACK_OPACITY
@namebox.openness = 255
@namebox.x = @nametxt.x - NAMEBOX_BOX_WIDTH_PLUS
@namebox.y = @nametxt.y - NAMEBOX_BOX_HEIGHT_PLUS
@namebox.width = @nametxt.bitmap.width + (NAMEBOX_BOX_WIDTH_PLUS * 2)
@namebox.height = @nametxt.bitmap.height + (NAMEBOX_BOX_HEIGHT_PLUS * 2)
@nametxt.bitmap.font.name = NAMEBOX_TEXT_FONT
@nametxt.bitmap.font.size = NAMEBOX_TEXT_SIZE
@nametxt.bitmap.font.bold = NAMEBOX_TEXT_BOLD
if NAMEBOX_TEXT_OUTLINE == true
# MAKE TEXT OUTLINE
@nametxt.bitmap.font.color = Color.new(0,0,0)
@nametxt.bitmap.draw_text(0,2,@nametxt.bitmap.width,@nametxt.bitmap.height,name,1)
@nametxt.bitmap.draw_text(0,0,@nametxt.bitmap.width,@nametxt.bitmap.height,name,1)
@nametxt.bitmap.draw_text(2,0,@nametxt.bitmap.width,@nametxt.bitmap.height,name,1)
@nametxt.bitmap.draw_text(2,2,@nametxt.bitmap.width,@nametxt.bitmap.height,name,1)
end
@nametxt.bitmap.font.color = Color.new($game_message.color[0],$game_message.color[1],$game_message.color[2])
@nametxt.bitmap.draw_text(1,1,@nametxt.bitmap.width,@nametxt.bitmap.height,name,1)
@name_text = nil
end
# CALCULATE REAL TEXT LENGTH (for Other Languages, e.g. Japanese)
def calculate_name_size(name = "")
name = name.scan(/./)
return name.size
end
end # Window_Message
#==============================================================================
# Game_Message: + store variables
#------------------------------------------------------------------------------
#==============================================================================
class Game_Message
attr_accessor :side, :color, :_name
alias wor_neoface_old_ini initialize
def initialize
@side = Window_Base::DEFAULT_SIDE
@_name = ""
@color = Window_Base::NAMEBOX_TEXT_DEFAULT_COLOR
wor_neoface_old_ini
end
end
#==============================================================================
# END Neo-Face System
# by Woratana (woratana@hotmail)
#==============================================================================