Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def order_equips(dir)
- # 0 = Arma
- # 1 = Escudo
- # 2 = Capacete
- # 3 = Armadura
- # 4 = Acessório
- # 5 = Amuleto
- # 6 = Capa
- # 7 = Luva
- # 8 = Bota
- case dir
- when 2 # Frente
- return [3, 5, 2, 7, 6, 8, 1, 0, 4]
- when 4 # Esquerda
- return [7, 0, 3, 5, 2, 6, 8, 1, 4]
- when 6 # Direita
- return [1, 3, 5, 2, 7, 6, 8, 0, 4]
- when 8 # Costas
- return [7, 1, 0, 3, 5, 2, 8, 6, 4]
- end
- end
- def update_paperdoll
- create_paperdoll unless @paperdoll
- refresh_paperdoll if @character.actor.refresh_paperdoll
- pattern = @character.pattern < 3 ? @character.pattern : 1
- paperdoll_index = @character.attack_animation? ? @character.character_index : 0
- sx = (paperdoll_index % 4 * 3 + pattern) * Configs::PDMAXFSIZE
- sy = (paperdoll_index / 4 * 4 + (@character.direction - 2) / 2) * Configs::PDMAXFSIZE
- @paperdoll.src_rect.set(sx, sy, Configs::PDMAXFSIZE, Configs::PDMAXFSIZE)
- @paperdoll.x = x
- @paperdoll.y = y
- @paperdoll.z = z
- end
- def refresh_paperdoll
- @paperdoll.bitmap.clear
- [2,4,6,8].each{|dir|
- order_equips(dir).each {|slot_id|
- next unless @character.actor.equips[slot_id] && @character.actor.equips[slot_id].paperdoll_name
- bitmap = Cache.paperdoll(@character.actor.equips[slot_id].paperdoll_name, @character.actor.sex)
- sign = @character.actor.equips[slot_id].paperdoll_name[/^[\!\$]./]
- if sign && sign.include?('$')
- paperdoll_index = 0
- cw = bitmap.width / 3
- ch = bitmap.height / 4
- else
- paperdoll_index = @character.actor.equips[slot_id].paperdoll_index
- cw = bitmap.width / 12
- ch = bitmap.height / 8
- end
- 3.times{ |pattern|
- sx = (paperdoll_index % 4 * 3 + pattern) * cw
- sy = (paperdoll_index / 4 * 4 + (dir - 2) / 2) * ch
- rect = Rect.new(sx, sy, cw, ch)
- bx = (pattern * Configs::PDMAXFSIZE)
- by = (((dir - 2) / 2) * Configs::PDMAXFSIZE)
- bltx = bx + ((Configs::PDMAXFSIZE - cw) / 2)
- blty = by + (Configs::PDMAXFSIZE - ch)
- @paperdoll.bitmap.blt(bltx, blty, bitmap, rect)
- }
- }
- }
- @character.actor.refresh_paperdoll = false
- end
- def create_paperdoll
- @paperdoll = Sprite.new(viewport)
- @paperdoll.bitmap = Bitmap.new(Configs::PDMAXFSIZE * 3, Configs::PDMAXFSIZE * 4)
- @paperdoll.ox = Configs::PDMAXFSIZE / 2
- @paperdoll.oy = Configs::PDMAXFSIZE
- end
- def dispose_paperdoll#LM² - Paperdoll
- return unless @paperdoll
- @paperdoll.bitmap.dispose
- @paperdoll.dispose
- @paperdoll = nil
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement