#============================================================================
# ■ VX_事件图形刷新简化 —— By 诡异の猫
#============================================================================
# 脚本内容: 只刷新视野内的事件图形,改善大地图事件过多卡机情况.
#============================================================================
class Sprite_Character < Sprite_Base
#--------------------------------------------------------------------------
# ● 判定图形是否再视野内
#--------------------------------------------------------------------------
def in_view?
add_x = (self.width-32)*4 + 256
add_y = self.height*8
begin_x = $game_map.display_x - add_x
begin_y = $game_map.display_y - add_y
end_x = $game_map.display_x + 4352 + add_x
end_y = $game_map.display_y + 3328 + add_y
limit_x = $game_map.width * 256 - 256 + add_x
limit_y = $game_map.height * 256 - 256 + add_y
char_x = @character.real_x
char_y = @character.real_y
if end_x <= limit_x
return false if char_x < begin_x or char_x > end_x
end
if end_y <= limit_y
return false if char_y < begin_y or char_y > end_y
end
if end_x > limit_x and end_y > limit_y
return false if char_x < begin_x and char_x > end_x - limit_x
return false if char_y < begin_y and char_y > end_y - limit_y
end
return true
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
if in_view?
update_bitmap
self.visible = (not @character.transparent)
update_src_rect
self.x = @character.screen_x
self.y = @character.screen_y
self.z = @character.screen_z
self.opacity = @character.opacity
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
end
update_balloon
if @character.animation_id != 0
animation = $data_animations[@character.animation_id]
start_animation(animation)
@character.animation_id = 0
end
if @character.balloon_id != 0
@balloon_id = @character.balloon_id
start_balloon
@character.balloon_id = 0
end
end
end