$VIPArcherScript ||= {};$VIPArcherScript[:characters_frame] = 20150122
class Game_Player < Game_Character
def straighten
return super unless @fix
@pattern = @fix if @walk_anime || @step_anime
@anime_count = 0
end
alias characters_frame_refresh refresh
def refresh
characters_frame_refresh
@original_pattern = @fix = $1.to_i if @character_name =~ /#(\d+)/
@frame = $1.to_i if @character_name =~ /@(\d+)/
end
def update_anime_pattern
return super unless @frame
if !@step_anime && @stop_count > 0
@pattern = @original_pattern
else
@pattern = (@pattern + 1) % @frame
end
end
end
class Sprite_Character < Sprite_Base
alias characters_frame_set_character_bitmap set_character_bitmap
def set_character_bitmap
if @character_name =~ /@(\d+)/
@frame = $1.to_i
self.bitmap = Cache.character(@character_name)
sign = @character_name[/^[\!\$]./]
if sign && sign.include?('$')
@cw = bitmap.width / @frame
@ch = bitmap.height / 4
else
@cw = bitmap.width / @frame * 4
@ch = bitmap.height / 8
end
self.ox = @cw / 2
self.oy = @ch
else
characters_frame_set_character_bitmap
end
end
alias characters_frame_update_src_rect update_src_rect
def update_src_rect
return characters_frame_update_src_rect unless @frame
if @tile_id == 0
index = @character.character_index
pattern = @character.pattern < @frame ? @character.pattern : 1
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