09-17-2018, 03:19 AM
Yep. Found the issue... My bad.
Haphazard stupidity by the Resident Werewolf.
Code:
#===========================================================#
# ICON ITEMS
# Version: 1.0
# By: Polraudio
# Haphazardly butchered by LilyFrog
# Exclusive to RMU or GDU
#===========================================================#
module LilyItems
# DIMENSIONS
# ==========
#
MENU_DIMENSIONS = [4,4] # Number of columns across, and rows down
# POSITIONING
# ===========
#
MENU_COORD = [10,40] # X Position / Y position
BATTLE_COORD = [10,40] # X Position / Y position
# SPACING
# =======
#
X_SPACING = 18 # Horizontal spacing between icons
Y_SPACING = 18 # Vertical spacing between icons
WINDOWSKIN = "Bluish"
BACKGROUND = nil
HELP_DISPLAY = nil
end
#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
# This window displays items in possession on the item and battle screens.
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Get Columns for basic system
@column_max = LilyItems::MENU_DIMENSIONS[1]
# Calculate width of window (icon width x columns) + 32px border
width = ((32 + LilyItems::X_SPACING) * @column_max) + 32
# Calculate height of window (icon width x icons down) + 32px border
height = ((32 + LilyItems::Y_SPACING) * LilyItems::MENU_DIMENSIONS[0]) + 32
# Super (as in inheriting from Window_Selectable class)
super(0, 0, width, height)
# Define position in menu
self.x = LilyItems::MENU_COORD[0]
self.y = LilyItems::MENU_COORD[1]
# If in battle, reposition based on config
# and make it semi-transparent
if $game_temp.in_battle
self.x = LilyItems::BATTLE_COORD[0]
self.y = LilyItems::BATTLE_COORD[1]
self.back_opacity = 160
end
#
if LilyItems::BACKGROUND.nil?
self.opacity = 0
self.back_opacity = 0
end
# Special Windowskin only for this menu.....
self.windowskin = RPG::Cache.windowskin(LilyItems::WINDOWSKIN)
# Ensure newly loaded content
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Add item
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
# Also add weapons and items if outside of battle
unless $game_temp.in_battle
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
end
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
# THE CHANGE HERE ---------------------------
height = LilyItems::MENU_DIMENSIONS[0] * 32
self.contents = Bitmap.new(width - 32, height)
# END OF CHANGE HERE ------------------------
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Item : number = $game_party.item_number(item.id)
when RPG::Weapon : number = $game_party.weapon_number(item.id)
when RPG::Armor : number = $game_party.armor_number(item.id)
end
if item.is_a?(RPG::Item) and $game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = index % 4 * (32 + LilyItems::X_SPACING)
y = index / 4 * (32 + LilyItems::Y_SPACING)
rect = Rect.new(x, y, 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
# Change icon opacity if disabled color
opacity = self.contents.font.color == normal_color ? 255 : 128
# Draw the icon
self.contents.blt(x+4, y+4, bitmap, Rect.new(0, 0, 24, 24), opacity)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
return if LilyItems::HELP_DISPLAY.nil?
@help_window.set_text(self.item == nil ? "" : self.item.name+": "+self.item.description)
end
#--------------------------------------------------------------------------
# * Get Row Count
#--------------------------------------------------------------------------
def row_max
# Compute rows from number of items and columns
x = LilyItems::MENU_DIMENSIONS[0]
y = LilyItems::MENU_DIMENSIONS[1]
return (@item_max + (x * y) - 1) / (x * y)
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
# If cursor position is less than 0
return self.cursor_rect.empty if @index < 0
# Deal with rectangle settings
x = @index % 4 * (32 + LilyItems::X_SPACING)
y = @index / 4 * (32 + LilyItems::Y_SPACING)
width = 32
# Draw Rectangle
self.cursor_rect.set(x, y, width, 32)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# If cursor is movable
if self.active and @item_max > 0 and @index >= 0
# If pressing down on the directional buttons
if Input.repeat?(Input::DOWN)
# If the cursor position is above the bottom-most row
if (@index / 4) < (LilyItems::MENU_DIMENSIONS[0] - 1)
# Move cursor right
$game_system.se_play($data_system.cursor_se)
@index += 4
end
end
# If the up directional button was pressed
if Input.repeat?(Input::UP)
# If the cursor position is below the top-most row
if (@index / 4) > 0
# Move cursor right
$game_system.se_play($data_system.cursor_se)
@index -= 4
end
end
# If the right directional button was pressed
if Input.repeat?(Input::RIGHT)
# If the cursor position is to the left of the right-most columb
if (@index % 4) < (LilyItems::MENU_DIMENSIONS[1] - 1)
# Move cursor right
$game_system.se_play($data_system.cursor_se)
@index += 1
end
end
# If the left directional button was pressed
if Input.repeat?(Input::LEFT)
# If the cursor position is to the right of the left-most columb
if (@index % 4) > 0
# Move cursor right
$game_system.se_play($data_system.cursor_se)
@index -= 1
end
end
# Ensure not beyond the item limits ^_^
@index = 0 if @index < 0
@index = @item_max-1 if @index >= @item_max
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
end
Haphazard stupidity by the Resident Werewolf.