lunariafantasia/Scripts/_.77.rb
2024-01-12 03:12:38 -06:00

125 lines
No EOL
5.4 KiB
Ruby
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
#  ゲーム中の全てのウィンドウのスーパークラスです。
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ○ SEの演奏 ※ファイル名が英数字の物のみ ピッチ・音量指定できず
#--------------------------------------------------------------------------
def se_play(se)
Audio.se_play("Audio/SE/#{se}", 100, 100)
end
#--------------------------------------------------------------------------
# ○ 制御文字の引数を破壊的に取得
#--------------------------------------------------------------------------
def obtain_escape_param_ex(text)
text.slice!(/^\[\w+\]/)[/\w+/] rescue "Damage1"
end
#--------------------------------------------------------------------------
# ○ 文章中の立ち絵変更
#--------------------------------------------------------------------------
def stand_change(ary)
return if ary[0] == nil || ary[1] == 0
if ary[0] == "n"
interpreter.stand_change(ary[1], ary[2])
else
interpreter.npc_stand_change(ary[1], ary[2])
end
end
#--------------------------------------------------------------------------
# ○ 文章中の顔グラ変更
#--------------------------------------------------------------------------
def face_change(id)
redraw_face(id)
end
#--------------------------------------------------------------------------
# ○ 文章中のバルーン表示 ary[0] : バルーンID ary[1] : ターゲット
#--------------------------------------------------------------------------
def balloon_open(ary)
return if ary[0] == 0
interpreter.b_icon(ary[0], ary[1], false)
end
#--------------------------------------------------------------------------
# ○ 制御文字の引数を破壊的に取得
# $1 = n → アクター k → サブ $2 = アクターID $3 = フェイス番号
# 記入例 アクター \stnd[n,1,0]    NPC \stnd[k,1,0]
#--------------------------------------------------------------------------
def obtain_escape_param_stand(text)
#p text.slice(/^\[(\w)\,(\d+)\,(\d+)\]/)
#p [$1,$2,$3]
text.slice!(/^\[(\w)\,(\d+)\,(\d+)\]/)
return [$1, $2.to_i, $3.to_i]
end
#--------------------------------------------------------------------------
# ○
# $1 = 顔ID
#--------------------------------------------------------------------------
def obtain_escape_param_face(text)
text.slice!(/^\[(\d+)\]/)
return $1.to_i
end
#--------------------------------------------------------------------------
# ○
# $1 = バルーンID $2 = 表示キャラ \bln[1,-1]
#--------------------------------------------------------------------------
def obtain_escape_param_balloon(text)
text.slice!(/^\[(\d+)\,(\-?\d+)\]/)
return [$1.to_i, $2.to_i]
end
#--------------------------------------------------------------------------
# ● 制御文字の処理
# code : 制御文字の本体部分(「\C[1]」なら「C」
#--------------------------------------------------------------------------
alias se_process_escape_character process_escape_character
def process_escape_character(code, text, pos)
se_process_escape_character(code, text, pos)
case code.upcase
when 'SE'
se_play(obtain_escape_param_ex(text))
when 'STND'
stand_change(obtain_escape_param_stand(text))
when 'FACE'
face_change(obtain_escape_param_face(text))
when 'BLN'
balloon_open(obtain_escape_param_balloon(text))
end
end
#--------------------------------------------------------------------------
# ○
#--------------------------------------------------------------------------
def interpreter
$game_party.in_battle ? $game_troop.interpreter : $game_map.interpreter
end
#--------------------------------------------------------------------------
# 顔グラフィックの再描画
#--------------------------------------------------------------------------
def redraw_face(face_id, x = 0, y = 0, enabled = true)
end
end
#==============================================================================
# ■ Window_Message
#------------------------------------------------------------------------------
#  文章表示に使うメッセージウィンドウです。
#==============================================================================
class Window_Message < Window_Base
#--------------------------------------------------------------------------
# 顔グラフィックの再描画
# enabled : 有効フラグ。false のとき半透明で描画
#--------------------------------------------------------------------------
def redraw_face(face_id, x = 0, y = 0, enabled = true)
#draw_face($game_message.face_name, $game_message.face_index, 0, 0)
name = $game_message.face_name.clone
name.slice!(/\d+$/i)
number = face_id / 8
face_name = name + "#{format("%02d",number)}"
face_index = face_id % 8
bitmap = Cache.face(face_name)
rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96)
contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
bitmap.dispose
end
end