#===============================================================================
# Game Guy's Hud
# Version 1.2
# Author game_guy
#-------------------------------------------------------------------------------
# Intro:
# Its a modded version of Blizz ABS's Hud.
#
# Features:
# Works with/without direct hotkeys
# Works with/without easy overdrive system
# Faces supported (must be 64x64 or less)
# If face doesnt exist game will not crash
#
# Instructions
# For faces to work, make sure the size is 64x64 or less or else it wont show,
# then make sure the picture has the name of the actor. Then import it into the
# pictures folder.
#
# Config:
# UseExpBar - Choose to have an exp bar on or off
# Displays an Experience Bar when on
#
# ExpName - The name of Experience
# Displays this by the Exp Bar
#
# UseFaces - Choose to have faces on or off
# Displays the current actors face
#
# UseCharacter - Choose to have characters on or off
# Displays the current actors character graphic
#
#
# Credits:
# game_guy ~ for making it
# C.C.Royal ~ For requesting the HUD
# Blizzard ~ Easy Overdrive system, Blizz ABS, and Blizz ABS Original HUD
#===============================================================================
module GameGuy
#===============================================
# Begin Config
#===============================================
#----------------------------------
# UseExpBar = false(off) true(on)
#----------------------------------
UseExpBar = true
#----------------------------------
# ExpName = "Exp Name"
#----------------------------------
ExpName = "Exp"
#----------------------------------
# UseFaces = false(off) true(on)
#----------------------------------
UseFaces = false
#----------------------------------
# UseCharacter = false(off) true(on)
#----------------------------------
UseCharacter = true
#===============================================
# End Config
#===============================================
end
if !$BlizzABS || BlizzABS::VERSION < 2.1
raise 'ERROR: "Game Guys Hud" requires Blizz-ABS 2.1 or higher.'
end
class Hud < Sprite
def initialize(viewport = nil)
super
create_positions
h = 110
h += 16 if $easy_overdrive != nil
h += 16 if GameGuy::UseExpBar
self.bitmap = Bitmap.new(@hud_width, h)
self.bitmap.font.name = 'Arial'
self.bitmap.font.size = 16
self.bitmap.font.bold = true
case BlizzABS::Config::HUD_POSITION
when 0 then self.x, self.y = 4, 4
when 1 then self.x, self.y = 640 - self.bitmap.width - 4, 4
when 2 then self.x, self.y = 4, 364
end
self.z = 1000
draw_basic
update
end
def create_positions
@original_width = @hud_width = 240
@original_height = @hud_height = 81
@name_x, @name_y, @level_x, @level_y = 4, 1, 74+110, 1
@hp_x, @hp_y, @sp_x, @sp_y = 74, 17, 74, 33
@hot_x, @hot_y, @left_x, @left_y = 72, 60, 75, 74
@face_x, @face_y = 4, 22
@od_x, @od_y, @exp_x, @exp_y = 4, 100, 4, 120
if $easy_overdrive == nil
@exp_x, @exp_y = 4, 100
end
end
def draw_basic
self.bitmap.fill_rect(0, 0, self.bitmap.width, self.bitmap.height,
Color.new(0, 0, 0, 128))
color = case BlizzABS::Config::HUD_TYPE
when 0 then Color.new(255, 255, 255, 192)
when 1 then Color.new(0, 0, 0, 0)
end
if color.is_a?(Color)
self.bitmap.fill_rect(@hp_x+32, @hp_y+3, 116, 14, color)
self.bitmap.fill_rect(@sp_x+32, @sp_y+3, 116, 14, color)
end
self.bitmap.font.color = system_color
self.bitmap.draw_text_full(@level_x, @level_y, 20, 20, 'LV')
unless BlizzABS::Config::DIRECT_HOTKEYS
self.bitmap.draw_text_full(@hot_x, @hot_y, 48, 20, 'Skill:')
self.bitmap.draw_text_full(@hot_x+76, @hot_y, 48, 20, 'Item:')
end
self.bitmap.draw_text_full(@hp_x, @hp_y, 32, 20, $data_system.words.hp)
self.bitmap.draw_text_full(@sp_x, @sp_y, 32, 20, $data_system.words.sp)
if $easy_overdrive != nil
self.bitmap.fill_rect(@od_x+32, @od_y+3, 116, 14, color) if color.is_a?(Color) if $easy_overdrive != nil
self.bitmap.font.color = system_color
self.bitmap.draw_text_full(@od_x, @od_y, 80, 20, BlizzCFG::OVERDRIVE_NAME) if $easy_overdrive != nil
self.bitmap.font.color = normal_color
end
if GameGuy::UseExpBar
self.bitmap.fill_rect(@exp_x+32, @exp_y+3, 116, 14, color) if color.is_a?(Color)
self.bitmap.fill_rect(@exp_x, @exp_y, 32, 20, Color.new(0, 0, 0, 128))
self.bitmap.font.color = system_color
self.bitmap.draw_text_full(@exp_x, @exp_y, 80, 20, GameGuy::ExpName)
self.bitmap.font.color = normal_color
end
end
def draw_empty
self.bitmap.gradient_bar_hud(@hp_x+32, @hp_y+3, 114, 0, 'hud_green_bar', 1)
self.bitmap.gradient_bar_hud(@sp_x+32, @sp_y+3, 114, 0, 'hud_blue_bar', 2)
self.bitmap.font.color = disabled_color
self.bitmap.draw_text_full(@hp_x+38, @hp_y, 48, 20, '0', 2)
self.bitmap.draw_text_full(@hp_x+86, @hp_y, 12, 20, '/', 1)
self.bitmap.draw_text_full(@hp_x+98, @hp_y, 48, 20, '0')
self.bitmap.draw_text_full(@sp_x+38, @sp_y, 48, 20, '0', 2)
self.bitmap.draw_text_full(@sp_x+86, @sp_y, 12, 20, '/', 1)
self.bitmap.draw_text_full(@sp_x+98, @sp_y, 48, 20, '0')
self.bitmap.gradient_bar_hud(@od_x+32, @od_y+3, 114, 0, 'hud_red_bar') if $easy_overdrive != nil
self.bitmap.font.color = disabled_color
self.bitmap.draw_text_full(@od_x+54, @od_y, 84, 20, '0,0%', 2) if $easy_overdrive != nil
@overdrive = nil
@name = @level = @hp = @sp = @maxhp = @maxsp = @exp = @states = @skill =
@skills_left = @item = @items_left = @gold = nil
if GameGuy::UseExpBar
self.bitmap.gradient_bar_hud(@exp_x+32, @exp_y+3, 114, 0, 'hud_white_bar')
self.bitmap.font.color = disabled_color
self.bitmap.draw_text_full(@exp_x+54, @exp_y, 84, 20, actor.next_rest_exp_s, 2)
@exp = nil
end
end
def test_exp
draw_exp if actor.exp != @exp
end
def draw_exp
@exp = actor.exp
rate = (actor.next_exp != 0 ? actor.now_exp.to_f / actor.next_exp : 1)
self.bitmap.gradient_bar_hud(@exp_x+32, @exp_y+3, 114, rate, 'hud_white_bar')
self.bitmap.font.color = normal_color
self.bitmap.draw_text_full(@exp_x+54, @exp_y, 84, 20, actor.next_rest_exp_s, 2)
end
def draw_overdrive
@overdrive = actor.overdrive
rate = actor.overdrive / 1000.0
self.bitmap.gradient_bar_hud(@od_x+32, @od_y+3, 114, rate, 'hud_red_bar')
self.bitmap.font.color = normal_color
self.bitmap.draw_text_full(@od_x+54, @od_y, 84, 20, actor.overdrive_text, 2)
end
def draw_name
@name = actor.name
self.bitmap.fill_rect(@name_x, @name_y, 104, 19, Color.new(0, 0, 0, 128))
self.bitmap.font.color = Color.new(0, 255, 0)
self.bitmap.draw_text_full(@name_x, @name_y, 104, 20, @name)
end
def draw_level
@level = actor.level
self.bitmap.fill_rect(@level_x+20, @level_y, 20, 19, Color.new(0, 0, 0, 128))
self.bitmap.font.color = normal_color
self.bitmap.draw_text_full(@level_x+20, @level_y, 20, 20, @level.to_s, 2)
end
def draw_hp
@hp, @maxhp = actor.hp, actor.maxhp
rate = (@maxhp > 0 ? @hp.to_f / @maxhp : 0)
self.bitmap.gradient_bar_hud(@hp_x+32, @hp_y+3, 114, rate, 'hud_green_bar', 1)
self.bitmap.font.color = @hp == 0 ? knockout_color :
@hp <= @maxhp / 4 ? crisis_color : normal_color
self.bitmap.draw_text_full(@hp_x+38, @hp_y, 48, 20, @hp.to_s, 2)
self.bitmap.font.color = normal_color
self.bitmap.draw_text_full(@hp_x+86, @hp_y, 12, 20, '/', 1)
self.bitmap.draw_text_full(@hp_x+98, @hp_y, 48, 20, @maxhp.to_s)
end
def draw_sp
@sp, @maxsp = actor.sp, actor.maxsp
rate = (@maxsp > 0 ? @sp.to_f / @maxsp : 0)
self.bitmap.gradient_bar_hud(@sp_x+32, @sp_y+3, 114, rate, 'hud_blue_bar', 2)
self.bitmap.font.color = @sp == 0 ? knockout_color :
@sp <= @maxsp / 4 ? crisis_color : normal_color
self.bitmap.draw_text_full(@sp_x+38, @sp_y, 48, 20, @sp.to_s, 2)
self.bitmap.font.color = normal_color
self.bitmap.draw_text_full(@sp_x+86, @sp_y, 12, 20, '/', 1)
self.bitmap.draw_text_full(@sp_x+98, @sp_y, 48, 20, @maxsp.to_s)
end
def draw_hskill
@skill = actor.skill
self.bitmap.fill_rect(@hot_x+48, @hot_y+4, 24, 24, Color.new(0, 0, 0, 128))
if @skill != 0
bitmap = RPG::Cache.icon($data_skills[@skill].icon_name)
self.bitmap.blt(@hot_x+48, @hot_y+4, bitmap, Rect.new(0, 0, 24, 24))
end
draw_lskill
end
def draw_lskill
self.bitmap.fill_rect(@left_x, @left_y+4, 24, 16, Color.new(0, 0, 0, 128))
@skills_left = get_skills_left
if @skill != nil && @skill > 0
if @skills_left >= 0
if @skills_left == 0
self.bitmap.font.color = Color.new(255, 0, 0)
elsif @skills_left <= 5
self.bitmap.font.color = Color.new(255, 255, 0)
else
self.bitmap.font.color = normal_color
end
self.bitmap.font.size -= 2
self.bitmap.draw_text_full(@left_x, @left_y, 24, 20, @skills_left.to_s, 1)
self.bitmap.font.size += 2
elsif @skills_left == -1
self.bitmap.font.color = Color.new(0, 255, 0)
self.bitmap.font.size += 4
self.bitmap.draw_text_full(@left_x, @left_y, 24, 20, '∞', 1)
self.bitmap.font.size -= 4
end
end
end
def get_skills_left
if @skill != nil && @skill > 0
if actor.overdrive_skills.include?(@skill)
return actor.overdrive_left(@skill)
end
if $data_skills[@skill].sp_cost > 0
sp_cost = $data_skills[@skill].sp_cost
if $tons_version != nil && $tons_version >= 6.54 &&
$game_system.SP_COST_MOD
sp_cost = BlizzCFG.get_cost_mod(actor.states, sp_cost)
end
return -1 if sp_cost == 0
return @sp / sp_cost
end
return -1
end
return -2
end
def draw_hitem
@item = actor.item
self.bitmap.fill_rect(@hot_x+124, @hot_y+4, 24, 24, Color.new(0, 0, 0, 128))
if @item != 0
bitmap = RPG::Cache.icon($data_items[@item].icon_name)
self.bitmap.blt(@hot_x+124, @hot_y+4, bitmap, Rect.new(0, 0, 24, 24))
end
draw_litem
end
def draw_litem
@items_left = $game_party.item_number(@item)
self.bitmap.fill_rect(@left_x+76, @left_y+4, 24, 16, Color.new(0, 0, 0, 128))
if @item != nil && @item > 0
if $data_items[@item] != nil && !$data_items[@item].consumable
self.bitmap.font.color = Color.new(0, 255, 0)
self.bitmap.font.size += 4
self.bitmap.draw_text_full(@left_x+76, @left_y, 24, 20, '∞', 1)
self.bitmap.font.size -= 4
else
if @items_left == 0
self.bitmap.font.color = Color.new(255, 0, 0)
elsif @items_left <= 10
self.bitmap.font.color = Color.new(255, 255, 0)
else
self.bitmap.font.color = normal_color
end
self.bitmap.font.size -= 2
self.bitmap.draw_text_full(@left_x+76, @left_y, 24, 20, @items_left.to_s, 1)
self.bitmap.font.size += 2
end
end
end
def update
if actor == nil
unless @empty_hud_drawn
draw_basic
draw_empty
@empty_hud_drawn = true
end
else
if $game_temp.hud_refresh
draw_name
draw_level
draw_hp
draw_sp
draw_face
draw_overdrive if $easy_overdrive != nil
draw_exp if GameGuy::UseExpBar
unless BlizzABS::Config::DIRECT_HOTKEYS
draw_hskill
draw_lskill
draw_hitem
draw_litem
end
$game_temp.hud_refresh = nil
else
test_name
test_level
test_hp
test_sp
test_face
test_overdrive if $easy_overdrive != nil
test_exp if actor != nil && GameGuy::UseExpBar
unless BlizzABS::Config::DIRECT_HOTKEYS
test_hskill
test_lskill
test_hitem
test_litem
end
end
@empty_hud_drawn = false
end
end
def test_face
draw_face if actor.name != @face
end
def draw_face
if GameGuy::UseFaces
self.bitmap.fill_rect(@face_x, @face_y, 64, 64, Color.new(0, 0, 0, 128))
rect = Rect.new(0, 0, 64, 64)
@face = actor.name
begin
file = RPG::Cache.picture(@face)
rescue
print "Face file not found for #{actor.name}"
return
end
self.bitmap.blt(@face_x, @face_y, file, rect)
elsif GameGuy::UseCharacter
@face = actor.name
self.bitmap.fill_rect(@face_x, @face_y, 64, 64, Color.new(0, 0, 0, 128))
begin
file = RPG::Cache.character(actor.character_name, actor.character_hue)
rescue
end
width = file.width / 4
height = file.height / 4
rect = Rect.new(0, 0, width, height)
self.bitmap.blt(@face_x, @face_y, file, rect)
else
self.bitmap.fill_rect(@face_x, @face_y, 64, 64, Color.new(0, 0, 0, 128))
@face = actor.name
end
end
end
class Window_Skill_Hotkey < Window_Skill
attr_reader :item_max
def initialize(actor)
super
@column_max = 1
self.width, self.height = 320, 200
self.y, self.z = 128, 21000
self.cursor_rect.empty
self.active = false
refresh
end
end
class Window_Item_Hotkey < Window_Item
attr_reader :item_max
def initialize
super
@column_max = 1
self.width, self.height = 320, 200
self.x, self.y, self.z = 320, 128, 21000
self.cursor_rect.empty
self.active = false
refresh
end
end
class Scene_Hotkeys
def main
@spriteset = Spriteset_Map.new
@view = Viewport.new(0, 0, 640, 480)
@view.tone = @tone.clone
@hud = Hud.new if BlizzABS::Config::HUD_ENABLED && $game_system.hud
if BlizzABS::Config::HOTKEYS
@hotkeys = Hotkey_Assignment.new
@hotkeys.z = 5000
end
if BlizzABS::Config::MINIMAP && $game_system.minimap > 0
@minimap = Minimap.new
end
@choice = Sprite.new
@choice.bitmap = $BlizzABS.cache.image('menu_arrow')
@choice.x, @choice.y, @choice.z, @choice.opacity = 0, 480-96, 500, 128
@choice.ox = -8
@active = true
@index = 0
@up_mode = true
@skill_window = Window_Skill_Hotkey.new($game_player.battler)
@item_window = Window_Item_Hotkey.new
@last_active = true
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.freeze
@spriteset.dispose
[@hud, @hotkeys, @minimap].each {|s| s.dispose if s != nil}
@choice.dispose
@skill_window.dispose
@item_window.dispose
@view.dispose
while @party_leader != $game_party.actors[0]
$BlizzABS.player.switch_leader
end
end
def update_choice
@choice.x = 0 + @index * 32
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@active = false
@skill_window.active = @last_active
@item_window.active = (!@last_active)
elsif Input.repeat?(Input::RIGHT)
if Input.trigger?(Input::RIGHT) || @index < 9
$game_system.se_play($data_system.cursor_se)
@index = (@index + 1) % 10
end
elsif Input.repeat?(Input::LEFT)
if Input.trigger?(Input::LEFT) || @index >= 1
$game_system.se_play($data_system.cursor_se)
@index = (@index + 9) % 10
end
end
end
end
class Hotkey_Assignment < Sprite
def initialize(viewport = nil)
super
self.bitmap = Bitmap.new(320, 32)
self.bitmap.font.bold = true
self.bitmap.font.size -= 8
self.bitmap.font.color = system_color
self.x, self.y, self.z = 0, 480-128, 1100
@skills = BlizzABS::Cache::EmptyKeys
@items = BlizzABS::Cache::EmptyKeys
update
end
end