# ▽△▽ XRXSv10. MeLTフェイス機能 ▽△▽ # # publish 2010/ 3/ 3 # update - 12/23 # # ※この機能はMeLT【メニューレイアウトテンプレート】本体に #  含まれています。 # #============================================================================== # 単体フェイス・ミニフェイスの取得 #============================================================================== class Game_Actor < Game_Battler def face key = self.face_name + "-" + (self.face_index + 1).to_s return Cache.one_face(key) end def miniface key = self.face_name + "-" + (self.face_index + 1).to_s return Cache.miniface(key) end end module Cache def self.one_face(key) @one_face_cache = {} if @one_face_cache == nil cache = @one_face_cache[key] if cache == nil or cache.disposed? face_name = key[0, key.size - 2] face_index = key[key.size - 1, 1].to_i x = (face_index % 4 * 96) y = (face_index / 4 * 96) face = Cache.face(face_name) cache = Bitmap.new(96,96) cache.blt(0, 0, face, Rect.new(x, y, 96, 96)) @one_face_cache[key] = cache end return cache end def self.miniface(key) @miniface_cache = {} if @miniface_cache == nil cache = @miniface_cache[key] if cache == nil or cache.disposed? face = Cache.one_face(key) cache = Bitmap.new(48,24) cache.stretch_blt(cache.rect, face, Rect.new(0, 14, 96, 48)) face.dispose @miniface_cache[key] = cache end return cache end def self.face_cache_clear @one_face_cache = {} if @one_face_cache == nil @one_face_cache.values.each{|cache| cache.dispose } @one_face_cache.clear Cache.miniface_cache_clear end def self.miniface_cache_clear @miniface_cache = {} if @miniface_cache == nil @miniface_cache.values.each{|cache| cache.dispose } @miniface_cache.clear end end