#==============================================================================
# Hud
#------------------------------------------------------------------------------
# This class was modified to support SR display and modify the number of
# skills left to use.
# Displays HUD window and exp/level bar
#==============================================================================
class Hud < Sprite
#----------------------------------------------------------------------------
# Initialization
# viewport - the viewport for the sprite
#----------------------------------------------------------------------------
def initialize(viewport = nil)
# call superclass method
super
# create positions
create_positions
# create bitmap
self.bitmap = Bitmap.new(148, 148)
#self.bg = Bitmap.new(128, 64)
# set font
self.bitmap.font.name = LandithHUD::Font_Name
# set font size
self.bitmap.font.size = 16
# set font to bold
self.bitmap.font.bold = true
# set x and y coordinates
self.x, self.y = @hud_x, @hud_y
# set z coordinate
self.z = 1000
# draw basic HUD
draw_basic
# update
update
end
#----------------------------------------------------------------------------
# create_positions
# Sets drawing positions. This method can be aliased and the positions
# modified to create a different HUD.
#----------------------------------------------------------------------------
def create_positions
@hud_height, @hud_width, @hud_x, @hud_y = 128, 148, 0, 480-64
@gold_x, @gold_y, @loc_x, @loc_y, = 64, 48, 6, 32
end
#----------------------------------------------------------------------------
# draw_basic
# Draws the HUD template.
#----------------------------------------------------------------------------
def draw_basic
#bitmap = RPG::Cache.picture("HUD.png")
#self.bg.blt(0, 0, bitmap, Rect.new(0, 0, 128, 64))
# fill with grey rectangle
self.bitmap.fill_rect(0, 0, @hud_width, @hud_height,
Color.new(0, 0, 0, 0))
# set font color
self.bitmap.font.color = system_color
# draw "G"
self.bitmap.font.size = 14
self.bitmap.draw_text_full(@gold_x-64, @gold_y, 20, 20, " G")
end
#----------------------------------------------------------------------------
# draw_empty
# Draws the HP and SP display when actor doesn't exist.
#----------------------------------------------------------------------------
def draw_empty
# reset all flag variables
@name = @level = @hp = @sp = @maxhp = @maxsp = @exp = @states = @skill =
@skills_left = @item = @items_left = @gold = @equip = nil
end
#----------------------------------------------------------------------------
# draw_gold
# Draws the gold display.
#----------------------------------------------------------------------------
def draw_gold
# set current variable
@gold = $game_party.gold
# remove old display
self.bitmap.fill_rect(@gold_x-50, @gold_y, 64, 20, Color.new(0, 0, 0, 0))
# set font color
self.bitmap.font.color = normal_color
# draw party's gold
self.bitmap.draw_text_full(@gold_x-48, @gold_y, 64, 20, $game_party.gold.to_s, 0)
end
#----------------------------------------------------------------------------
# draw_loc
# Draws the map location display.
#----------------------------------------------------------------------------
def draw_loc
# set current variable
@loc = $game_map.name
# remove old display
self.bitmap.fill_rect(@loc_x-20, @loc_y, 200, 20, Color.new(0, 0, 0, 0))
# set font color
self.bitmap.font.color = normal_color
self.bitmap.font.size = 14
# draw location
self.bitmap.draw_text_full(@loc_x-20, @loc_y, 200, 20, @loc, 1)
end
#----------------------------------------------------------------------------
# update
# Checks if HUD needs refreshing.
#----------------------------------------------------------------------------
def update
# if actor doesn't exist
if actor == nil
# unless already drawn empty HUD
unless @empty_hud_drawn
# draw HUD template
draw_basic
# draw empty HP, SP and EXP bars
draw_empty
# empty HUD was drawn
@empty_hud_drawn = true
end
else
# if HUD needs refresh
if $game_temp.hud_refresh
# draw all data about actors
draw_gold
draw_loc
# remove flag
$game_temp.hud_refresh = nil
else
# draw data that needs to be updated
test_gold
test_loc
end
# empty HUD wasn't drawn
@empty_hud_drawn = false
end
end
#----------------------------------------------------------------------------
# test_er
# Tests and draws the er.
#----------------------------------------------------------------------------
def test_gold
# draw new er if er has changed
draw_gold if $game_party.gold != @gold
end
#----------------------------------------------------------------------------
# test_loc
# Tests and draws the loc.
#----------------------------------------------------------------------------
def test_loc
# draw new er if er has changed
draw_loc if $game_map.name != @loc
end
#----------------------------------------------------------------------------
# actor
# Returns the party leader's battler for easier reference.
#----------------------------------------------------------------------------
def actor
return $game_player.battler
end
def dispose
super
end
end
#==============================================================================
# Equip Hud
#==============================================================================
class Equip_Hud < Sprite
#----------------------------------------------------------------------------
# Initialization
# viewport - the viewport for the sprite
#----------------------------------------------------------------------------
def initialize(viewport = nil)
# call superclass method
super
# create positions
create_positions
# create bitmap
self.bitmap = Bitmap.new(200, 70)
#self.bg = Bitmap.new(128, 64)
# set font
self.bitmap.font.name = LandithHUD::Font_Name
# set font size
self.bitmap.font.size = 16
# set font to bold
self.bitmap.font.bold = true
# set x and y coordinates
self.x, self.y = @hud_x, @hud_y
# set z coordinate
self.z = 1000
# draw basic HUD
draw_basic
# update
update
end
#----------------------------------------------------------------------------
# create_positions
# Sets drawing positions. This method can be aliased and the positions
# modified to create a different HUD.
#----------------------------------------------------------------------------
def create_positions
@hud_height, @hud_width, @hud_x, @hud_y = 128, 200, 640-200, 4
@equip_x, @equip_y = 0, 22
@hot_x, @hot_y, @left_x, @left_y = 132, 22, 66, 22
end
#----------------------------------------------------------------------------
# draw_basic
# Draws the HUD template.
#----------------------------------------------------------------------------
def draw_basic
#bitmap = RPG::Cache.picture("HUD.png")
#self.bg.blt(0, 0, bitmap, Rect.new(0, 0, 128, 64))
# fill with grey rectangle
self.bitmap.fill_rect(0, 0, @hud_width, @hud_height,
Color.new(0, 0, 0, 0))
self.bitmap.font.size = 16
self.bitmap.font.color = Color.new(255, 128, 128, 255)
self.bitmap.draw_text_full(45, 4, 120, 16,"Equipment")
self.bitmap.font.size = 16
self.bitmap.font.name = LandithHUD::Font_Name
self.bitmap.font.color = system_color
self.bitmap.draw_text_full(0, 50, 40, 16, "WPN")
self.bitmap.draw_text_full(64, 50, 40, 16, "ITEM")
self.bitmap.draw_text_full(132, 50, 40, 16, "SKILL")
end
#----------------------------------------------------------------------------
# draw_empty
# Draws the HP and SP display when actor doesn't exist.
#----------------------------------------------------------------------------
def draw_empty
# reset all flag variables
@name = @level = @hp = @sp = @maxhp = @maxsp = @exp = @states = @skill =
@skills_left = @item = @items_left = @gold = @equip = nil
end
#----------------------------------------------------------------------------
# draw_equip
# Draws the equip display.
#----------------------------------------------------------------------------
def draw_equip
# set current variable
@equip = $data_weapons[$game_party.actors[0].weapon_id]
# remove old display
self.bitmap.fill_rect(@equip_x, @equip_y, 200, 28, Color.new(0, 0, 0, 0))
# set font color
self.bitmap.font.color = normal_color
self.bitmap.font.size = 14
# draw location
bitmap = RPG::Cache.icon($data_weapons[$game_party.actors[0].weapon_id].icon_name)
# draw bitmap
self.bitmap.blt(@equip_x, @equip_y, bitmap, Rect.new(0, 0, 24, 24))
end
#----------------------------------------------------------------------------
# draw_hskill
# Draws the hot skill display.
#----------------------------------------------------------------------------
def draw_hskill
# set current variable
@skill = actor.skill
# remove old display
self.bitmap.fill_rect(@hot_x-8, @hot_y, 24, 24, Color.new(255, 0, 0, 0))
# if skill hot skill exists
if @skill != 0
# load bitmap
bitmap = RPG::Cache.icon($data_skills[@skill].icon_name)
# draw bitmap
self.bitmap.blt(@hot_x-8, @hot_y, bitmap, Rect.new(0, 0, 24, 24))
end
# removes skills left to use display
draw_lskill
end
#----------------------------------------------------------------------------
# draw_lskill
# Draws the skills left to use display.
#----------------------------------------------------------------------------
def draw_lskill
self.bitmap.font.name = "Tahoma"
# remove old display
self.bitmap.fill_rect(@hot_x+16, @hot_y+12, 24, 16, Color.new(0, 0, 0, 0))
# get the number of skills left
@skills_left = get_skills_left
# if hot skill exists
if @skill != nil && @skill > 0
# if normal SP cost
if @skills_left >= 0
# if not enough sp to use
if @skills_left == 0
# set font color
self.bitmap.font.color = Color.new(255, 0, 0)
# if enough SP for 5 or less skill uses
elsif @skills_left <= 5
# set font color
self.bitmap.font.color = Color.new(255, 255, 0)
else
# set font color
self.bitmap.font.color = normal_color
end
# decrease font color
self.bitmap.font.size += 2
# draw number how many skills left to use
self.bitmap.draw_text_full(@hot_x+12, @hot_y+12, 24, 16, @skills_left.to_s, 2)
# increase font size
self.bitmap.font.size -= 2
# if infinite skills left
elsif @skills_left == -1
# set font color
self.bitmap.font.color = Color.new(0, 255, 0)
# increase font size
self.bitmap.font.size += 2
# draw "∞" skill uses left
self.bitmap.draw_text_full(@hot_x+12, @hot_y+12, 16, 20, '∞', 2)
# decrease font size
self.bitmap.font.size -= 2
end
end
end
#----------------------------------------------------------------------------
# get_skills_left
# Gets the number of skill usages left.
#----------------------------------------------------------------------------
def get_skills_left
@sp = actor.sp
# if skill hot skill exists
if @skill != nil && @skill > 0
# if SP cost is zero
if $data_skills[@skill].sp_cost > 0
# get basic SP cost
sp_cost = $data_skills[@skill].sp_cost
# if using SP Cost Mod Status
if $tons_version != nil && $tons_version >= 6.54 &&
$game_system.SP_COST_MOD
# get modified cost
sp_cost = BlizzCFG.get_cost_mod(actor.states, sp_cost)
end
# infinite
return -1 if sp_cost == 0
# calculate skills left to use
return @sp / sp_cost
end
# set flag
return -1
end
# set flag
return -2
end
#----------------------------------------------------------------------------
# draw_hitem
# Draws the hot item display.
#----------------------------------------------------------------------------
def draw_hitem
# set current variable
@item = actor.item
# remove old display
self.bitmap.fill_rect(@left_x-8, @left_y, 24, 24, Color.new(255, 0, 0, 0))
# if hot item exists
if @item != 0
# load bitmap
bitmap = RPG::Cache.icon($data_items[@item].icon_name)
# draw bitmap
self.bitmap.blt(@left_x-8, @left_y, bitmap, Rect.new(0, 0, 24, 24))
end
# removes items left to use display
draw_litem
end
#----------------------------------------------------------------------------
# draw_litem
# Draws the items left to use display.
#----------------------------------------------------------------------------
def draw_litem
# set current variable
@items_left = $game_party.item_number(@item)
# remove old display
self.bitmap.fill_rect(@left_x+16, @left_y+12, 16, 16, Color.new(255, 0, 0, 0))
# if hot item exists
if @item != nil && @item > 0
# if item exists and cannot be consumed
if $data_items[@item] != nil && !$data_items[@item].consumable
# set font color
self.bitmap.font.color = Color.new(0, 255, 0)
# increase font size
self.bitmap.font.size += 2
# draw "∞" items left
self.bitmap.draw_text_full(@left_x+12, @left_y+12, 24, 20, '∞', 1)
# decrease font size
self.bitmap.font.size -= 2
else
# if no items left
if @items_left == 0
# set font color
self.bitmap.font.color = Color.new(255, 0, 0)
# if equal or less items left
elsif @items_left <= 10
# set font color
self.bitmap.font.color = Color.new(255, 255, 0)
else
# set font color
self.bitmap.font.color = normal_color
end
# decrease font color
self.bitmap.font.size += 2
# draw number how many items left to use
self.bitmap.draw_text_full(@left_x+12, @left_y+12, 24, 20, @items_left.to_s, 1)
# increase font size
self.bitmap.font.size -= 2
end
end
end
#----------------------------------------------------------------------------
# update
# Checks if HUD needs refreshing.
#----------------------------------------------------------------------------
def update
# if actor doesn't exist
if actor == nil
# unless already drawn empty HUD
unless @empty_hud_drawn
# draw HUD template
draw_basic
# draw empty HP, SP and EXP bars
draw_empty
# empty HUD was drawn
@empty_hud_drawn = true
end
else
# if HUD needs refresh
if $game_temp.hud_refresh
# draw all data about actors
draw_equip
draw_hskill
draw_lskill
draw_hitem
draw_litem
# remove flag
$game_temp.hud_refresh = nil
else
# draw data that needs to be updated
test_equip
test_hskill
test_lskill
test_hitem
test_litem
end
# empty HUD wasn't drawn
@empty_hud_drawn = false
end
end
#----------------------------------------------------------------------------
# test_loc
# Tests and draws the loc.
#----------------------------------------------------------------------------
def test_equip
# draw new er if er has changed
draw_equip if $data_weapons[$game_party.actors[0].weapon_id] != @equip
end
#----------------------------------------------------------------------------
# test_hskill
# Tests and draws the hskill.
#----------------------------------------------------------------------------
def test_hskill
# draw new skill icon if assigned skill has changed
draw_hskill if actor.skill != @skill
end
#----------------------------------------------------------------------------
# test_lskill
# Tests and draws the lskill.
#----------------------------------------------------------------------------
def test_lskill
# draw how many skills left to use if this number has changed
draw_lskill if get_skills_left != @skills_left
end
#----------------------------------------------------------------------------
# test_hitem
# Tests and draws the hitem.
#----------------------------------------------------------------------------
def test_hitem
# draw new item icon if assigned item has changed
draw_hitem if actor.item != @item
end
#----------------------------------------------------------------------------
# test_litem
# Tests and draws the litem.
#----------------------------------------------------------------------------
def test_litem
# draw how many items left to use if this number has changed
draw_litem if $game_party.item_number(@item) != @items_left
end
#----------------------------------------------------------------------------
# actor
# Returns the party leader's battler for easier reference.
#----------------------------------------------------------------------------
def actor
return $game_player.battler
end
end
#==============================================================================
# Hotkey_Assignment
#------------------------------------------------------------------------------
# This class creates and display currently assigned hotkeys and is more
# effiecient than the Window class.
#==============================================================================
class Hotkey_Assignment < Sprite
#----------------------------------------------------------------------------
# Initialization
# viewport - the viewport for the sprite
#----------------------------------------------------------------------------
def initialize(viewport = nil)
# call superclass
super
# create bitmap
self.bitmap = Bitmap.new(320, 64)
# set x and y position
self.x, self.y, self.z = 160, 435, 1100
#bg
# skill IDs on hotkeys
@skills = BlizzABS::Cache::EmptyKeys
# item IDs on hotkeys
@items = BlizzABS::Cache::EmptyKeys
# update display
update
end
#----------------------------------------------------------------------------
# draw
# Draws the hotkey display.
#----------------------------------------------------------------------------
def draw(index = nil)
# iterate through all hotkeys
(index == nil ? BlizzABS::Cache::HotkeyRange : [index]).each {|i|
# if hotkey is skill hotkey
if $game_player.skill_hotkeys[i%10] != 0
# temporary object
object = $data_skills[$game_player.skill_hotkeys[i%10]]
# if hotkey is item hotkey
elsif $game_player.item_hotkeys[i%10] != 0
# temporary object
object = $data_items[$game_player.item_hotkeys[i%10]]
end
# if any change applied (10 is used for 0)
if @items[i%10] != $game_player.item_hotkeys[i%10] ||
@skills[i%10] != $game_player.skill_hotkeys[i%10]
# remove this icon
self.bitmap.fill_rect(30*(i-1)+22, 20, 24, 24, Color.new(128, 0, 0, 128))
# if object exists
if object != nil
# load bitmap
bitmap = RPG::Cache.icon(object.icon_name)
# draw bitmap
self.bitmap.blt(30*(i-1)+22, 20, bitmap, Rect.new(0, 0, 24, 24))
end
# draw hotkey number
self.bitmap.font.name = "Tahoma"
self.bitmap.font.size = 12
self.bitmap.font.color = system_color
self.bitmap.draw_text_full(30*(i-1)+20, 24, 30, 32, (i%10).to_s, 2)
self.bitmap.font.size += 4
end}
# set new items
@items = $game_player.item_hotkeys.clone
# set new skills
@skills = $game_player.skill_hotkeys.clone
end
#----------------------------------------------------------------------------
# update
# Updates the hotkey display.
#----------------------------------------------------------------------------
def update
# call superclass method
super
# if actor has changed
if @actor != $game_player.battler
# set new actor
@actor = $game_player.battler
# redraw
draw
end
end
def dispose
super
end
end
#==============================================================================
# HudBG
#------------------------------------------------------------------------------
# This class allows backgrounds for your HUD
#==============================================================================
class HudBG < Sprite
#----------------------------------------------------------------------------
# Initialization
# viewport - the viewport for the sprite
#----------------------------------------------------------------------------
def initialize(type, viewport=nil)
# call superclass method
super(viewport)
# create bitmap
self.bitmap = Bitmap.new(640, 480)
# set z coordinate
if type != 4
self.z = 900
else
self.z = 0
end
@done = false
@type = type
@hotkey = false
@parhud = false
@psize = 0
@hud = false
# update
update
end
#----------------------------------------------------------------------------
# draw_hud
# Draws the HUD template.
#----------------------------------------------------------------------------
def draw_hud
bitmap = RPG::Cache.picture("HUD.png")
self.bitmap.blt(0, 0, bitmap, Rect.new(0, 0, 128, 64))
end
#----------------------------------------------------------------------------
# draw_hotkey
# Draws the hotkey bg.
#----------------------------------------------------------------------------
def draw_hotkey
#bitmap = RPG::Cache.picture("HotkeyDisplayFull.png")
#self.bitmap.blt(138, 435, bitmap, Rect.new(0, 0, 320, 64))
end
#----------------------------------------------------------------------------
# draw_parhud
# Draws the hotkey bg.
#----------------------------------------------------------------------------
def draw_parhud
@psize = $game_party.actors.size
if @psize == 1
bitmap = RPG::Cache.picture("HUD/Parhud_1.png")
else
bitmap = RPG::Cache.picture("HUD/Parhud_2.png")
end
self.bitmap.blt(0, 0, bitmap, Rect.new(0, 0, 128, 64))
if @psize > 1
bitmap = RPG::Cache.picture("HUD/Parhud_4.png")
self.bitmap.blt(0, 64*@psize-64, bitmap, Rect.new(0, 0, 128, 64))
end
if @psize > 2
bitmap = RPG::Cache.picture("HUD/Parhud_3.png")
self.bitmap.blt(0, 64, bitmap, Rect.new(0, 0, 128, 64))
self.bitmap.blt(0, 128, bitmap, Rect.new(0, 0, 128, 64)) if @psize > 3
end
end
#----------------------------------------------------------------------------
# update
# Checks if HUD needs refreshing.
#----------------------------------------------------------------------------
def update
super
if !@done
if @type == 1
draw_hud
elsif @type == 2
draw_parhud
elsif @type == 3
draw_hotkey
else
draw_hud
draw_parhud
draw_hotkey
end
@done = true
end
end
end
#==============================================================================
# Minimap by Winkio
#------------------------------------------------------------------------------
# This class creates and handels the minimap/fullscreen map display and is
# more efficient than the Window class.
# Changed to 6x6 tiles with rounded edges
#==============================================================================
class Minimap < Sprite
# setting all accessible variables
attr_reader :map_id
#----------------------------------------------------------------------------
# Initialization
#----------------------------------------------------------------------------
def initialize
# call superclass method
super(Viewport.new(480, 360, 160, 120))
# get autotile image from Blizz-ABS Cache
@autotile = minimap_autotile #$BlizzABS.cache.image('minimap_autotile')
# creates the passable floor map
create_passable_floor
# set x and y position
self.x = self.y = 0
# set z position
viewport.z = 5000
# store events
@events, @names = check_events
# create sprites for events
create_sevents
# set all sprites visible
self.visible = true
end
#----------------------------------------------------------------------------
# create_passable_floor
# Creates the passable floor map on the bitmap.
#----------------------------------------------------------------------------
def create_passable_floor
# delete bitmap if bitmap exists
self.bitmap.dispose if self.bitmap != nil
# store new map ID
@map_id = $game_map.map_id
# temporary width and height
w, h = $game_map.width, $game_map.height
# create bitmap
self.bitmap = Bitmap.new(8*w, 8*h)
# fill rectangle
self.bitmap.fill_rect(0, 0, 8*w, 8*h, Color.new(0, 0, 0, 0))
# get passability data
v_map = $game_map.virtual_passability
# iterate through all tiles
(0...v_map.xsize).each {|x| (0...v_map.ysize).each {|y|
# depending on passable direction, draw the path using the autotile
case v_map[x, y]
when 0x01 # D
self.bitmap.blt(x*8, y*8+4, @autotile, Rect.new(0, 0, 8, 4), 128)
when 0x02 # L
self.bitmap.blt(x*8, y*8, @autotile, Rect.new(4, 0, 4, 8), 128)
when 0x03 # LD
self.bitmap.blt(x*8, y*8, @autotile, Rect.new(16, 8, 8, 8), 128)
when 0x04 # R
self.bitmap.blt(x*8+4, y*8, @autotile, Rect.new(0, 0, 4, 8), 128)
when 0x05 # R D
self.bitmap.blt(x*8, y*8, @autotile, Rect.new(0, 8, 8, 8), 128)
when 0x06 # RL
self.bitmap.blt(x*8, y*8, @autotile, Rect.new(8, 8, 8, 4), 128)
self.bitmap.blt(x*8, y*8+4, @autotile, Rect.new(8, 28, 8, 4), 128)
when 0x07 # RLD
self.bitmap.blt(x*8, y*8, @autotile, Rect.new(8, 8, 8, 8), 128)
when 0x08 # U
self.bitmap.blt(x*8, y*8, @autotile, Rect.new(0, 4, 8, 4), 128)
when 0x09 # U D
self.bitmap.blt(x*8, y*8, @autotile, Rect.new(0, 16, 4, 8), 128)
self.bitmap.blt(x*8+4, y*8, @autotile, Rect.new(20, 16, 4, 8), 128)
when 0x0A # U L
self.bitmap.blt(x*8, y*8, @autotile, Rect.new(16, 24, 8, 8), 128)
when 0x0B # U LD
self.bitmap.blt(x*8, y*8, @autotile, Rect.new(16, 16, 8, 8), 128)
when 0x0C # UR
self.bitmap.blt(x*8, y*8, @autotile, Rect.new(0, 24, 8, 8), 128)
when 0x0D # UR D
self.bitmap.blt(x*8, y*8, @autotile, Rect.new(0, 16, 8, 8), 128)
when 0x0E # URL
self.bitmap.blt(x*8, y*8, @autotile, Rect.new(8, 24, 8, 8), 128)
when 0x0F # URLD
self.bitmap.blt(x*8, y*8, @autotile, Rect.new(8, 16, 8, 8), 128)
end}}
end
#--------------------------------------------------------------------------
# minimap_autotile
# Creates the minimap autotile for passability.
#--------------------------------------------------------------------------
def minimap_autotile
b = Bitmap.new(24, 32)
c1 = Color.new(223, 223, 223)
c2 = Color.new(128, 128, 128)
b.fill_rect(2, 0, 4, 1, c2)
b.set_pixel(1, 1, c2)
b.fill_rect(2, 1, 4, 6, c1)
b.set_pixel(6, 1, c2)
b.fill_rect(0, 2, 1, 4, c2)
b.fill_rect(1, 2, 1, 4, c1)
b.fill_rect(6, 2, 1, 4, c1)
b.fill_rect(7, 2, 1, 4, c2)
b.set_pixel(1, 6, c2)
b.set_pixel(6, 6, c2)
b.fill_rect(2, 7, 4, 1, c2)
b.fill_rect(7, 8, 10, 1, c2)
b.set_pixel(6, 9, c2)
b.fill_rect(7, 9, 10, 22, c1)
b.set_pixel(17, 9, c2)
b.set_pixel(5, 10, c2)
b.fill_rect(6, 10, 1, 20, c1)
b.fill_rect(17, 10, 1, 20, c1)
b.set_pixel(18, 10, c2)
b.set_pixel(4, 11, c2)
b.fill_rect(5, 11, 1, 18, c1)
b.fill_rect(18, 11, 1, 18, c1)
b.set_pixel(19, 11, c2)
b.set_pixel(3, 12, c2)
b.fill_rect(4, 12, 1, 16, c1)
b.fill_rect(19, 12, 1, 16, c1)
b.set_pixel(20, 12, c2)
b.set_pixel(2, 13, c2)
b.fill_rect(3, 13, 1, 14, c1)
b.fill_rect(20, 13, 1, 14, c1)
b.set_pixel(21, 13, c2)
b.set_pixel(1, 14, c2)
b.fill_rect(2, 14, 1, 12, c1)
b.fill_rect(21, 14, 1, 12, c1)
b.set_pixel(22, 14, c2)
b.fill_rect(0, 15, 1, 10, c2)
b.fill_rect(1, 15, 1, 10, c1)
b.fill_rect(22, 15, 1, 10, c1)
b.fill_rect(23, 15, 1, 10, c2)
b.set_pixel(1, 25, c2)
b.set_pixel(22, 25, c2)
b.set_pixel(2, 26, c2)
b.set_pixel(21, 26, c2)
b.set_pixel(3, 27, c2)
b.set_pixel(20, 27, c2)
b.set_pixel(4, 28, c2)
b.set_pixel(19, 28, c2)
b.set_pixel(5, 29, c2)
b.set_pixel(18, 29, c2)
b.set_pixel(6, 30, c2)
b.set_pixel(17, 30, c2)
b.fill_rect(7, 31, 10, 1, c2)
return b
end
end
#==============================================================================
# Scene_Map By Winkio
#------------------------------------------------------------------------------
# This class was enhanced to support HUD control and creation system and
# Blizz-ABS battle handling and level up text display.
# Changed to enable the party hud
#==============================================================================
class Scene_Map
#----------------------------------------------------------------------------
# override main
#----------------------------------------------------------------------------
def main
# create HUD if HUD is turned on and HUD active
@hud = Hud.new if $game_system.hud
@parhud = ParHud.new if $game_system.parhud
@equiphud = Equip_Hud.new if $game_system.equiphud
# if HOTKEYS is turned on and assignment display active
if $game_system.hotkeys
# create assignment display
@hotkeys = Hotkey_Assignment.new
@exphud = ExpHud.new
end
# if MINIMAP is turned on and minimap active
if BlizzABS::Config::MINIMAP && $game_system.minimap > 0
# create HUD
@minimap = Minimap.new
end
# tests and sets the in_battle flag
test_in_battle
# call original method
# Make sprite set
@spriteset = Spriteset_Map.new
# Make message window
@message_window = Window_Message.new
# Transition run
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 sprite set
@spriteset.dispose
# Dispose of message window
@message_window.dispose
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
end
# set in_battle flag
$game_temp.in_battle = false
# delete HUD elements that exist
[@hud, @parhud, @hotkeys, @minimap, @equiphud, @exphud].each {|s| s.dispose if s != nil}
end
#----------------------------------------------------------------------------
# hud_update
# This method contains a couple of routine calls to handle with the HUD.
#----------------------------------------------------------------------------
def hud_update
# check activation of HUD parts
check_huds
# update minimap
update_minimap
# update hotkey assignment display
update_hotkeys
# iterate through all the HUD sprites
[@hud, @parhud, @minimap, @hotkeys, @equiphud, @exphud].each {|s|
# if sprite exists
if s != nil
# update sprite
s.update
# if player is on the same position as one of the sprites on the screen
if $game_player.screen_x < s.vx + s.vw + 16 &&
$game_player.screen_y < s.vy + s.vh + 48 &&
$game_player.screen_x > s.vx && $game_player.screen_y > s.vy &&
((s == @minimap) ? ($game_system.minimap < 2) : true)
# decrease opacity quickly if critical opacity not reached
s.opacity -= 25 if s.opacity > 80
# if not full opacity
elsif s.opacity <= 255
# increase opacity quickly if critical opacity not reached
s.opacity += 25
end
end}
end
#----------------------------------------------------------------------------
# check_huds
# This method handles enabling and disabling the HUD parts on the map.
#----------------------------------------------------------------------------
def check_huds
# if minimap button is enabled and pressed
if $game_system.minimap_button && Input.trigger?(Input::Minimap)
# trigger minimap active
$game_system.minimap = ($game_system.minimap + 1) % 3
end
# if hotkey display button is enabled and pressed
if $game_system.hotkey_button && Input.trigger?(Input::Hotkey)
# trigger hotkey display active
$game_system.hotkeys = (!$game_system.hotkeys)
$game_system.exphud = (!$game_system.exphud)
end
# if HUD button is enabled and pressed
if $game_system.hud_button && Input.trigger?(Input::Hud)
# trigger it active
$game_system.hud = (!$game_system.hud)
$game_system.parhud = (!$game_system.parhud)
$game_system.equiphud = (!$game_system.equiphud)
end
# if minimap not active and minimap exists
if $game_system.minimap == 0 && @minimap != nil
# delete it
@minimap.dispose
@minimap = nil
# if minimap is turned on and active and doesn't exist
elsif BlizzABS::Config::MINIMAP && $game_system.minimap > 0
# create it
@minimap = Minimap.new if @minimap == nil
end
# if assignment display not active and exists
if !$game_system.hotkeys && @hotkeys != nil
# delete it
@hotkeys.dispose
@hotkeys = nil
@exphud.dispose
@exphud = nil
# if HOTKEYS is turned on and active and doesn't exist
elsif BlizzABS::Config::HOTKEYS && $game_system.hotkeys
# create it
@hotkeys = Hotkey_Assignment.new if @hotkeys == nil
@exphud = ExpHud.new if @exphud == nil
end
# if HUD not active and HUD exists
if !$game_system.hud && @hud != nil
# delete it
@hud.dispose
@hud = nil
@parhud.dispose
@parhud = nil
@equiphud.dispose
@equiphud = nil
# if HUD is turned on and HUD active and HUD doesn't exist
elsif BlizzABS::Config::HUD_ENABLED && $game_system.hud
# create it
@hud = Hud.new if @hud == nil
@parhud = ParHud.new if @parhud == nil
@equiphud = Equip_Hud.new if @equiphud == nil
end
end
end
#==============================================================================
# Scene_Hotkeys
#------------------------------------------------------------------------------
# This class handles the skill/item hotkey processing.
# The position of the arrow has been changed to the bottom of the screen.
# Also included the upside down arrow.
#==============================================================================
class Scene_Hotkeys
#----------------------------------------------------------------------------
# main
# The main processing method.
#----------------------------------------------------------------------------
def main
# create spriteset
@spriteset = Spriteset_Map.new
# create viewport
@view = Viewport.new(0, 0, 640, 480)
# set tone to current screen tone
@view.tone = @tone.clone
# create HUD if HUD is turned on and HUD active
@hud = Hud.new if BlizzABS::Config::HUD_ENABLED && $game_system.hud
# if ASSIGNMENT is turned
if BlizzABS::Config::HOTKEYS
# create assignment display
@hotkeys = Hotkey_Assignment.new
# set z position
@hotkeys.z = 5000
end
# if MINIMAP is turned on and minimap active
if BlizzABS::Config::MINIMAP && $game_system.minimap > 0
# create HUD
@minimap = Minimap.new
end
# create sprite
@choice = Sprite.new
# create bitmap
@choice.bitmap = menu_arrow
# set x, y and z positions
@choice.x, @choice.y, @choice.z, @choice.opacity = 160, 440, 500, 128
# set x position offset
@choice.ox = -8
# set active flag
@active = true
# set index
@index = 0
# set up mode flag
@up_mode = true
# create modified skill window
@skill_window = Window_Skill_Hotkey.new($game_player.battler)
@skill_window.y = 0
# create modified item window
@item_window = Window_Item_Hotkey.new
@item_window.y = 0
# set last active
@last_active = true
# transtition
Graphics.transition
# loop
loop do
# update game screen
Graphics.update
# update input
Input.update
# frame update
update
# stop if chosen an option
break if $scene != self
end
# freeze screen
Graphics.freeze
# delet spriteset
@spriteset.dispose
# delete HUD elements that exist
[@hud, @hotkeys, @minimap].each {|s| s.dispose if s != nil}
# delete choice sprite
@choice.dispose
# delete skill window
@skill_window.dispose
# delete item window
@item_window.dispose
# delete viewport
@view.dispose
end
#--------------------------------------------------------------------------
# menu_arrow
# Creates the arrow displayed in the hotkey assignment menu. Upside down
#--------------------------------------------------------------------------
def menu_arrow
b = Bitmap.new(16, 9)
c1 = Color.new(0, 0, 0)
c2 = Color.new(255, 128, 128)
c3 = Color.new(127, 0, 0)
b.fill_rect(7, 8, 2, 1, c2)
b.set_pixel(6, 7, c2)
b.fill_rect(7, 7, 1, 7, c3)
b.fill_rect(8, 7, 1, 7, c1)
b.set_pixel(9, 7, c2)
b.set_pixel(5, 6, c2)
b.fill_rect(6, 6, 1, 6, c3)
b.fill_rect(9, 6, 1, 6, c1)
b.set_pixel(10, 6, c2)
b.set_pixel(4, 5, c2)
b.fill_rect(5, 5, 1, 5, c3)
b.fill_rect(10, 5, 1, 5, c1)
b.set_pixel(11, 5, c2)
b.set_pixel(3, 4, c2)
b.fill_rect(4, 4, 1, 4, c3)
b.fill_rect(11, 4, 1, 4, c1)
b.set_pixel(12, 4, c2)
b.set_pixel(2, 3, c2)
b.fill_rect(3, 3, 1, 3, c3)
b.fill_rect(12, 3, 1, 3, c1)
b.set_pixel(13, 3, c2)
b.set_pixel(1, 2, c2)
b.fill_rect(2, 2, 1, 2, c3)
b.fill_rect(13, 2, 1, 2, c1)
b.set_pixel(14, 2, c2)
b.set_pixel(0, 1, c2)
b.set_pixel(1, 1, c3)
b.set_pixel(14, 1, c1)
b.set_pixel(15, 1, c2)
b.fill_rect(1, 0, 14, 1, c2)
return b
end
#----------------------------------------------------------------------------
# update_choice
# Updates input during the hotkey selection.
#----------------------------------------------------------------------------
def update_choice
@choice.z = 1000
# set x position
@choice.x = 175 + @index * 30
# if pressed B
if Input.trigger?(Input::B)
# play cancel sound
$game_system.se_play($data_system.cancel_se)
# create map scene
$scene = Scene_Map.new
# if C is pressed
elsif Input.trigger?(Input::C)
# play sound
$game_system.se_play($data_system.decision_se)
# not active
@active = false
# the one that was active the last time is now active
@skill_window.active = @last_active
@item_window.active = (!@last_active)
# if RIGHT is being pressed
elsif Input.repeat?(Input::RIGHT)
# if RIGHT is pressed or index is less than 9
if Input.trigger?(Input::RIGHT) || @index < 9
# play sound
$game_system.se_play($data_system.cursor_se)
# set new index
@index = (@index + 1) % 10
end
# if LEFT is being pressed
elsif Input.repeat?(Input::LEFT)
# if LEFT is pressed or index is equal or greater than 1
if Input.trigger?(Input::LEFT) || @index >= 1
# play sound
$game_system.se_play($data_system.cursor_se)
# set new index
@index = (@index + 9) % 10
end
end
end
end