x = bitmap_width / 2 if pos == 0
x = Graphics.width - bitmap_width / 2 if pos == 1
show_name_window(file_name, file_index, x, 0)
end
end
end
#--------------------------------------------------------------------------
# ☆ 改行处理
#--------------------------------------------------------------------------
alias a1_stand_picture_window_message_new_line_x new_line_x
def new_line_x
case no_index
when 0
@stand_pic[no_prev_name].bye("L",BYE_DURATION) if stand_pic_enable?(no_prev_name)
pos = LEFT
@show_pos[0] = name
when 1
@stand_pic[no_prev_name].bye("R",BYE_DURATION) if stand_pic_enable?(no_prev_name)
pos = RIGHT
@show_pos[1] = name
end
@stand_pic[name].show(file_name, pos,index, duration) if stand_pic_enable?(name)
end
#--------------------------------------------------------------------------
# ○ 直前に話していないIndexを取得
#--------------------------------------------------------------------------
def no_prev_index
return 0 if @show_pos[0] != @prev_name
return 1 if @show_pos[1] != @prev_name
end
#--------------------------------------------------------------------------
# ○ 检查是否表示
#--------------------------------------------------------------------------
def show_pos(name)
return 0 if @show_pos[0] == name
return 1 if @show_pos[1] == name
return -1
end
#--------------------------------------------------------------------------
# ☆ 更新帧数
#--------------------------------------------------------------------------
alias a1_stand_pic_window_message_update update
def update
update_stand_pic
a1_stand_pic_window_message_update
end
#--------------------------------------------------------------------------
# ○ 立绘的update
#--------------------------------------------------------------------------
def update_stand_pic
for name in @stand_pic.keys
@stand_pic[name].update
end
end
#--------------------------------------------------------------------------
# ○ 文章的check
#--------------------------------------------------------------------------
alias a1_stand_pic_wm_chk_text chk_text
def chk_text(text)
text.gsub!(/\eERASE/,"")
text.gsub!(/\eSHOW/,"")
return a1_stand_pic_wm_chk_text(text)
end
#--------------------------------------------------------------------------
# ☆ 文字控制的处理
# code : 文字控制的本体部分(「\C[1]」なら「C」)
# text : 描画处理中的文字列buffer(必要的话破坏性地変更)
# pos : 描画位置 {:x, :y, :new_x, :height}
#--------------------------------------------------------------------------
alias a1_stand_pic_wm_process_escape_character process_escape_character
def process_escape_character(code, text, pos)
file_info = find_name(file_name, file_index)
name = file_info[0]
index = file_info[1]
case code.upcase
when 'TURN'
text.slice!(/\[(.)\]/) rescue 0
if stand_bitmap_enable?(name, index)
case $1
when 'L'
@stand_pic[name].pic_sprite.mirror = true
when 'R'
@stand_pic[name].pic_sprite.mirror = false
end
end
return true
when 'RETURN'
text.slice!(/\[(\d+)\]/) rescue 0
if stand_bitmap_enable?(name, index)
index = show_pos(name)
return if index == -1
duration = $1.to_i
@stand_pic[name].return_pos(index, duration)
end
when 'SHOW'
if stand_bitmap_enable?(name, index)
return if @stand_pic[name].pic_sprite == nil or name.empty?
@stand_pic[name].pic_sprite.visible = true
end
when 'ERASE'
if stand_bitmap_enable?(name, index)
return if @stand_pic[name].pic_sprite == nil or name.empty?
@stand_pic[name].pic_sprite.visible = false
end
when 'TONE'
text.slice!(/\[(.+)\]/) rescue 0
if stand_bitmap_enable?(name, index)
params = $1.to_s.split(",")
duration = params[0].to_i
red = $a1_common.minus_to_i(params[1])
green = $a1_common.minus_to_i(params[2])
blue = $a1_common.minus_to_i(params[3])
gray = $a1_common.minus_to_i(params[4]) unless params[4] == nil
if gray == nil
tone = Tone.new(red, green, blue)
else
tone = Tone.new(red, green, blue, gray)
end
@stand_pic[name].start_tone_change(tone, duration)
end
when 'MV'
text.slice!(/\[([-]*\d+)[,]([-]*\d+)[,](\d+)\]/) rescue 0
if stand_bitmap_enable?(name, index)
x = $a1_common.minus_to_i($1)
y = $a1_common.minus_to_i($2)
duration = $3.to_i
@stand_pic[name].move(x, y, duration)
end
when 'MVA'
text.slice!(/\[([-]*\d+)[,]([-]*\d+)[,](\d+)\]/) rescue 0
if stand_bitmap_enable?(name, index)
x = $a1_common.minus_to_i($1)
y = $a1_common.minus_to_i($2)
duration = $3.to_i
@stand_pic[name].move_plus(x, y, duration)
end
when 'OP'
text.slice!(/\[(\d+)[,](\d+)\]/) rescue 0
if stand_bitmap_enable?(name, index)
@stand_pic[name].change_opacity($1.to_i,$2.to_i)
end
when 'BYE'
text.slice!(/^\[(.)[,](\d+)\]/) rescue 0
if stand_bitmap_enable?(name, index)
@show_pos.delete_at(show_pos(name))
@stand_pic[name].bye($1,$2.to_i)
end
else
a1_stand_pic_wm_process_escape_character(code, text, pos)
end
end
#--------------------------------------------------------------------------
# ☆ 通常文字的处理
#--------------------------------------------------------------------------
alias a1_stand_pic_wm_process_normal_character process_normal_character
def process_normal_character(c, pos)
file_info = find_name(file_name, file_index)
name = file_info[0]
index = file_info[1]
if stand_bitmap_enable?(name, index)
@stand_pic[name].mouth_move
end
a1_stand_pic_wm_process_normal_character(c, pos)
end
#--------------------------------------------------------------------------
# ○ 立绘有效?
#--------------------------------------------------------------------------
def stand_pic_enable?(name)
return false if name.empty?
return false if @stand_pic[name] == nil
return false if @stand_pic[name].pic_sprite == nil
return false unless $game_system.show_stand_picture
return true
end
#--------------------------------------------------------------------------
# ○ bitmap有効?
#--------------------------------------------------------------------------
def stand_bitmap_enable?(name, index)
return false if name.empty?
return false if @stand_pic[name].pic_sprite == nil
return false unless @stand_pic[name].enable_bitmap?(index)
return false unless $game_system.show_stand_picture
return true
end
#--------------------------------------------------------------------------
# ☆ 解放
#--------------------------------------------------------------------------
alias a1_stand_pic_window_message_dispose dispose
def dispose
a1_stand_pic_window_message_dispose
dispose_stand_picture
end
#--------------------------------------------------------------------------
# ○ 立絵解放
#--------------------------------------------------------------------------
def dispose_stand_picture
for name in @stand_pic.keys
@stand_pic[name].erase
end
end
#--------------------------------------------------------------------------
# ○ 名字检索
#--------------------------------------------------------------------------
def find_name(filename, fileindex)
list = A1_System::StandPicture::NAME_CHANGE[filename]
return [filename,fileindex] if list == nil
if list.size == 1
info = list[0]
return [info[0],info[1]*8+fileindex]
end
return [filename,fileindex] if list[fileindex] == nil
return list[fileindex]
end
end
#==============================================================================
# ■ Game_StandPic
#==============================================================================
if command == "立ち絵表示"
case params[0]
when "on"
$game_system.show_stand_picture = true
when "off"
$game_system.show_stand_picture = false
end
else
a1_stand_picture_proc_comment_command(command, params)
end
end
end
end