#==============================================================================
# RGSS3_キャラ画像コマ数拡張
# 2012/07/10公開
# C Winter ([url]http://ccwinter.blog.fc2.com/[/url])
#==============================================================================
#==============================================================================
# ■ Sprite_Character
#==============================================================================
class Sprite_Character < Sprite_Base
#--------------------------------------------------------------------------
# ● キャラクターのビットマップを設定
#--------------------------------------------------------------------------
def set_character_bitmap
self.bitmap = Cache.character(@character_name)
sign = @character_name[/^[\!\$]./]
max_pattern = @character_name =~ /{p=(\d+)}/i ? $1.to_i : 3
if sign && sign.include?('$')
@cw = bitmap.width / max_pattern
@ch = bitmap.height / 4
else
@cw = bitmap.width / (max_pattern * 4)
@ch = bitmap.height / 8
end
self.ox = @cw / 2
self.oy = @ch
end
#--------------------------------------------------------------------------
# ● 転送元矩形の更新
#--------------------------------------------------------------------------
def update_src_rect
if @tile_id == 0
index = @character.character_index
if @character_name =~ /{p=(\d+)}/i
max_pattern = $1.to_i
ori_pattern = 0
else
max_pattern = 3
ori_pattern = 1
end
pattern = @character.pattern < max_pattern ? @character.pattern : ori_pattern
sx = (index % 4 * 3 + pattern) * @cw
sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
end
end
#==============================================================================
# ■ Game_CharacterBase
#==============================================================================
class Game_CharacterBase
#--------------------------------------------------------------------------
# ● アニメパターンの更新
#--------------------------------------------------------------------------
def update_anime_pattern
max_pattern = @character_name =~ /{p=(\d+)}/i ? $1.to_i : 4
if !@step_anime && @stop_count > 0
@pattern = @original_pattern
else
@pattern = (@pattern + 1) % max_pattern
end
end
end