Project1
标题:
拜托各位啦:关于以前的“动态模糊脚本”的BUG
[打印本页]
作者:
7408
时间:
2013-7-10 14:32
标题:
拜托各位啦:关于以前的“动态模糊脚本”的BUG
本帖最后由 7408 于 2013-7-10 15:04 编辑
原帖内容:
http://rpg.blue/thread-207413-1-1.html
这个脚本有一个暗藏的BUG,而且貌似很严重,就是将动态模糊效果打开时,地图上的自动元件会出现异常,请问怎么解决这个问题?~谢谢。
图片-1.png
(310.28 KB, 下载次数: 7)
下载附件
保存到相册
说明图片
2013-7-10 14:30 上传
脚本如下
#--------------------------------------------------------------------------
# ● 动态糊模效果
# 制作者 小飞侠_shoed
# 用法:
# 打开
# 开关[模糊效果]=ON
# 开关[模糊效果]=OFF
$模糊效果 = 2
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
alias plan_map_window_main main
def main
@blur_window = Blur_Effect.new
@blur_window.visible=$game_switches[$模糊效果]
plan_map_window_main
@blur_window.dispose
end
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
alias plan_map_window_update update
def update
plan_map_window_update
@blur_window.visible=$game_switches[$模糊效果]
@blur_window.update
end
#--------------------------------------------------------------------------
# ● 场所移动的变化
#--------------------------------------------------------------------------
alias plan_map_window_transfer_player transfer_player
def transfer_player
visible = $game_switches[$模糊效果]
$game_switches[$模糊效果] = false
@blur_window.visible=$game_switches[$模糊效果]
plan_map_window_transfer_player
@blur_window.dispose
@blur_window = Blur_Effect.new
$game_switches[$模糊效果] = visible
@blur_window.visible=$game_switches[$模糊效果]
end
end
#==============================================================================
# Blur_Effect
#==============================================================================
class Blur_Effect
def initialize
@blurSprite=Sprite.new
@sum=Bitmap.new(640,480)
@RT=Picture_Map.new
@blurSprite.bitmap=@sum
@blurSprite.z=9999
end
def update
if $game_switches[$模糊效果] == true
@RT.update
@sum.blt(0,0,@RT,Rect.new(0,0,@RT.width,@RT.height),60)
end
end
def dispose
@sum.dispose
@RT.dispose
@blurSprite.dispose
end
def visible=(flag)
@blurSprite.visible=flag
end
end
#==============================================================================
# Picture_Character
#==============================================================================
class Picture_Character < Bitmap
attr_accessor :character # 角色
def initialize(character = nil)
@character = character
@bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
@cw = @bitmap.width / 4
@ch = @bitmap.height / 4
super(@cw,@ch)
@stopTitles=[]
@moveTitles=[]
end
def update
self.clear
# 元件 ID、文件名、色相与现在的情况存在差异的情况下
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
# 记忆元件 ID 与文件名、色相
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
# 元件 ID 为有效值的情况下
if @tile_id >= 384
@bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.character_hue)
@cw = 32
@ch = 32
else
@bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
end
end
# 图形是角色的情况下
if @tile_id == 0
# 设置传送目标的矩形
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
self.blt(0,0,@bitmap,Rect.new(sx,sy,@cw,@ch))
end
#计算title
if self.visible
if @x != self.x or @y != self.y
@x=self.x
@y=self.y
@stopTitles.clear
#@moveTitles.clear
tile_x=self.real_width/32
if tile_x%2==0
tile_x+=1
end
tile_y=(self.real_height/32.0).ceil
for j in 0...tile_y
maskId=[self.x,self.y-j,j]
@stopTitles.push(maskId)
for i in 1..(tile_x-1)/2
maskId=[self.x-i,self.y-j,j]
@stopTitles.push(maskId)
maskId=[self.x+i,self.y-j,j]
@stopTitles.push(maskId)
end
end
@
[email protected]
case @character.direction
when 2 #向下
maskId=[self.x,self.y-tile_y,tile_y]
@moveTitles.push(maskId)
for i in 1..(tile_x-1)/2
maskId=[self.x-i,self.y-tile_y,tile_y]
@moveTitles.push(maskId)
maskId=[self.x+i,self.y-tile_y,tile_y]
@moveTitles.push(maskId)
end
when 4 #向左
for j in 0...tile_y
maskId=[self.x+(tile_x-1)/2+1,self.y-j,j]
@moveTitles.push(maskId)
end
when 6 #向右
for j in 0...tile_y
maskId=[self.x-(tile_x-1)/2-1,self.y-j,j]
@moveTitles.push(maskId)
end
when 8 #向上
for k in @moveTitles
k[2]+=1
end
maskId=[self.x,self.y+1,0]
@moveTitles.push(maskId)
for i in 1..(tile_x-1)/2
maskId=[self.x-i,self.y+1,0]
@moveTitles.push(maskId)
maskId=[self.x+i,self.y+1,0]
@moveTitles.push(maskId)
end
end
end
end
end
def x
return @character.x
end
def y
return @character.y
end
def screen_x
return @character.screen_x
end
def screen_y
return @character.screen_y
end
def screen_z
return @character.screen_z(@ch)
end
def real_width
return @cw
end
def real_height
return @ch
end
def visible
return
[email protected]
end
def opacity
return @character.opacity
end
def maskTitles
if @character.moving?
return @moveTitles
else
return @stopTitles
end
end
end
#==============================================================================
# Picture_Map
#==============================================================================
class Picture_Map < Bitmap
def initialize
super(640,480)
@map_cw = $game_map.width * 32
@map_ch = $game_map.height * 32
@tileset = RPG::Cache.tileset($game_map.tileset_name)
@autotiles = []
for i in 0..6
autotile_name = $game_map.autotile_names[i]
@autotiles[i] = RPG::Cache.autotile(autotile_name)
end
@map_data = $game_map.data
@priorities = $game_map.priorities
@character_sprites = []
for i in $game_map.events.keys.sort
sprite = Picture_Character.new($game_map.events[i])
@character_sprites.push(sprite)
end
@character_sprites.push(Picture_Character.new($game_player))
@all_map = Bitmap.new (@map_cw,@map_ch)
make_map
end
def update
self.clear
self.blt(0,0,@all_map,Rect.new(map_x,map_y,width,height))
# 刷新角色活动块
@character_sprites.sort!{|a,b|a.screen_z<=>b.screen_z}
for sprite in @character_sprites
if sprite.visible
sprite.update
px=sprite.screen_x-sprite.real_width/2
py=sprite.screen_y-sprite.real_height
self.blt(px,py,sprite,Rect.new(0,0,sprite.real_width,sprite.real_height),sprite.opacity)
for mask_id in sprite.maskTitles
next unless $game_map.valid?(mask_id[0], mask_id[1])
for i in [2, 1, 0]
tile = @map_data[mask_id[0], mask_id[1], i]
next if tile == 0 #透明的
if $game_map.priorities[tile] > mask_id[2]
if tile < 384
if tile >= 48
tile -= 48
src_rect = Rect.new(32, 2 * 32, 32, 32)
self.blt(mask_id[0] * 32 - map_x, mask_id[1] * 32 - map_y, @autotiles[tile / 48], src_rect)
end
else
tile -= 384
src_rect = Rect.new(tile % 8 * 32, tile / 8 * 32, 32, 32)
self.blt(mask_id[0] * 32 - map_x, mask_id[1] * 32 - map_y, @tileset, src_rect)
end
break
end
end
end
end
end
end
def dispose
super
# 释放元件地图
@tileset.dispose
for i in 0..6
@autotiles[i].dispose
end
# 释放角色活动块
for sprite in @character_sprites
sprite.dispose
end
@all_map.dispose
end
def make_map
for y in 0...$game_map.height
for x in 0...$game_map.width
for z in 0...3
tile = @map_data[x, y, z]
next if tile == nil
if tile < 384
if tile >= 48
tile -= 48
src_rect = Rect.new(32, 2 * 32, 32, 32)
@all_map.blt(x * 32, y * 32, @autotiles[tile / 48], src_rect)
end
else
tile -= 384
src_rect = Rect.new(tile % 8 * 32, tile / 8 * 32, 32, 32)
@all_map.blt(x * 32, y * 32, @tileset, src_rect)
end
end
end
end
end
def map_width
return @map_cw
end
def map_height
return @map_ch
end
def map_x
return $game_map.display_x / 4
end
def map_y
return $game_map.display_y / 4
end
end
复制代码
作者:
7408
时间:
2013-7-10 21:33
有人能解决这个问题吗?
{:2_283:}怎么没人回复?
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1