Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # ¦ VXAce-RGSS3-43 VN [Ver.1.0.2] by Claimh
- #------------------------------------------------------------------------------
- # KHUNG CUA Window
- #==============================================================================
- #DONGCOQT1
- #==============================================================================
- # ¦THIET LAP DAY DU NHU
- #==============================================================================
- module MenuEx3
- # CHIEU DOC
- HMAX = 4
- # CHIEU NGANG
- WMAX = 2
- # SU DUNG KI TU
- # true : KI TU HIEN THI
- # false : MANG HINH HIEN THI KHUON MAT
- CHAR = true
- # HP/MPVITRIDIEUCHINH
- PX = 20
- end
- #==============================================================================
- # ¦ CAI DAT IEN THI KI TU
- #------------------------------------------------------------------------------
- # NHAN VAT TRONG TRAN CHIEN
- # ·GIA TRI BAN DAU
- # DIEN DAN
- # @dead_c[TIEPTIN,index,CHISONVindex]
- # VD) Eric … @dead_c[Damage3,6,0]
- # Ernest … @dead_c[Damage3,7,0]
- # Brenda … @dead_c[Damage4,0,3]
- # ·THAYDOI
- # KICHBANSUKIEN
- # set_dead_c(DIENVIENID, "TTENFILE", index,CHISOindex)
- #------------------------------------------------------------------------------
- # NVTRANGTHAIXAU
- # ·GIATRIBANGDAU
- # GHICHUNV
- # @badst_c[TENTT, index, CHISONVindex]
- # VD)Eric … @badst_c[Damage3,6,1]
- # Ernest … @badst_c[Damage3,7,1]
- # Brenda … @badst_c[Damage4,0,4]
- # ·THOIGIAN
- # SUKIEN
- # set_badst_c(NVID, "TENFIKE", index, CHISOindex)
- # ·QUYENDINHXAU
- # DUOC THIET LAP
- # @badst
- #==============================================================================
- module MoveActor
- # DINHHUONGNV
- # 2 : TRC
- # 4 : CONLAI
- # 6 : RIGHT
- # 8 : TROLAI
- CHAR_DIR = 2
- # HANHVI(TDO)
- MOVE_CHAR = true
- # TOCDONV
- MOVE_SPD = 20
- end
- #==============================================================================
- # ¦ MoveCharData
- #==============================================================================
- class MoveCharData
- #--------------------------------------------------------------------------
- # ? ??????????
- #--------------------------------------------------------------------------
- attr_reader :enabled # ??(??????)
- attr_reader :dead # ????
- attr_reader :badst # ???????
- attr_reader :pending # ????
- attr_reader :pending_color # ????????
- attr_reader :name # ?????? ?????
- attr_reader :index # ?????? ??????
- attr_reader :pattern # ?????? ????(????????)
- #--------------------------------------------------------------------------
- # CONGCONG
- #--------------------------------------------------------------------------
- def initialize(actor, pending=false, pending_color=Color.new(0,0,0,0))
- @enabled = $game_party.battle_members.include?(actor)
- @pending = pending
- @pending_color = pending_color
- @dead = actor.dead?
- @badst = actor.badst?
- if @dead
- @name = actor.dead_character_name
- @index = actor.dead_character_index
- @pattern = actor.dead_character_pattern
- elsif @badst
- @name = actor.badst_character_name
- @index = actor.badst_character_index
- @pattern = actor.badst_character_pattern
- self
- else
- @name = actor.character_name
- @index = actor.character_index
- @pattern = 0
- end
- end
- #--------------------------------------------------------------------------
- # KHOITAO
- #--------------------------------------------------------------------------
- def st_normal?
- !(@dead or @badst)
- end
- end
- #==============================================================================
- # ¦ MoveCharacter
- #==============================================================================
- class MoveCharacter
- include MoveActor
- CHANGE = MOVE_SPD * 4
- MAX_CNT = MOVE_SPD * 4 * 4
- #--------------------------------------------------------------------------
- # BINHTHUONGKO
- #--------------------------------------------------------------------------
- def initialize(bitmap, rect, character)
- @rect = rect # ????
- @bitmap = bitmap # ?????????
- @count = MOVE_CHAR ? 0 : MOVE_SPD
- set_char(character)
- end
- #--------------------------------------------------------------------------
- # DONGCO1
- #--------------------------------------------------------------------------
- def set_char(character, force=false)
- @character = character
- redraw_character(force)
- end
- #--------------------------------------------------------------------------
- # DONGCO2(CR VA CD)
- #--------------------------------------------------------------------------
- def character_rect_base
- b = Cache.character(@character.name)
- sign = @character.name[/^[\!\$]./]
- if sign && sign.include?('$')
- cw = b.width / 3
- ch = b.height / 4
- else
- cw = b.width / 12
- ch = b.height / 8
- end
- Rect.new(0, 0, cw, ch)
- end
- #--------------------------------------------------------------------------
- # DONGCO3
- #--------------------------------------------------------------------------
- def character_rect(pattern)
- rect = character_rect_base
- if @character.dead or @character.badst
- rect.x = (@character.index % 4 * 3 + @character.pattern % 3) * rect.width
- rect.y = (@character.index / 4 * 4 + @character.pattern / 3) * rect.height
- else
- rect.x = (@character.index % 4 * 3 + pattern) * rect.width
- rect.y = (@character.index / 4 * 4 + (CHAR_DIR - 2) / 2) * rect.height
- end
- rect
- end
- #--------------------------------------------------------------------------
- # DONGCO4
- #--------------------------------------------------------------------------
- def draw_background
- @bitmap.fill_rect(@rect, @character.pending_color)
- end
- #--------------------------------------------------------------------------
- # DONGCO5
- #--------------------------------------------------------------------------
- def draw_character(pattern)
- return if @character.name == ""
- pattern = 1 if pattern >= 3
- src_rect = character_rect(pattern)
- op = @character.enabled ? 255 : 160
- @bitmap.blt(@rect.x, @rect.y, Cache.character(@character.name), src_rect, op)
- end
- #--------------------------------------------------------------------------
- # DONGCO6
- #--------------------------------------------------------------------------
- def redraw_character(force=false)
- return if !@character.st_normal? and !force
- @bitmap.clear_rect(@rect)
- draw_background if @character.pending
- draw_character((@count / MOVE_SPD) % 4)
- end
- #--------------------------------------------------------------------------
- # DONGCO7
- #--------------------------------------------------------------------------
- def update
- return unless MOVE_CHAR
- @count = (@count + 1) % MAX_CNT
- redraw_character if (@count % MOVE_SPD) == 0
- end
- end
- #==============================================================================
- # ¦ Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ? ??????????
- #--------------------------------------------------------------------------
- attr_accessor :dead_character_name # ?????????? ?????
- attr_accessor :dead_character_index # ?????????? ??????
- attr_accessor :dead_character_pattern # ?????????? ????
- attr_accessor :badst_character_name # ?????????? ?????
- attr_accessor :badst_character_index # ?????????? ??????
- attr_accessor :badst_character_pattern # ?????????? ????
- #--------------------------------------------------------------------------
- # DONGCO8
- #--------------------------------------------------------------------------
- alias setup_move_actor setup
- def setup(actor_id)
- setup_move_actor(actor_id)
- setup_dead_character(actor_id)
- setup_badst_character(actor_id)
- end
- #--------------------------------------------------------------------------
- # DONGCO9 (SU TAI HOP)
- #--------------------------------------------------------------------------
- def setup_dead_character(actor_id)
- result = $data_actors[actor_id].note.scan(/@dead_c\[(.*?+),(\d+),(\d+)\]/i)
- if result.nil? or result.empty?
- @dead_character_name = ""
- @dead_character_index = @dead_character_pattern = 0
- else
- @dead_character_name = result[0][0].to_s
- @dead_character_index = result[0][1].to_i
- @dead_character_pattern = result[0][2].to_i
- end
- end
- #--------------------------------------------------------------------------
- #DONGCO10 (DB)
- #--------------------------------------------------------------------------
- def setup_badst_character(actor_id)
- result = $data_actors[actor_id].note.scan(/@badst_c\[(.*?+),(\d+),(\d+)\]/i)
- if result.nil? or result.empty?
- @badst_character_name = ""
- @badst_character_index = @badst_character_pattern = 0
- else
- @badst_character_name = result[0][0].to_s
- @badst_character_index = result[0][1].to_i
- @badst_character_pattern = result[0][2].to_i
- end
- end
- #--------------------------------------------------------------------------
- # DONGCO11
- #--------------------------------------------------------------------------
- def badst?
- states.any? {|s| s.note.include?("@badst")}
- end
- end
- #==============================================================================
- # ¦ Game_Interpreter
- #==============================================================================
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # DONGCO12
- #--------------------------------------------------------------------------
- def set_dead_c(actor_id, name, index, pattern)
- actor = $game_actors[actor_id]
- actor.dead_character_name = name
- actor.dead_character_index = index
- actor.dead_character_pattern = pattern
- end
- #--------------------------------------------------------------------------
- # DONGCO13
- #--------------------------------------------------------------------------
- def set_badst_c(actor_id, name, index, pattern)
- actor = $game_actors[actor_id]
- actor.badst_character_name = name
- actor.badst_character_index = index
- actor.badst_character_pattern = pattern
- end
- end
- #==============================================================================
- # ¦ Window_MenuOneActor
- #==============================================================================
- class Window_MenuOneActor < Window_Base
- #--------------------------------------------------------------------------
- #DONGCO14
- #--------------------------------------------------------------------------
- attr_accessor :pending # ????(?????)
- #--------------------------------------------------------------------------
- # DONGCO125
- #--------------------------------------------------------------------------
- def initialize(x, y, index)
- @offset_x = 160
- @pending = false
- @index = index
- super(x, y, window_width, window_height)
- create_char_object if MenuEx3::CHAR
- end
- #--------------------------------------------------------------------------
- # DONGCO16 (TAIHOP)
- #--------------------------------------------------------------------------
- def create_char_object
- h = contents.height - line_height
- char_rect = Rect.new(12, line_height + (h - 32) / 2, 32, 32)
- actor = $game_party.members[@index]
- @char = MoveCharacter.new(contents, char_rect, MoveCharData.new(actor))
- end
- #--------------------------------------------------------------------------
- # DONGCO17
- #--------------------------------------------------------------------------
- def window_width
- (Graphics.width - @offset_x) / MenuEx3::WMAX
- end
- #--------------------------------------------------------------------------
- # DONGCO18
- #--------------------------------------------------------------------------
- def window_height
- Graphics.height / MenuEx3::HMAX
- end
- #--------------------------------------------------------------------------
- # DONGCO189
- #--------------------------------------------------------------------------
- def draw_item_background
- contents.fill_rect(Rect.new(0,0,contents.width,contents.height), pending_color) if @pending
- end
- #--------------------------------------------------------------------------
- # DONGCO120
- # enabled : ??????false ?????????
- #--------------------------------------------------------------------------
- def draw_face(face_name, face_index, x, y, enabled = true)
- bitmap = Cache.face(face_name)
- h = contents.height - line_height - 4
- sy = h < 96 ? ((96 - h) / 2) : 0
- h = h < 96 ? h : 96
- rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96 + sy, 96, h)
- contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
- bitmap.dispose
- end
- #--------------------------------------------------------------------------
- # VITRI/VITOIDAHIENTAI
- # current : HT
- # max : TOIDA
- # color1 : HT1
- # color2 : TOIDA
- #--------------------------------------------------------------------------
- def draw_current_and_max_values(x, y, width, current, max, color1, color2)
- change_color(color1)
- xr = x + width
- if width < 120 # 96??4????NG?????
- draw_text(xr - 40, y, 42, line_height, current, 2)
- else
- draw_text(xr - 92, y, 42, line_height, current, 2)
- change_color(color2)
- draw_text(xr - 52, y, 12, line_height, "/", 2)
- draw_text(xr - 42, y, 42, line_height, max, 2)
- end
- end
- #--------------------------------------------------------------------------
- # DONGCO122
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- actor = $game_party.members[@index]
- enabled = $game_party.battle_members.include?(actor)
- rect = Rect.new(0, 0, contents.width, contents.height)
- draw_item_background
- draw_actor_name(actor, 4, 0, rect.width - 60)
- draw_actor_level(actor, rect.width - 56, 0)
- if MenuEx3::CHAR
- @char.set_char(MoveCharData.new(actor, @pending, pending_color), true)
- x = 12 * 2 + 32 + 4
- else
- draw_actor_face(actor, 4, line_height, enabled)
- x = (rect.width - 108) > 96 ? (rect.width - 96) : 102
- end
- if (rect.height - line_height) < (line_height * 3)
- ic = false
- h = (rect.height - line_height) / 2
- else
- ic = true
- h = (rect.height - line_height - 2) / 3
- end
- x += MenuEx3::PX
- w = rect.width - x - 4
- draw_actor_hp(actor, x, line_height + h * 0, w)
- draw_actor_mp(actor, x, line_height + h * 1, w)
- if ic
- draw_actor_icons(actor, x, line_height + h * 2, w)
- elsif MenuEx3::CHAR
- # CHAR????2???????????????????
- #draw_actor_icons(actor, 0, rect.height - line_height, 100)
- else
- draw_actor_icons(actor, 0, rect.height - line_height, 100)
- end
- end
- #--------------------------------------------------------------------------
- # DONGCO129
- #--------------------------------------------------------------------------
- def enable_cursor
- cursor_rect.set(Rect.new(0, 0, contents.width, contents.height))
- end
- def disable_cursor
- cursor_rect.empty
- end
- #--------------------------------------------------------------------------
- # DONGCO130
- #--------------------------------------------------------------------------
- def pending=(flag)
- @pending = flag
- refresh
- end
- #--------------------------------------------------------------------------
- # DONGCO12567
- #--------------------------------------------------------------------------
- def update
- super
- @char.update if MenuEx3::CHAR
- end
- end
- #==============================================================================
- # ¦ Window_MenuStatusEx
- #==============================================================================
- class Window_MenuStatusEx < Window_Selectable
- #--------------------------------------------------------------------------
- # DONGCO120864
- #--------------------------------------------------------------------------
- attr_reader :pending_index # ????(?????)
- #--------------------------------------------------------------------------
- # DONGCO120617283
- #--------------------------------------------------------------------------
- def initialize(x, y)
- @offset_x = 160
- super(x, y, window_width, window_height)
- create_windows
- self.opacity = 0
- @pending_index = -1
- refresh
- end
- #--------------------------------------------------------------------------
- # DONGCO215271
- #--------------------------------------------------------------------------
- def dispose
- @windows.each {|w| w.dispose}
- super
- end
- #--------------------------------------------------------------------------
- # DONGCO120568
- #--------------------------------------------------------------------------
- def show
- @windows.each {|w| w.show}
- super
- end
- #--------------------------------------------------------------------------
- # DONGCO1206663833
- #--------------------------------------------------------------------------
- def hide
- @windows.each {|w| w.hide}
- super
- end
- #--------------------------------------------------------------------------
- # DONGCO120 ( MAU )
- #--------------------------------------------------------------------------
- def col_max
- MenuEx3::WMAX
- end
- #--------------------------------------------------------------------------
- # DONGCO199
- #--------------------------------------------------------------------------
- def create_windows
- @windows = []
- w = window_width / MenuEx3::WMAX
- h = window_height / MenuEx3::HMAX
- item_max.times do |i|
- x = @offset_x + w * (i % MenuEx3::WMAX)
- y = h * (i / MenuEx3::WMAX)
- @windows.push(Window_MenuOneActor.new(x, y, i))
- end
- end
- #--------------------------------------------------------------------------
- # DONGCOTTTT
- #--------------------------------------------------------------------------
- def window_width
- Graphics.width - @offset_x
- end
- #--------------------------------------------------------------------------
- # DONGCO123469
- #--------------------------------------------------------------------------
- def window_height
- Graphics.height
- end
- #--------------------------------------------------------------------------
- # TTT1
- #--------------------------------------------------------------------------
- def item_max
- $game_party.members.size
- end
- #--------------------------------------------------------------------------
- # DONGCO456
- #--------------------------------------------------------------------------
- def item_height
- (Graphics.height - standard_padding * 2) / MenuEx3::HMAX
- end
- #--------------------------------------------------------------------------
- # DONGCO120543
- #--------------------------------------------------------------------------
- def draw_item(index)
- @windows[index].refresh
- end
- #--------------------------------------------------------------------------
- # DONGCOQT1
- #--------------------------------------------------------------------------
- def index=(index)
- @windows[@index].disable_cursor if @index >= 0
- super(index)
- @windows[@index].enable_cursor if @index >= 0
- end
- #--------------------------------------------------------------------------
- #DONGCOQT2
- #--------------------------------------------------------------------------
- def process_ok
- super
- $game_party.menu_actor = $game_party.members[index]
- end
- #--------------------------------------------------------------------------
- # DONGCOQT3
- #--------------------------------------------------------------------------
- def select_last
- select($game_party.menu_actor.index || 0)
- end
- #--------------------------------------------------------------------------
- # DONGCOQT4
- #--------------------------------------------------------------------------
- def pending_index=(index)
- @windows[@pending_index].pending = false if @pending_index >= 0
- @pending_index = index
- @windows[@pending_index].pending = true if @pending_index >= 0
- end
- #--------------------------------------------------------------------------
- #DONGCOQT6
- #--------------------------------------------------------------------------
- def top_row=(row)
- super(row)
- h = window_height / MenuEx3::HMAX
- item_max.times do |i|
- @windows[i].y = h * (i / col_max - (top_row * col_max) / col_max)
- end
- end
- #--------------------------------------------------------------------------
- # DONGCOQT7
- #--------------------------------------------------------------------------
- def update
- super
- @windows.each {|w| w.update}
- end
- #--------------------------------------------------------------------------
- # DONGCOQT8
- #--------------------------------------------------------------------------
- def update_cursor
- super
- cursor_rect.empty # ??????????
- end
- end
- #==============================================================================
- # ¦ Scene_Menu
- #==============================================================================
- class Scene_Menu < Scene_MenuBase
- #--------------------------------------------------------------------------
- # DONGCOQT9
- #--------------------------------------------------------------------------
- def create_status_window
- @status_window = Window_MenuStatusEx.new(@command_window.width, 0)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment