Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # GTBS info Hud + ATB Order list
- # made for GTBS 2.4
- #
- # Atb orderlist is shown only if you gtbs mode is set for ATB.
- # Hud displayes cursors x,y,h and battle turn.
- # ( Not sure if battle turn is correct, didn't test it much. )
- #
- # Few settings in module Quasi to help set up the order list window.
- # Windows are kind of big, so would look best with image backgrounds or a
- # a bigger window Res
- #
- # For image backgrounds, backimages should be placed in 'Graphics/Pictures/GTBS/'
- # For the Hud its called 'Hud.png'
- # and for ATB List 'ATB_Win.png'
- #
- # The ATB window can use pictures for the order list instead of names.
- # Pictures should be in 'Graphics/Pictures/GTBS/Atb/'
- # and they should be named after the actor/enemy.
- # If picture isn't found it uses the actors name instead.
- # * Make sure the pictures size is the same at ATB_PIC_SIZE
- #
- # There's not much settings for the postions, but they can be manually edited.
- # No settings for the Hud window, if you want to change it, you have to do that
- # manually.
- #
- # By Quasi
- # 2/1/14
- #===============================================================================
- module Quasi
- # Displays the pictures horizontal
- # if false, it switchs the x with y, and the windows width with height
- ATB_HORI = false
- # Sets if you want the hud and atb window to hide when skill or item
- # windows are displayed.
- ATB_HIDE = true
- ATB_WIN_POS = 0 # 0 = top, 1 = bottom
- ATB_WIN_W = (28 * 7) + 32 #Windows Width = (ATB_SPACING * ATB_SIZE) + Padding
- ATB_WIN_H = 64 # Window height
- ATB_PIC_SIZE = [24,24] # [width, height]
- ATB_SIZE = 7 # How many actors to display
- ATB_SPACING = 28 # Leaves 2 pixel spacing between 24x24
- ATB_Y = 0 # Lowers Y for actor pics
- # Colors/outline for Actors Order Pic
- ATB_COLOR_ACTOR = Color.new(0,255,0,255) #Blue
- ATB_COLOR_ENEMY = Color.new(255,0,0,255) #Red
- ATB_COLOR_CURRENT = Color.new(0,0,255,255) #Green
- end
- #===============================================================================
- # Changes to [GTBS] Scene_Battle
- # Adds windows + hides
- #
- # Overwrites:
- # update_selected
- #
- # Alias:
- # setup_start_atb, exit_wait_phase, exit_process_action, create_windows, update,
- # place_update, actor_menu_open, update_window_item, update_window_skill,
- # cleanup_mini, transition_start_placement_mini
- #
- #===============================================================================
- class Scene_Battle_TBS
- Win_Place = 'place'
- Win_ATB = 'win_atb'
- Win_Hud = 'hud'
- alias quasi_setup_start_atb setup_start_atb
- alias quasi_exit_wait_phase exit_wait_phase
- alias quasi_exit_process_action exit_process_action
- alias quasi_exit_ai_processing exit_ai_processing
- alias quasi_hud create_windows
- alias quasi_hud_update update
- alias quasi_hud_place_update place_update
- alias quasi_hud_open actor_menu_open
- alias quasi_hud_item update_window_item
- alias quasi_hud_skill update_window_skill
- def create_windows
- quasi_hud
- @windows[Win_Hud] = Window_GTBS_Hud.new
- end
- def setup_start_atb
- quasi_setup_start_atb
- @windows[Win_ATB] = Window_AtbList.new(@active_battler, populate_list)
- if Quasi::ATB_HORI == true
- @windows[Menu_Actor].y = @windows[Win_ATB].height if Quasi::ATB_WIN_POS == 0
- else
- @windows[Menu_Actor].x = @windows[Win_ATB].width
- end
- end
- def exit_wait_phase
- quasi_exit_wait_phase
- return unless @windows[Win_ATB]
- @windows[Win_ATB].list = populate_list
- end
- def exit_process_action
- quasi_exit_process_action
- return unless @windows[Win_ATB]
- @windows[Win_ATB].list = populate_list
- end
- def exit_ai_processing
- quasi_exit_ai_processing
- return unless @windows[Win_ATB]
- @windows[Win_ATB].list = populate_list
- end
- def actor_menu_open
- quasi_hud_open
- @windows[Win_Hud].show
- return unless @windows[Win_ATB]
- @windows[Win_ATB].show
- end
- def update_window_item
- if Quasi::ATB_HIDE == true
- @windows[Win_Hud].hide
- @windows[Win_ATB].hide if @windows[Win_ATB]
- end
- quasi_hud_item
- end
- def update_window_skill
- if Quasi::ATB_HIDE == true
- @windows[Win_Hud].hide
- @windows[Win_ATB].hide if @windows[Win_ATB]
- end
- quasi_hud_skill
- end
- #----------------------------------------------------------------------------
- # Update Process
- #----------------------------------------------------------------------------
- def update
- quasi_hud_update
- if @windows[Win_Hud].cursor_x != @cursor.x
- @windows[Win_Hud].cursor_x = @cursor.x
- end
- if @windows[Win_Hud].cursor_y != @cursor.y
- @windows[Win_Hud].cursor_y = @cursor.y
- end
- if @windows[Win_Hud].turn != tbs_turn_count
- @windows[Win_Hud].turn = tbs_turn_count
- end
- end
- def place_update
- quasi_hud_place_update
- if @windows[Win_Hud].cursor_x != @cursor.x
- @windows[Win_Hud].cursor_x = @cursor.x
- end
- if @windows[Win_Hud].cursor_y != @cursor.y
- @windows[Win_Hud].cursor_y = @cursor.y
- end
- end
- #-------------------------------------------------------------------------
- # Update_Selected - returns cursor selected actor
- # Changed Win_Status move from 9(upper right) to 3(bottom right)
- #-------------------------------------------------------------------------
- def update_selected
- #no select when exiting
- if @battle_exiting
- @selected = nil
- #fast update if @cursor didn't change position
- elsif @selected.nil? or not @selected.at_xy_coord(@cursor.x, @cursor.y)
- @selected = nil
- battler = $game_map.occupied_by?(@cursor.x, @cursor.y)
- if battler != nil
- #for battler in tactics_all
- # next if battler.nil?
- # if battler.at_xy_coord(@cursor.x, @cursor.y)
- @selected = battler
- @windows[Win_Status].update(battler)
- #Modified to be hard coded to top right checking.
- mx = Graphics.width - @windows[Win_Status].width
- mw = Graphics.width
- my = 0
- mv = @windows[Win_Status].height
- if @spriteset.cursor.x.between?(mx, mw) && @spriteset.cursor.y.between?(my,mv)
- @windows[Win_Status].move_to(3);
- else
- @windows[Win_Status].move_to(3);
- end
- return
- # end
- end
- end
- end
- end
- #===============================================================================
- # Add Hide in [GTBS] Side Battle
- #===============================================================================
- class Scene_Battle_TBS
- alias quasi_cleanup_mini cleanup_mini
- alias quasi_transition_start_placement_mini transition_start_placement_mini
- def transition_start_placement_mini
- quasi_transition_start_placement_mini
- @windows[Win_Hud].hide
- return unless @windows[Win_ATB]
- @windows[Win_ATB].hide
- end
- def cleanup_mini
- quasi_cleanup_mini
- @windows[Win_Hud].show
- return unless @windows[Win_ATB]
- @windows[Win_ATB].show
- end
- end
- #===============================================================================
- # Windows_Status_GTBS
- #===============================================================================
- class Windows_Status_GTBS < TBS_Window_Base
- def initialize(actor = nil)
- super(0, 0, 250, 155)
- create_contents
- ensure_open
- setup_gauges
- move_to(4)
- setup_temp
- refresh
- @win_help = nil;
- end
- end
- #===============================================================================
- # Window ActList
- #===============================================================================
- class Window_AtbList < TBS_Window_Base
- Max_Updates = 400
- #--------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------
- def initialize(actor, act_list = nil)
- if Quasi::ATB_HORI == true
- w = Quasi::ATB_WIN_W
- h = Quasi::ATB_WIN_H
- else
- w = Quasi::ATB_WIN_H
- h = Quasi::ATB_WIN_W
- end
- if Quasi::ATB_WIN_POS == 0
- x = 0
- y = 0
- else
- x = 0
- y = Graphics.height - h - 72
- end
- super(x, y, w, h)
- @act_list = act_list
- @actor = actor
- @item_max =1
- create_back
- refresh
- end
- def create_back
- if FileTest.exist?('Graphics/Pictures/GTBS/ATB_Win.png')
- @back = Sprite.new
- @back.bitmap = Cache.picture('GTBS/ATB_Win.png')
- @back.z = 0
- self.opacity = 0
- else
- self.opacity = GTBS::CONTROL_OPACITY
- end
- end
- def list=(newlist)
- return if @act_list == newlist
- @act_list = newlist
- refresh
- end
- #--------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------
- def refresh
- self.contents.clear
- for i in 0...Quasi::ATB_SIZE
- draw_list_item(i)
- end
- end
- #--------------------------------------------------------------
- # * Draw List Item
- #--------------------------------------------------------------
- def draw_list_item(i)
- if @act_list[i].is_a?(Array)
- string = @act_list[i][0].name
- string += "("+@act_list[i][1][0].name+")"
- else
- string = @act_list[i].name
- end
- w = Quasi::ATB_PIC_SIZE[0]
- h = Quasi::ATB_PIC_SIZE[1]
- if Quasi::ATB_HORI == true
- x = (Quasi::ATB_SPACING * i) + 1
- y = Quasi::ATB_Y
- else
- y = (Quasi::ATB_SPACING * i) + 1
- x = Quasi::ATB_Y
- end
- if i == 0
- color = Quasi::ATB_COLOR_CURRENT
- if Quasi::ATB_HORI == true
- y += 5
- else
- x +=5
- end
- elsif @act_list[i].actor?
- color = Quasi::ATB_COLOR_ACTOR
- elsif @act_list[i].enemy?
- color = Quasi::ATB_COLOR_ENEMY
- else
- color = Quasi::ATB_COLOR_CURRENT
- end
- rect = Rect.new(x,y,w,h)
- rectbg = Rect.new(x-1,y-1,w+2,h+2)
- rectbg2 = Bitmap.new(self.width, self.height)
- rectbg2.fill_rect(x-1, y-1, w+2, h+2, color)
- contents.blt(rectbg.x, rectbg.y, rectbg2, rectbg)
- if FileTest.exist?("Graphics/Pictures/GTBS/Atb/#{string}.png")
- rectbg = Bitmap.new(w, h)
- rectbg = Cache.picture("GTBS/Atb/#{string}")
- rect2 = Rect.new(0,0,self.width,self.height)
- self.contents.blt(x, y, rectbg, rect2)
- else
- self.contents.draw_text(rect,"#{string}")
- end
- end
- end
- #===============================================================================
- # Window GTBS Hud
- #===============================================================================
- class Window_GTBS_Hud < TBS_Window_Base
- def initialize
- super(0, 0, 150, 100)
- move_to(9)
- @cursor_x = 0
- @cursor_y = 0
- @turn = 0
- create_back
- refresh
- end
- def create_back
- if FileTest.exist?('Graphics/Pictures/GTBS/Hud.png')
- @back = Sprite.new
- @back.bitmap = Cache.picture('GTBS/Hud.png')
- @back.z = 0
- self.opacity = 0
- else
- self.opacity = GTBS::CONTROL_OPACITY
- end
- end
- def cursor_x
- return @cursor_x
- end
- def cursor_x=(x)
- @cursor_x = x
- refresh
- end
- def cursor_y
- return @cursor_x
- end
- def cursor_y=(y)
- @cursor_y = y
- refresh
- end
- def turn
- return @turn
- end
- def turn=(turn)
- @turn = turn
- refresh
- end
- def refresh
- contents.clear
- x = self.width - (125 + 32 )
- turn = @turn / 2
- turn = 1 if @turn == 0
- contents.draw_text(x, 0, 125, 32, "Turn:" + turn.to_s, 2)
- contents.draw_text(x,24,125,32,"X: " + @cursor_x.to_s + " Y: " + @cursor_y.to_s, 2)
- return unless Layy_Meta.active
- h = $game_map.get_altitude(@cursor_x, @cursor_y)
- contents.draw_text(x,48,125,32,"H: " + h.to_s, 2)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment