#==============================================================================
# ** Window_HCommand_WI Modified from Blizzard's Window_HCommand By Ryex
#------------------------------------------------------------------------------
# This window deals with general command choices, but the display is
# horizontal.
#==============================================================================
class Window_Battle_command_WI < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# width : window width
# commands : command text string array
#--------------------------------------------------------------------------
def initialize(width, commands)
super(0, 0, width, 64)
self.width, self.height = width, 64
@commands = commands
@item_max = commands.size
@column_max = commands.size
self.contents = Bitmap.new( @item_max * 32, self.height - 32)
refresh
update_cursor_rect
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# color : text color
#--------------------------------------------------------------------------
def draw_item(i, color)
self.contents.font.color = color
w = 152
x = i * 152
rect = Rect.new(x, 0, w, 32)
#self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[i][1], 1)
self.contents.blt(x, 4, RPG::Cache.icon(@commands[i][0]),
Rect.new(0, 0, 24, 24))
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
# If cursor position is less than 0
if @index < 0
self.cursor_rect.empty
return
end
# Get current row
row = @index
# If current row is before top row
if row < self.top_row
# Scroll so that current row becomes top row
self.top_row = row
end
# If current row is more to back than back row
if row > self.top_row + (self.page_row_max - 1)
# Scroll so that current row becomes back row
self.top_row = row - (self.page_row_max - 1)
end
# Calculate cursor width
cursor_width = 152
# Calculate cursor coordinates
x = @index * 152 - self.ox
# Update cursor rectangle
self.cursor_rect.set(x, 0, cursor_width, 32)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# If cursor is movable
if self.active and @item_max > 0 and @index >= 0
# If the right directional button was pressed
if Input.repeat?(Input::RIGHT)
# If column count is 2 or more, and cursor position is closer to front
# than (item count -1)
if @column_max >= 2 and @index < @item_max - 1
# Move cursor right
$game_system.se_play($data_system.cursor_se)
@index = (@index + @column_max) % @item_max
end
end
# If the left directional button was pressed
if Input.repeat?(Input::LEFT)
# If column count is 2 or more, and cursor position is more back than 0
if @column_max >= 2 and @index > 0
# Move cursor left
$game_system.se_play($data_system.cursor_se)
@index = (@index - @column_max + @item_max) % @item_max
end
end
end
# Update help text (update_help is defined by the subclasses)
if self.active and @help_window != nil
update_help
end
# Update cursor rectangle
update_cursor_rect
end
#--------------------------------------------------------------------------
# * Update Help Window
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(@commands[self.index][1])
end
end
module RyexCFG
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
BATTLE_MENU_ICONS = []
BATTLE_MENU_ICONS[1] = "Attack" #Icon name for the Attack option on the battle menu
BATTLE_MENU_ICONS[2] = "Skill" #Icon name for the Skill option on the battle menu
BATTLE_MENU_ICONS[3] = "Defend"#Icon name for the Defend option on the battle menu
BATTLE_MENU_ICONS[4] = "BattleItem" #Icon name for the Item option on the battle menu
#BATTLE_MENU_ICONS[5] = "Summon" #Icon name for the Summon option on the battle menu
#BATTLE_MENU_ICONS[6] = "Release" #Icon
#BATTLE_MENU_ICONS[7] = "Door" #Icon name for the Exit option on the main menu
#--------------------------------
# * Custom scenes
# If for some reason you want to use an item, equip, skill, status, save,
# exit, or option screen fallow the instrutions below.
#--------------------------------
end
commands = [[RyexCFG::BATTLE_MENU_ICONS[1], $data_system.words.attack],
[RyexCFG::BATTLE_MENU_ICONS[2], $data_system.words.skill],
[RyexCFG::BATTLE_MENU_ICONS[3], $data_system.words.guard],
[RyexCFG::BATTLE_MENU_ICONS[4], $data_system.words.item]]
@actor_command_window = Window_Battle_command_WI.new(640, commands)
@actor_command_window.x = 416