#===============================================================
# 本脚本来自[url]www.66rpg.com[/url]
# 功能:对于没有设置战斗背景的地图,直接用地图做战斗背景
#===============================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize(flag = false)
# 生成显示端口
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 200
@viewport3.z = 5000
# 生成元件地图
@tilemap = Tilemap.new(@viewport1)
@tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
for i in 0..6
autotile_name = $game_map.autotile_names[i]
@tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
end
@tilemap.map_data = $game_map.data
@tilemap.priorities = $game_map.priorities
# 生成远景平面
@panorama = Plane.new(@viewport1)
@panorama.z = -1000
# 生成雾平面
[url=home.php?mod=space&uid=14217]@fog[/url] = Plane.new(@viewport1)
@fog.z = 3000
unless flag
# 生成角色活动块
@character_sprites = []
for i in $game_map.events.keys.sort
sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
@character_sprites.push(sprite)
end
@character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
end
# 生成天气
@weather = RPG::Weather.new(@viewport1)
# 生成图片
@picture_sprites = []
for i in 1..50
@picture_sprites.push(Sprite_Picture.new(@viewport2,
$game_screen.pictures[i]))
@viewport2.z = 9999
end
# 生成计时器块
@timer_sprite = Sprite_Timer.new
# 刷新画面
update# unless flag
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose(flag = false)
# 释放元件地图
@tilemap.tileset.dispose
for i in 0..6
@tilemap.autotiles[i].dispose
end
@tilemap.dispose
# 释放远景平面
@panorama.dispose
# 释放雾平面
@fog.dispose
unless flag
# 释放角色活动块
for sprite in @character_sprites
sprite.dispose
end
end
# 释放天候
@weather.dispose
# 释放图片
for sprite in @picture_sprites
sprite.dispose
end
# 释放计时器块
@timer_sprite.dispose
# 释放显示端口
@viewport1.dispose
@viewport2.dispose
@viewport3.dispose
end
end
class Scene_Battle
alias battleback_map_main main
def main
@battleback_sprite = Spriteset_Map.new(true)
battleback_map_main
@battleback_sprite.dispose(true)
end
end
#===============================================================
# 申请者:张永;脚本作者:bluefool 改善人:亿万星辰
#===============================================================