#==============================================================================
# ■ 戦闘時のデザインアレンジ β By 貪藻矢射妥←
#
# 戦闘時などのコマンドの色を最初のひと文字とそれ以外とで変えて表示。
#
# ※最初の1文字を色変えしている(一文字目とそれ以外を分割して表示している)
# ため中央揃え表示ができなくなっています。
# →戦闘開始時のコマンドは最初の1文字を色変えにはできません。
#
#==============================================================================
# 更新っぽいもの
# 2008:09:12
# ・関数変更+表示関数を1つに統合。
# ・共通関数をモジュールとして個別化
#
# 2008:09:18
# ・色のカスタマイズポイントを変更
# ・表示文字が nil の場合エラー落ちするバグを修正
#
# 2008:11:21
# ・self.contentsのみしか使用できなかったものを拡張
#
# 2011:03:05
# ・コマンドを画像に変更可能に
# ・モジュールを分割
# ・Window_BGを導入することで、ウィンドウの背景を画像に指定可能
#
# 2011:07:01
# ・ちいさな本屋:CP制御ターンシステムに対応
# ・TYPE74RX-T:バトルのリトライに対応
#
# 2024:12:01
# ・VX風VocabをよりVXに近づける対応
module CMD_PIC
# コマンドの画像
CMD_ATK_PIC = "cmd_attack" # 攻撃
CMD_ITM_PIC = "cmd_item" # アイテム
CMD_SKL_PIC = "cmd_skill" # スキル
CMD_GRD_PIC = "cmd_guard" # 防御
CMD_ESC_PIC = "cmd_esc" # 逃走
CMD_RET_PIC = "cmd_retry" # リトライ
CMD_GIV_PIC = "cmd_giveup" # ギブアップ
# コマンドの画像(選択時)
CMD_ATK_PIC_S = "cmd_attack_s" # 攻撃
CMD_ITM_PIC_S = "cmd_item_s" # アイテム
CMD_SKL_PIC_S = "cmd_skill_s" # スキル
CMD_GRD_PIC_S = "cmd_guard_s" # 防御
CMD_ESC_PIC_S = "cmd_esc_s" # 逃走
CMD_RET_PIC_S = "cmd_retry_s" # リトライ
CMD_GIV_PIC_S = "cmd_giveup_s" # ギブアップ
# コマンドセット
CMD_PICs = [CMD_ATK_PIC, CMD_SKL_PIC, CMD_GRD_PIC, CMD_ITM_PIC,
CMD_ESC_PIC]
# コマンドセット(選択時)
CMD_PICs_SL = [CMD_ATK_PIC_S, CMD_SKL_PIC_S, CMD_GRD_PIC_S, CMD_ITM_PIC_S,
CMD_ESC_PIC_S]
# コマンドセット
CMD_PICs_BT = [CMD_RET_PIC, CMD_GIV_PIC]
# コマンドセット(選択時)
CMD_PICs_SL_BT = [CMD_RET_PIC_S, CMD_GIV_PIC_S]
# コマンドを画像にするかどうかのフラグ
CMD_PIC_FLG = true
# 選択時画像を変更するかどうかのフラグ
PIC_CHG_FLG = true
end
module PCMD_PIC
# パーティーコマンドの画像
PCMD_BATTLE = "p_cmd_battle"
PCMD_ESCAPE = "p_cmd_escape"
# パーティーコマンドの画像(選択時)
PCMD_BATTLE_S = "p_cmd_battle_s"
PCMD_ESCAPE_S = "p_cmd_escape_s"
# パーティーココマンドセット
PCMD_PICs = [PCMD_BATTLE, PCMD_ESCAPE]
# パーティーコマンドセット(選択時)
PCMD_PICs_SL = [PCMD_BATTLE_S, PCMD_ESCAPE_S]
# パーティーコマンドを画像にするかどうかのフラグ
PCMD_PIC_FLG = true
# 選択時画像を変更するかどうかのフラグ(パーティーコマンド)
PIC_CHG_FLG = true
end
module CMD_BG
# コマンドの背景画像
CMD_BACK = "cmd_back"
CMD_BACK_BT = "cmd_backX"
# コマンドの背景を画像にするかどうかのフラグ
USE_CMD_BK = true
end
module PCMD_BG
# パーティーコマンドの背景画像
PCMD_BAC = "p_cmd_back"
# パーティーコマンドの背景を画像にするかどうかのフラグ
USE_PCMD_BK = true
end
module PIRAMID
include BM
include DIAMOND
# ピラミッド状表示におけるx軸移動位置
XPLUS = 8
# 1番最初の文字の色
FIRSTCOLOR = Color.new(225, 220, 255, MAX8BIT)
FIRSTCOLORD = FIRSTCOLOR.clone
FIRSTCOLORD.alpha = HARF8BIT
#--------------------------------------------------------------------------
# ● ピラミッド状表示のための計算関数
# index : 項目番号
#--------------------------------------------------------------------------
def x_piramid(index, size)
index_mid = size / 2
x_plus = 0
if index <= index_mid
# 項目数が偶数の場合の頂点の処理
#p size, index_mid * 2, index, index_mid
if size == (index_mid * 2) && index == index_mid
x_plus = (index - 1) * XPLUS
# 項目数が奇数の場合の頂点の処理
else
x_plus = index * XPLUS
end
else
x_plus = (size - index - 1) * XPLUS
end
if size == 2
x_plus = 0
end
return x_plus
end
#--------------------------------------------------------------------------
# ● 一文字目とそれ以降切り離し
# text : 表示文字
#--------------------------------------------------------------------------
def dv_text(text)
txt1 = text.clone
txt2 = txt1.slice!(/./m)
return txt1, txt2
end
#--------------------------------------------------------------------------
# ● 一文字目だけ色を変えて表示
# rectr : 全体の表示領域
# text : 表示文字
# dflag : 有効文字色フラグ
#--------------------------------------------------------------------------
def diamond_draw(root, rectr, text, dflag=true)
d_txt = dv_text(text)
if dflag
root.font.color = FIRSTCOLOR
else
root.font.color = FIRSTCOLORD
end
draw_text2_root(root, rectr, d_txt[1])
rectr[0] += c_text_width_root(root, d_txt[1].clone)
if dflag
root.font.color = normal_color
else
root.font.color = disabled_color
end
draw_text2_root(root, rectr, d_txt[0])
end
#--------------------------------------------------------------------------
# ● 縁取り文字+一文字目だけ色を変えて表示 (self.contents Ver.)
# rectr : 全体の表示領域
# text : 表示文字
# dflag : 有効文字色フラグ
#--------------------------------------------------------------------------
def diamond_draw2(rectr, text, dflag=true)
diamond_draw2_root(self.contents, rectr, text, dflag)
end
#--------------------------------------------------------------------------
# ● 縁取り文字+一文字目だけ色を変えて表示 (汎用 Ver.)
# rectr : 全体の表示領域
# text : 表示文字
# dflag : 有効文字色フラグ
#--------------------------------------------------------------------------
def diamond_draw2_root(root, rectr, text, dflag=true)
font_name = root.font.name
root.font.name = DRAWFONT
shadow_draw_root(root, rectr, text, 0, dflag)
diamond_draw(root, rectr, text, dflag)
root.font.name = font_name
root.font.color = normal_color
end
end
class Game_System
attr_accessor :retry_flg # リトライフラグ
end
#==============================================================================
# ■ Window_Command
#------------------------------------------------------------------------------
# 一般的なコマンド選択を行うウィンドウです。
#==============================================================================
class Window_Command < Window_Selectable
include DIAMOND
include BM
include CMD_PIC
include CMD_BG
include PIRAMID
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# width : ウィンドウの幅
# commands : コマンド文字列の配列
#--------------------------------------------------------------------------
alias dia_initialize initialize
def initialize(width, commands)
# 元の処理を実行
dia_initialize(width, commands)
@local_index = self.index
if USE_CMD_BK && $scene.is_a?(Scene_Battle) && $OuterFlgs["Window_BG"]
#self.opacity = 0
@bg_sprite = nil
if $game_system.retry_flg
make_bg(CMD_BACK_BT)
else
make_bg(CMD_BACK)
end
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
# シーンを限定する。
if $scene.is_a?(Scene_Battle) || $scene.is_a?(Scene_Set_Ability)# ||
#$scene.is_a?(Scene_Questdiary7)
x_plus = x_piramid(index, @commands.size)
else
x_plus = 0
end
draw_x = 4 + x_plus
draw_y = 32 * index
d_flg = index == 4 && !$game_temp.battle_can_escape &&
$scene.is_a?(Scene_Battle) ? false : true
# コマンドを描画するか、画像にするか
if CMD_PIC_FLG && $scene.is_a?(Scene_Battle)
# 選択されている項目のみ画像を変更する
if PIC_CHG_FLG && index == @local_index
if $game_system.retry_flg
cmd_pic = RPG::Cache.windowskin(CMD_PICs_SL_BT[index])
else
cmd_pic = RPG::Cache.windowskin(CMD_PICs_SL[index])
end
else
if $game_system.retry_flg
cmd_pic = RPG::Cache.windowskin(CMD_PICs_BT[index])
else
cmd_pic = RPG::Cache.windowskin(CMD_PICs[index])
end
end
self.contents.blt(draw_x, draw_y, cmd_pic, cmd_pic.rect,
d_flg == true ? MAX8BIT : 80)
cmd_pic.dispose
else
rectr = [draw_x, draw_y, self.contents.width - 8, 32]
rect = Rect.new(rectr[0], rectr[1], rectr[2], rectr[3])
self.contents.fill_rect(rect, NILCOLOR)
diamond_draw2(rectr, @commands[index], d_flg)
end
end
#--------------------------------------------------------------------------
# ● カーソルの矩形更新
#--------------------------------------------------------------------------
alias dia_update_cursor_rect update_cursor_rect
def update_cursor_rect
@local_index = @index
# 画像チェンジ
if CMD_PIC_FLG && CMD_PIC_FLG && $scene.is_a?(Scene_Battle)
refresh
else
# 元の処理を実行
dia_update_cursor_rect
end
end
end
#==============================================================================
# ■ Window_PartyCommand
#------------------------------------------------------------------------------
# バトル画面で、戦うか逃げるかを選択するウィンドウです。
#==============================================================================
class Window_PartyCommand < Window_Selectable
include DIAMOND
include BM
include PCMD_PIC
include PCMD_BG
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias dia_initialize initialize
def initialize
dia_initialize
if USE_PCMD_BK && $OuterFlgs["Window_BG"]
@bg_sprite = nil
make_bg(PCMD_BAC, 220)
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item(index, color)
draw_x = 160 + index * 160 + 4
draw_y = 0
if PCMD_PIC_FLG
# 選択されている項目のみ画像を変更する
if PIC_CHG_FLG && index == @local_index
cmd_pic = RPG::Cache.windowskin(PCMD_PICs_SL[index])
else
cmd_pic = RPG::Cache.windowskin(PCMD_PICs[index])
end
self.contents.blt(draw_x, draw_y, cmd_pic, cmd_pic.rect,
color == normal_color ? MAX8BIT : 80)
cmd_pic.dispose
else
# 戦闘/逃走の文字列を設定しなおす
@commands = [Vocab::fight, Vocab::escape]
rectr = [draw_x, draw_y, 128 - 10, 32]
#rect = Rect.new(rectr[0], rectr[1], rectr[2], rectr[3])
#self.contents.fill_rect(rect, NILCOLOR)
font_name = self.contents.font.name
self.contents.font.name = DRAWFONT
draw_shadow_text(rectr, @commands[index], color, 1,
color == normal_color ? true : false)
self.contents.font.name = font_name
end
end
#--------------------------------------------------------------------------
# ● カーソルの矩形更新
#--------------------------------------------------------------------------
alias dia_update_cursor_rect update_cursor_rect
def update_cursor_rect
@local_index = @index
# 画像チェンジ
if PCMD_PIC_FLG && PCMD_PIC_FLG && $scene.is_a?(Scene_Battle)
refresh
else
# 元の処理を実行
dia_update_cursor_rect
end
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_item(0, normal_color)
draw_item(1, $game_temp.battle_can_escape ? normal_color : disabled_color)
end
end
|