#-------------------------------------------------------------------------------
# ** Game_Map (Zer0)
#-------------------------------------------------------------------------------
class Game_Map
def name
return load_data('Data/MapInfos.rxdata')[@map_id].name
end
end
#-------------------------------------------------------------------------------
# ** Window_Base (Zer0)
#-------------------------------------------------------------------------------
class Window_Base
def draw_actor_hunger(actor, x, y, w = 148)
if $game_system.BARS
w += 12
rate = (actor.hunger != 0 ? actor.hunger.to_f / actor.max_hunger : 0)
if rate < 0.5
color1 = Color.new(20 * rate, 60, 80, 192)
color2 = Color.new(60 * rate, 180, 240, 192)
elsif rate >= 0.5
color1 = Color.new(20 + 120 * (rate-0.5), 60 + 40 * (rate-0.5), 80, 192)
color2 = Color.new(60 + 360 * (rate-0.5), 180 + 120 * (rate-0.5), 240, 192)
end
color3 = Color.new(80, 80, 80, 192)
self.contents.gradient_bar(x, y, w, color1, color2, color3, rate)
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 148, 32, 'Hunger')
self.contents.font.color = normal_color
self.contents.draw_text(x + 24, y, 84, 32, actor.hunger.to_s, 2)
self.contents.draw_text(x + 108, y, 12, 32, '/', 1)
self.contents.draw_text(x + 120, y, 84, 32, actor.max_hunger.to_s)
end
def draw_actor_thirst(actor, x, y, w = 148)
if $game_system.BARS
w += 12
rate = (actor.thirst != 0 ? actor.thirst.to_f / actor.max_thirst : 0)
if rate < 0.5
color1 = Color.new(20 * rate, 60, 80, 192)
color2 = Color.new(60 * rate, 180, 240, 192)
elsif rate >= 0.5
color1 = Color.new(20 + 120 * (rate-0.5), 60 + 40 * (rate-0.5), 80, 192)
color2 = Color.new(60 + 360 * (rate-0.5), 180 + 120 * (rate-0.5), 240, 192)
end
color3 = Color.new(80, 80, 80, 192)
self.contents.gradient_bar(x, y, w, color1, color2, color3, rate)
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 148, 32, 'Thirst')
self.contents.font.color = normal_color
self.contents.draw_text(x + 24, y, 84, 32, actor.thirst.to_s, 2)
self.contents.draw_text(x + 108, y, 12, 32, '/', 1)
self.contents.draw_text(x + 120, y, 84, 32, actor.max_thirst.to_s)
end
end
#==============================================================================
# ** Window_Location
#-----------------------------------------------------------------------------
# A window that shows your current Location.
#==============================================================================
class Window_Location < Window_Base
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#-----------------------------------------------------------------------------
# * Refresh
#-----------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Localización")
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, $game_map.name, 2)
end
end
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
# This window displays party member status on the menu screen.
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Draw Face Graphic
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_face_graphic(actor, x, y)
bitmap = RPG::Cache.picture(actor.id.to_s)
self.contents.blt(x, y, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height))
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 64
y = i * 116
actor = $game_party.actors[i]
draw_actor_face_graphic(actor, x - 64, y)
draw_actor_name(actor, x + 93, y)
#--------------------------------------------
draw_actor_hunger(actor, x + 40, y + 32)
draw_actor_thirst(actor, x + 40, y + 64)
#--------------------------------------------
draw_actor_state(actor, x + 270, y)
draw_actor_hp(actor, x + 236, y + 32)
draw_actor_sp(actor, x + 236, y + 64)
end
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make command window
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = "Guardar"
s6 = "Salir"
@command_window = Window_Command_New.new(160, [s1, s2, s3, s4, s5, s6])
@command_window.index = @menu_index
@command_window.height = 225
@command_window.x = 480
# If number of party members is 0
if $game_party.actors.size == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# If save is forbidden
if $game_system.save_disabled
# Disable save
@command_window.disable_item(4)
end
# Make play time window
@playtime_window = Window_PlayTime.new
@playtime_window.x = 480
@playtime_window.y = 224
# Make location window
@location_window = Window_Location.new
@location_window.x = 480
@location_window.y = 320
# Make gold window
@gold_window = Window_Gold.new
@gold_window.x = 480
@gold_window.y = 416
# Make status window
@status_window = Window_MenuStatus.new
@status_window.x = 0
@status_window.y = 0
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@command_window.dispose
@playtime_window.dispose
@location_window.dispose
@gold_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@command_window.update
@playtime_window.update
@location_window.update
@gold_window.update
@status_window.update
# If command window is active: call update_command
if @command_window.active
update_command
return
end
# If status window is active: call update_status
if @status_window.active
update_status
return
end
end
end
#===============================================================================
# ** Window_Command_New
#-------------------------------------------------------------------------------
# This code allows the command window in the menu to display icons.
#===============================================================================
class Window_Command_New < Window_Selectable
#-----------------------------------------------------------------------------
# * Public Instance Variables
#-----------------------------------------------------------------------------
attr_reader :continue
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize(index, continue)
commands = [$data_system.words.item, $data_system.words.skill, $data_system.words.equip,
'Status', 'Guardar', 'Salir']
super(0, 0, 160, commands.size * 32 + 32)
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, @item_max * 32)
refresh
self.index = 0
end
#-----------------------------------------------------------------------------
# * Draw Item
#-----------------------------------------------------------------------------
def draw_item(i, color)
self.contents.fill_rect(0, i*32, 148, 32, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon("Menu#{i}")
opacity = (color == normal_color ? 255 : 128)
self.contents.blt(4, 4 + i*32, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.font.color = color
self.contents.draw_text(28, i*32, 148, 32, @commands[i])
end
#-----------------------------------------------------------------------------
# * Refresh
#-----------------------------------------------------------------------------
def refresh
self.contents.clear
(0...@item_max).each {|i| draw_item(i, normal_color)}
end
end
#==============================================================================
# ** Window_Gold
#------------------------------------------------------------------------------
# This window displays amount of gold.
#==============================================================================
class Window_Gold < Window_Base
#--------------------------------------------------------------------------
# * Draw Picture
#--------------------------------------------------------------------------
def draw_picture(x, y)
bitmap = RPG::Cache.picture("Coin")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x, y, bitmap, src_rect)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_picture(105, 4)
cx = contents.text_size($data_system.words.gold).width
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)
end
end