Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==========================#
- # Z17 Alternate HUD v1.02 #
- #===#==================#===#
- # by: Zetu #
- #==================#
- module Z17
- BATTLESYSTEM = 0
- # 0 = Default Battle System
- # 1 = Tankentai ATB
- end
- module N02
- ATB_PARTY_POSITION = []
- for i in 0...Game_Party::MAX_MEMBERS
- ATB_PARTY_POSITION.push([112 + i*128, 310])
- end
- end
- class Scene_Battle < Scene_Base
- alias z17_create_info_viewport create_info_viewport
- def create_info_viewport
- case Z17::BATTLESYSTEM
- when 0
- z17_create_info_viewport
- @info_viewport.rect.y -= 128
- @info_viewport.rect.height += 128
- @status_window.x -= 128
- @status_window.width += 128
- @status_window.y += 128
- @status_window.refresh
- @party_command_window.y += 72
- @party_command_window.column_max = @party_command_window.item_max
- @party_command_window.height = 56
- @party_command_window.width = @party_command_window.item_max*128
- @party_command_window.spacing = 0
- @party_command_window.create_contents
- @party_command_window.refresh
- when 1
- @command_members = []
- @action_battlers = []
- @info_viewport = Viewport.new(0, 288, 544, 128)
- @info_viewport.z = 100
- @status_window = Window_BattleStatus.new
- @party_command_window = Window_PartyCommand.new
- @actor_command_window = Window_ActorCommand.new
- @status_window.viewport = @info_viewport
- @actor_command_window.viewport = @info_viewport
- @status_window.x = 128
- @actor_command_window.x = 672
- @info_viewport.visible = false
- @party_command_window.visible = false
- @info_viewport.ox = 128
- #--------
- @info_viewport.rect.y -= 128
- @info_viewport.rect.height += 128
- @status_window.width += 128
- @status_window.y += 128
- @status_window.refresh
- @party_command_window.column_max = @party_command_window.item_max
- @party_command_window.height = 56
- @party_command_window.width *= @party_command_window.item_max
- @party_command_window.spacing = 0
- @party_command_window.create_contents
- end
- end
- alias z17_start_target_enemy_selection start_target_enemy_selection
- def start_target_enemy_selection
- case Z17::BATTLESYSTEM
- when 0
- @target_enemy_window = Window_TargetEnemy.new
- @target_enemy_window.y = @info_viewport.rect.y
- @actor_command_window.active = false
- @status_window.visible = false
- @target_enemy_window.width += 128
- @target_enemy_window.y += 128
- when 1
- z17_start_target_enemy_selection
- end
- end
- def end_target_enemy_selection
- @status_window.visible = true
- @target_enemy_window.dispose
- @target_enemy_window = nil
- if @actor_command_window.index == 0
- @actor_command_window.active = true
- end
- end
- alias z17_start_target_actor_selection start_target_actor_selection
- def start_target_actor_selection
- case Z17::BATTLESYSTEM
- when 0
- @target_actor_window = Window_BattleStatus.new
- @target_actor_window.index = 0
- @target_actor_window.active = true
- @target_actor_window.y = @info_viewport.rect.y + 128
- @target_actor_window.width += 128
- @target_actor_window.refresh
- @actor_command_window.active = false
- @status_window.visible = false
- when 1
- z17_start_target_actor_selection
- end
- end
- def end_target_actor_selection
- @target_actor_window.dispose
- @target_actor_window = nil
- @status_window.visible = true
- end
- def update_info_viewport
- @party_command_window.update
- @actor_command_window.update
- @status_window.update
- offset_party_window
- offset_command_window
- end
- if Z17::BATTLESYSTEM == 1
- alias z17_start_party_command start_party_command
- def start_party_command
- z17_start_party_command
- @party_command_window.column_max = @party_command_window.item_max
- @party_command_window.height = 56
- @party_command_window.width = @party_command_window.item_max*128
- @party_command_window.spacing = 0
- @party_command_window.create_contents
- @party_command_window.refresh
- end
- end
- def offset_party_window
- case Z17::BATTLESYSTEM
- when 0; a, b = [0, -@party_command_window.width]
- when 1; a, b = [0, -@party_command_window.width]
- end
- if @party_command_window.active and @party_command_window.x < a
- @party_command_window.x += 16
- elsif @actor_command_window.active and @party_command_window.x > b
- @party_command_window.x -= 16
- end
- end
- def offset_command_window
- case Z17::BATTLESYSTEM
- when 0; a, b = [544 - @actor_command_window.width, 544]
- when 1; a, b = [672 - @actor_command_window.width, 672]
- end
- if @actor_command_window.active and @actor_command_window.x > a
- @actor_command_window.x -= 16
- elsif (@party_command_window.active or !@skill_window.nil?) and @actor_command_window.x < b
- @actor_command_window.x += 16
- end
- end
- end
- class Window_Selectable < Window_Base
- attr_writer :column_max
- attr_writer :spacing
- end
- class Window_BattleStatus < Window_Selectable
- alias zreq_initialize initialize
- def initialize
- zreq_initialize
- @column_max = Game_Party::MAX_MEMBERS
- end
- def refresh
- self.contents.clear
- @item_max = $game_party.members.size
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- end
- def draw_item(index)
- rect = Rect.new(index*size_x+4, 0, size_x-8, 96)
- self.contents.clear_rect(rect)
- self.contents.font.color = normal_color
- actor = $game_party.members[index]
- x = rect.x
- y = rect.y
- draw_face_z17(actor, x, y)
- draw_actor_name(actor, x, y-6)
- draw_actor_state(actor, x, y+40, 48)
- draw_actor_hp(actor, x, y+58, size_x-8)
- draw_actor_mp(actor, x, y+74, size_x-8)
- end
- def draw_face_z17(actor, x, y)
- if size_x > 96
- ws = (size_x-96) / 2
- draw_actor_face(actor, x+ws, y, 64, 96)
- else
- draw_actor_face(actor, x, y, size_x, 96)
- end
- end
- def size_x
- if $game_party.members.size > 4
- return 512 / $game_party.members.size
- else
- return 128
- end
- end
- def update_cursor
- if @index < 0
- self.cursor_rect.empty
- else
- rect = Rect.new(index*size_x, 0, size_x, 96)
- self.cursor_rect = rect
- end
- end
- end
- class Window_Base < Window
- def draw_face(face_name, face_index, x, y, size1 = 96, size2 = 96)
- bitmap = Cache.face(face_name)
- rect = Rect.new(0, 0, 0, 0)
- rect.x = face_index % 4 * 96 + (96 - size2) / 2
- rect.y = face_index / 4 * 96 + (96 - size1) / 2
- rect.width = size2
- rect.height = size1
- self.contents.blt(x, y, bitmap, rect)
- bitmap.dispose
- end
- def draw_actor_face(actor, x, y, size1 = 96, size2 = -1)
- size2 = size1 if size2 == -1
- draw_face(actor.face_name, actor.face_index, x, y, size1, size2)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement