赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 163587 |
最后登录 | 2020-5-5 |
在线时间 | 41 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 60
- 在线时间
- 41 小时
- 注册时间
- 2008-3-5
- 帖子
- 2072
|
有人说那个脚本VX不能用,呵呵,没弄过VX,不知道VX的角色图是这样的哦,没Hue的~!
改好了,这个是VX版本的,当然我自己测试用的是XP版本的,也放着吧
VX版
- #===============================================================
- # ● [VX] ◦迷你地图 ◦ □
- # * 无须图片的迷你地图脚本,浪使者倾情汉化 *
- #--------------------------------------------------------------
- # ◦ by Woratana [原作者]
- # ◦ 用于 RPG Maker VX
- # ◦ 最近更新: 09/06/2008
- # ◦ 版本: 1.0 Beta
- #--------------------------------------------------------------
- # ◦ 特别感谢: KGC 的 XP 迷你地图脚本,
- # 没有他的迷你地图脚本,这个就不会被做出来.
- #--------------------------------------------------------------
- module MiniMap
- #===========================================================================
- # [START]迷你地图脚本设置部分 地图名前+[NOMAP] 不显示
- #---------------------------------------------------------------------------
- SWITCH_NO_MINIMAP = 10 # 打开这个开关的话就不显示迷你地图
-
- MAP_RECT = [410, 20, 100, 100] # 迷你地图的大小和位置
- # [X, Y, Width, Height]
- # 你可以用调用脚本的方法任意改变他:
- # $game_system.minimap = [X, Y, Width, Height]
- MAP_Z = 0 # 迷你地图的Z轴
- # 增加这个数值,如果迷你地图显示在某些物体下面的话(被覆盖)。
- GRID_SIZE = 5 # 引导大小,建议数值大于3.
-
- MINIMAP_BORDER_COLOR = Color.new(0, 0, 255, 160) # 色彩设定
- # Color.new(Red, Green, Blue, Opacity)
- MINIMAP_BORDER_SIZE = 2
-
- FOREGROUND_COLOR = Color.new(224, 224, 255, 160) # 可通过物颜色
- BACKGROUND_COLOR = Color.new(220, 0, 0, 160) # 不可通过物颜色
- USE_OUTLINE_PLAYER = true # 是否描绘的角色?
- PLAYER_OUTLINE_COLOR = Color.new(0, 0, 0, 192) # 角色颜色
- USE_OUTLINE_EVENT = true # 是否描绘特殊事件?(如商人、敌人NPC等)
- EVENT_OUTLINE_COLOR = Color.new(255, 255, 255, 192) # 特殊事件颜色
- EVENT_CHARACTOR_ZOOM = 0.5 #显示头像的缩放比例
- EVENT_CHARACTOR_H = 1 #显示头像的大小比例 1为显示全身像 0.5为显示半身像
- EVENT_CHARACTOR_X = -2 #显示头像的X坐标
- EVENT_CHARACTOR_Y = 8 #显示头像的X坐标
- #要显示头像请再事件中加注释“显示头像”
-
- PLAYER_COLOR = Color.new(255, 0, 0, 192) # 角色颜色设定
- #---------------------------------------------------------------------------
- OBJECT_COLOR = {} # 不要改变或删除这一行!
- #===============================================================
- # * 设置关键字和颜色
- #---------------------------------------------------------------
- # ** 例如:
- # OBJECT_COLOR['keyword'] = Color.new(Red, Green, Blue, Opacity)
- #-------------------------------------------------------------
- # * 'keyword': 你想放到公共事件里来显示的颜色
- # ** 标记: #===============================================================
- # ● [VX] ◦迷你地图 ◦ □
- # * 无须图片的迷你地图脚本,浪使者倾情汉化 *
- #--------------------------------------------------------------
- # ◦ by Woratana [原作者]
- # ◦ 用于 RPG Maker VX
- # ◦ 最近更新: 09/06/2008
- # ◦ 版本: 1.0 Beta
- #--------------------------------------------------------------
- # ◦ 特别感谢: KGC 的 XP 迷你地图脚本,
- # 没有他的迷你地图脚本,这个就不会被做出来.
- #--------------------------------------------------------------
- module MiniMap
- #===========================================================================
- # [START]迷你地图脚本设置部分 地图名前+[NOMAP] 不显示
- #---------------------------------------------------------------------------
- SWITCH_NO_MINIMAP = 10 # 打开这个开关的话就不显示迷你地图
-
- MAP_RECT = [410, 20, 100, 100] # 迷你地图的大小和位置
- # [X, Y, Width, Height]
- # 你可以用调用脚本的方法任意改变他:
- # $game_system.minimap = [X, Y, Width, Height]
- MAP_Z = 0 # 迷你地图的Z轴
- # 增加这个数值,如果迷你地图显示在某些物体下面的话(被覆盖)。
- GRID_SIZE = 5 # 引导大小,建议数值大于3.
-
- MINIMAP_BORDER_COLOR = Color.new(0, 0, 255, 160) # 色彩设定
- # Color.new(Red, Green, Blue, Opacity)
- MINIMAP_BORDER_SIZE = 2
-
- FOREGROUND_COLOR = Color.new(224, 224, 255, 160) # 可通过物颜色
- BACKGROUND_COLOR = Color.new(220, 0, 0, 160) # 不可通过物颜色
- USE_OUTLINE_PLAYER = true # 是否描绘的角色?
- PLAYER_OUTLINE_COLOR = Color.new(0, 0, 0, 192) # 角色颜色
- USE_OUTLINE_EVENT = true # 是否描绘特殊事件?(如商人、敌人NPC等)
- EVENT_OUTLINE_COLOR = Color.new(255, 255, 255, 192) # 特殊事件颜色
- EVENT_CHARACTOR_ZOOM = 0.5 #显示头像的缩放比例
- EVENT_CHARACTOR_H = 1 #显示头像的大小比例 1为显示全身像 0.5为显示半身像
- EVENT_CHARACTOR_X = -2 #显示头像的X坐标
- EVENT_CHARACTOR_Y = 8 #显示头像的X坐标
- #要显示头像请再事件中加注释“显示头像”
-
- PLAYER_COLOR = Color.new(255, 0, 0, 192) # 角色颜色设定
- #---------------------------------------------------------------------------
- OBJECT_COLOR = {} # 不要改变或删除这一行!
- #===============================================================
- # * 设置关键字和颜色
- #---------------------------------------------------------------
- # ** 例如:
- # OBJECT_COLOR['keyword'] = Color.new(Red, Green, Blue, Opacity)
- #-------------------------------------------------------------
- # * 'keyword': 你想放到公共事件里来显示的颜色
- # ** 标记: 'keyword' 是很关键的!
- # * Color.new(...): 你需要的颜色
- # 你可输入 0 - 255 的可选色彩范围 (Red, Green, Blue, Opacity)
- #-------------------------------------------------------------
- OBJECT_COLOR['npc'] = Color.new(30,144,255,160)
- OBJECT_COLOR['treasure'] = Color.new(0,255,255,160)
- OBJECT_COLOR['enemy'] = Color.new(139,35,35,160)
- OBJECT_COLOR['merchant'] = Color.new(255,255,0,160)
-
- #===========================================================================
- # * [说明] 标签:
- #---------------------------------------------------------------------------
- # 改变这些关闭迷你地图 & 或设置显示迷你地图~
- #-----------------------------------------------------------------------
- TAG_NO_MINIMAP = '[NOMAP]'
- TAG_EVENT = ["npc","enemy","merchant","treasure"]
- #---------------------------------------------------------------------------
- #---------------------------------------------------------------------------
- # [END] 迷你地图脚本设置部分
- #===========================================================================
-
- def self.refresh
- if $scene.is_a?(Scene_Map)
- $scene.spriteset.minimap.refresh
- end
- end
-
- def self.update_object
- if $scene.is_a?(Scene_Map)
- $scene.spriteset.minimap.update_object_list
- end
- end
- end
- #==============================================================================
- # ■ RPG::MapInfo
- #==============================================================================
- class RPG::MapInfo
- def name
- return @name.gsub(/\[.*\]/) { }
- end
- def original_name
- return @name
- end
- def show_minimap?
- return [email protected]?(MiniMap::TAG_NO_MINIMAP)
- end
- end
- #==============================================================================
- # ■ Game_System
- #==============================================================================
- class Game_System
- attr_accessor :minimap
- alias wora_minimap_gamsys_ini initialize
-
- def initialize
- wora_minimap_gamsys_ini
- @minimap = MiniMap::MAP_RECT
- end
-
- def show_minimap
- return !$game_switches[MiniMap::SWITCH_NO_MINIMAP]
- end
- end
- #==============================================================================
- # ■ Game_Map
- #==============================================================================
- class Game_Map
- alias wora_minimap_gammap_setup setup
- def setup(map_id)
- wora_minimap_gammap_setup(map_id)
- @db_info = load_data('Data/MapInfos.rvdata') if @db_info.nil?
- @map_info = @db_info[map_id]
- end
-
- def show_minimap?
- return @map_info.show_minimap?
- end
- end
- #==============================================================================
- # ■ Game_Event
- #==============================================================================
- class Game_Event < Game_Character
- def mm_comment?(comment, return_comment = false )
- if [email protected]?
- for i in [email protected] - 1
- next if @list[i].code != 108
- if comment.include?(@list[i].parameters[0])
- return @list[i].parameters[0] if return_comment
- return true
- end
- end
- end
- return '' if return_comment
- return false
- end
- def view_charactor
- if [email protected]?
- for i in [email protected] - 1
- next if @list[i].code != 108
- if @list[i].parameters[0] = "显示头像"
- return true
- end
- end
- end
- return false
- end
- end
- #==============================================================================
- # ■ Game_MiniMap
- #------------------------------------------------------------------------------
- class Game_MiniMap
- def initialize(tilemap)
- @tilemap = tilemap
- refresh
- end
- def dispose
- @border.bitmap.dispose
- @border.dispose
- @map_sprite.bitmap.dispose
- @map_sprite.dispose
- @object_sprite.bitmap.dispose
- @object_sprite.dispose
- @position_sprite.bitmap.dispose
- @position_sprite.dispose
- end
- def visible
- return @map_sprite.visible
- end
- def visible=(value)
- @map_sprite.visible = value
- @object_sprite.visible = value
- @position_sprite.visible = value
- @border.visible = value
- end
- def refresh
- @mmr = $game_system.minimap
- map_rect = Rect.new(@mmr[0], @mmr[1], @mmr[2], @mmr[3])
- grid_size = [MiniMap::GRID_SIZE, 1].max
- @x = 0
- @y = 0
- @size = [map_rect.width / grid_size, map_rect.height / grid_size]
- @border = Sprite.new
- @border.x = map_rect.x - MiniMap::MINIMAP_BORDER_SIZE
- @border.y = map_rect.y - MiniMap::MINIMAP_BORDER_SIZE
- b_width = map_rect.width + MiniMap::MINIMAP_BORDER_SIZE
- b_height = map_rect.height + MiniMap::MINIMAP_BORDER_SIZE
- @border.bitmap = Bitmap.new(b_width, b_height)
- @border.bitmap.fill_rect(@border.bitmap.rect, MiniMap::MINIMAP_BORDER_COLOR)
- @border.bitmap.clear_rect(MiniMap::MINIMAP_BORDER_SIZE, MiniMap::MINIMAP_BORDER_SIZE,
- @border.bitmap.width - (MiniMap::MINIMAP_BORDER_SIZE * 2),
- @border.bitmap.height - (MiniMap::MINIMAP_BORDER_SIZE * 2))
-
- @map_sprite = Sprite.new
- @map_sprite.x = map_rect.x
- @map_sprite.y = map_rect.y
- @map_sprite.z = MiniMap::MAP_Z
- bitmap_width = $game_map.width * grid_size + map_rect.width
- bitmap_height = $game_map.height * grid_size + map_rect.height
- @map_sprite.bitmap = Bitmap.new(bitmap_width, bitmap_height)
- @map_sprite.src_rect = map_rect
- @object_sprite = Sprite.new
- @object_sprite.x = map_rect.x
- @object_sprite.y = map_rect.y
- @object_sprite.z = MiniMap::MAP_Z + 1
- @object_sprite.bitmap = Bitmap.new(bitmap_width, bitmap_height)
- @object_sprite.src_rect = map_rect
- @object_sprite1 = {}
-
- @position_sprite = Sprite_Base.new
- @position_sprite.x = map_rect.x + @size[0] / 2 * grid_size
- @position_sprite.y = map_rect.y + @size[1] / 2 * grid_size
- @position_sprite.z = MiniMap::MAP_Z + 2
-
- bitmap = Bitmap.new(grid_size, grid_size)
- # Player's Outline
- if MiniMap::USE_OUTLINE_PLAYER and MiniMap::GRID_SIZE >= 3
- bitmap.fill_rect(bitmap.rect, MiniMap::PLAYER_OUTLINE_COLOR)
- brect = Rect.new(bitmap.rect.x + 1, bitmap.rect.y + 1, bitmap.rect.width - 2,
- bitmap.rect.height - 2)
- bitmap.clear_rect(brect)
- else
- brect = bitmap.rect
- end
-
- bitmap.fill_rect(brect, MiniMap::PLAYER_COLOR)
- @position_sprite.bitmap = bitmap
- draw_map
- update_object_list
- draw_object
- update_position
- end
- def draw_map
- bitmap = @map_sprite.bitmap
- bitmap.fill_rect(bitmap.rect, MiniMap::BACKGROUND_COLOR)
- map_rect = Rect.new(@mmr[0], @mmr[1], @mmr[2], @mmr[3])
- grid_size = [MiniMap::GRID_SIZE, 1].max
-
- $game_map.width.times do |i|
- $game_map.height.times do |j|
- if !$game_map.passable?(i, j)
- next
- end
- rect = Rect.new(map_rect.width / 2 + grid_size * i,
- map_rect.height / 2 + grid_size * j,
- grid_size, grid_size)
- if grid_size >= 3
- if !$game_map.passable?(i, j)
- rect.height -= 1
- rect.x += 1
- rect.width -= 1
- rect.width -= 1
- rect.y += 1
- rect.height -= 1
- end
- end
- bitmap.fill_rect(rect, MiniMap::FOREGROUND_COLOR)
- end
- end
- end
- def update_object_list
- @object_list = {}
- $game_map.events.values.each do |e|
- comment = e.mm_comment?(MiniMap::TAG_EVENT, true)
- if comment != ''
- #type = comment.gsub(/#{MiniMap::TAG_EVENT}/){}.gsub(/\s+/){}
- type = comment
- @object_list[type] = [] if @object_list[type].nil?
- @object_list[type] << e
- end
- end
- end
- def draw_object
- bitmap = @object_sprite.bitmap
- bitmap.clear
- map_rect = Rect.new(@mmr[0], @mmr[1], @mmr[2], @mmr[3])
- grid_size = [MiniMap::GRID_SIZE, 1].max
- rect = Rect.new(0, 0, grid_size, grid_size)
- mw = map_rect.width / 2
- mh = map_rect.height / 2
- @object_list.each do |key, events|
- color = MiniMap::OBJECT_COLOR[key]
- next if events.nil? or color.nil?
- events.each do |obj|
- if !obj.character_name.empty?
- obj_pic = obj.character_name
- end
- rect.x = mw + obj.real_x * grid_size / 256
- rect.y = mh + obj.real_y * grid_size / 256
- # Event's Outline
- if MiniMap::USE_OUTLINE_EVENT and MiniMap::GRID_SIZE >= 3
- bitmap.fill_rect(rect, MiniMap::EVENT_OUTLINE_COLOR)
- brect = Rect.new(rect.x + 1, rect.y + 1, rect.width - 2,
- rect.height - 2)
- if obj_pic != nil and obj.view_charactor
- @object_sprite1[obj].dispose if @object_sprite1[obj] != nil
- @object_sprite1[obj] = Sprite.new
- #p rect.x,rect.y,brect.x,brect.y
- @object_sprite1[obj].x = map_rect.x + rect.x
- @object_sprite1[obj].y = map_rect.y + rect.y
- @object_sprite1[obj].z = MiniMap::MAP_Z + 1
- @object_sprite1[obj].bitmap = Cache.character(obj_pic)
- @object_sprite1[obj].zoom_x ,@object_sprite1[obj].zoom_y = MiniMap::EVENT_CHARACTOR_ZOOM , MiniMap::EVENT_CHARACTOR_ZOOM
- sign = obj_pic[/^[\!\$]./]
- if sign != nil and sign.include?('$')
- cw = bitmap.width / 3
- ch = bitmap.height / 4
- else
- cw = bitmap.width / 12
- ch = bitmap.height / 8
- end
- @object_sprite1[obj].ox = cw / 2
- @object_sprite1[obj].oy = ch
- @object_sprite1[obj].src_rect.set(0, 0, 2*cw, 1.1*ch*MiniMap::EVENT_CHARACTOR_H)
- #brect1 = Rect.new(rect.x + 1, rect.y + 1, rect.width - 2, rect.height - 2)
- #@object_sprite1[obj].src_rect = map_rect
- end
- else
- brect = bitmap.rect
- end
- bitmap.fill_rect(brect, color)
- #end
- end
- end
- end
- def update
- if @mmr != $game_system.minimap
- dispose
- refresh
- end
- draw_object
- update_position
- if @map_sprite.visible
- @map_sprite.update
- @object_sprite.update
- for obj in @object_sprite1.values
- obj.update
- end
- @position_sprite.update
- end
- end
- def update_position
- map_rect = Rect.new(@mmr[0], @mmr[1], @mmr[2], @mmr[3])
- grid_size = [MiniMap::GRID_SIZE, 1].max
- sx = $game_player.real_x * grid_size / 256
- sy = $game_player.real_y * grid_size / 256
- @map_sprite.src_rect.x = sx
- @map_sprite.src_rect.y = sy
- a = @object_sprite.x - sx ; b = @object_sprite.y - sy
- @object_sprite.src_rect.x = sx
- @object_sprite.src_rect.y = sy
- for obj in @object_sprite1.values
- obj.x += a - map_rect.x + MiniMap::EVENT_CHARACTOR_X
- obj.y += b - map_rect.y + MiniMap::EVENT_CHARACTOR_Y
- end
- end
- end
- #==============================================================================
- # ■ Spriteset_Map
- #------------------------------------------------------------------------------
- class Spriteset_Map
- attr_reader :minimap
- alias wora_minimap_sprsetmap_ini initialize
- alias wora_minimap_sprsetmap_dis dispose
- alias wora_minimap_sprsetmap_upd update
-
- def initialize
- wora_minimap_sprsetmap_ini
- if $game_map.show_minimap?
- @minimap = Game_MiniMap.new(@tilemap)
- $game_system.show_minimap = true if $game_system.show_minimap.nil?
- @minimap.visible = $game_system.show_minimap
- end
- end
-
- def dispose
- @minimap.dispose if [email protected]?
- wora_minimap_sprsetmap_dis
- end
- def update
- if [email protected]?
- if $game_system.show_minimap
- @minimap.visible = true
- @minimap.update
- else
- @minimap.visible = false
- end
- end
- wora_minimap_sprsetmap_upd
- end
- end
- #==============================================================================
- # ■ Scene_Map
- #------------------------------------------------------------------------------
- class Scene_Map < Scene_Base
- attr_reader :spriteset
- end
复制代码
XP版
- #===============================================================
- # ● [VX] ◦迷你地图 ◦ □
- # * 无须图片的迷你地图脚本,浪使者倾情汉化 *
- #--------------------------------------------------------------
- # ◦ by Woratana [原作者]
- # ◦ 用于 RPG Maker VX
- # ◦ 最近更新: 09/06/2008
- # ◦ 版本: 1.0 Beta
- #--------------------------------------------------------------
- # ◦ 特别感谢: KGC 的 XP 迷你地图脚本,
- # 没有他的迷你地图脚本,这个就不会被做出来.
- #--------------------------------------------------------------
- module MiniMap
- #===========================================================================
- # [START]迷你地图脚本设置部分 地图名前+[NOMAP] 不显示
- #---------------------------------------------------------------------------
- SWITCH_NO_MINIMAP = 10 # 打开这个开关的话就不显示迷你地图
-
- MAP_RECT = [410, 20, 100, 100] # 迷你地图的大小和位置
- # [X, Y, Width, Height]
- # 你可以用调用脚本的方法任意改变他:
- # $game_system.minimap = [X, Y, Width, Height]
- MAP_Z = 0 # 迷你地图的Z轴
- # 增加这个数值,如果迷你地图显示在某些物体下面的话(被覆盖)。
- GRID_SIZE = 5 # 引导大小,建议数值大于3.
-
- MINIMAP_BORDER_COLOR = Color.new(0, 0, 255, 160) # 色彩设定
- # Color.new(Red, Green, Blue, Opacity)
- MINIMAP_BORDER_SIZE = 2
-
- FOREGROUND_COLOR = Color.new(224, 224, 255, 160) # 可通过物颜色
- BACKGROUND_COLOR = Color.new(220, 0, 0, 160) # 不可通过物颜色
- USE_OUTLINE_PLAYER = true # 是否描绘的角色?
- PLAYER_OUTLINE_COLOR = Color.new(0, 0, 0, 192) # 角色颜色
- USE_OUTLINE_EVENT = true # 是否描绘特殊事件?(如商人、敌人NPC等)
- EVENT_OUTLINE_COLOR = Color.new(255, 255, 255, 192) # 特殊事件颜色
- EVENT_CHARACTOR_ZOOM = 0.4 #显示头像的缩放比例
- EVENT_CHARACTOR_H = 0.6 #显示头像的大小比例 1为显示全身像 0.5为显示半身像
- EVENT_CHARACTOR_X = 2 #显示头像的X坐标
- EVENT_CHARACTOR_Y = 13 #显示头像的X坐标
- #要显示头像请再事件中加注释“显示头像”
-
- PLAYER_COLOR = Color.new(255, 0, 0, 192) # 角色颜色设定
- #---------------------------------------------------------------------------
- OBJECT_COLOR = {} # 不要改变或删除这一行!
- #===============================================================
- # * 设置关键字和颜色
- #---------------------------------------------------------------
- # ** 例如:
- # OBJECT_COLOR['keyword'] = Color.new(Red, Green, Blue, Opacity)
- #-------------------------------------------------------------
- # * 'keyword': 你想放到公共事件里来显示的颜色
- # ** 标记: 'keyword' 是很关键的!
- # * Color.new(...): 你需要的颜色
- # 你可输入 0 - 255 的可选色彩范围 (Red, Green, Blue, Opacity)
- #-------------------------------------------------------------
- OBJECT_COLOR['npc'] = Color.new(30,144,255,160)
- OBJECT_COLOR['treasure'] = Color.new(0,255,255,160)
- OBJECT_COLOR['enemy'] = Color.new(139,35,35,160)
- OBJECT_COLOR['merchant'] = Color.new(255,255,0,160)
-
- #===========================================================================
- # * [说明] 标签:
- #---------------------------------------------------------------------------
- # 改变这些关闭迷你地图 & 或设置显示迷你地图~
- #-----------------------------------------------------------------------
- TAG_NO_MINIMAP = '[NOMAP]'
- TAG_EVENT = ["npc","enemy","merchant","treasure"]
- #---------------------------------------------------------------------------
- #---------------------------------------------------------------------------
- # [END] 迷你地图脚本设置部分
- #===========================================================================
-
- def self.refresh
- if $scene.is_a?(Scene_Map)
- $scene.spriteset.minimap.refresh
- end
- end
-
- def self.update_object
- if $scene.is_a?(Scene_Map)
- $scene.spriteset.minimap.update_object_list
- end
- end
- end
- #==============================================================================
- # ■ RPG::MapInfo
- #==============================================================================
- class RPG::MapInfo
- def name
- return @name.gsub(/\[.*\]/) { }
- end
- def original_name
- return @name
- end
- def show_minimap?
- return [email protected]?(MiniMap::TAG_NO_MINIMAP)
- end
- end
- #==============================================================================
- # ■ Game_System
- #==============================================================================
- class Game_System
- attr_accessor :minimap
- alias wora_minimap_gamsys_ini initialize
-
- def initialize
- wora_minimap_gamsys_ini
- @minimap = MiniMap::MAP_RECT
- end
-
- def show_minimap
- return !$game_switches[MiniMap::SWITCH_NO_MINIMAP]
- end
- end
- #==============================================================================
- # ■ Game_Map
- #==============================================================================
- class Game_Map
- alias wora_minimap_gammap_setup setup
- def setup(map_id)
- wora_minimap_gammap_setup(map_id)
- @db_info = load_data('Data/MapInfos.rxdata') if @db_info.nil?
- @map_info = @db_info[map_id]
- end
-
- def show_minimap?
- return @map_info.show_minimap?
- end
- end
- #==============================================================================
- # ■ Game_Event
- #==============================================================================
- class Game_Event < Game_Character
- def mm_comment?(comment, return_comment = false )
- if [email protected]?
- for i in [email protected] - 1
- next if @list[i].code != 108
- if comment.include?(@list[i].parameters[0])
- return @list[i].parameters[0] if return_comment
- return true
- end
- end
- end
- return '' if return_comment
- return false
- end
- def view_charactor
- if [email protected]?
- for i in [email protected] - 1
- next if @list[i].code != 108
- if @list[i].parameters[0] = "显示头像"
- return true
- end
- end
- end
- return false
- end
- end
- #==============================================================================
- # ■ Game_MiniMap
- #------------------------------------------------------------------------------
- class Game_MiniMap
- def initialize(tilemap)
- @tilemap = tilemap
- refresh
- end
- def dispose
- @border.bitmap.dispose
- @border.dispose
- @map_sprite.bitmap.dispose
- @map_sprite.dispose
- @object_sprite.bitmap.dispose
- @object_sprite.dispose
- @position_sprite.bitmap.dispose
- @position_sprite.dispose
- end
- def visible
- return @map_sprite.visible
- end
- def visible=(value)
- @map_sprite.visible = value
- @object_sprite.visible = value
- @position_sprite.visible = value
- @border.visible = value
- end
- def refresh
- @mmr = $game_system.minimap
- map_rect = Rect.new(@mmr[0], @mmr[1], @mmr[2], @mmr[3])
- grid_size = [MiniMap::GRID_SIZE, 1].max
- @x = 0
- @y = 0
- @size = [map_rect.width / grid_size, map_rect.height / grid_size]
- @border = Sprite.new
- @border.x = map_rect.x - MiniMap::MINIMAP_BORDER_SIZE
- @border.y = map_rect.y - MiniMap::MINIMAP_BORDER_SIZE
- b_width = map_rect.width + MiniMap::MINIMAP_BORDER_SIZE
- b_height = map_rect.height + MiniMap::MINIMAP_BORDER_SIZE
- @border.bitmap = Bitmap.new(b_width, b_height)
- @border.bitmap.fill_rect(@border.bitmap.rect, MiniMap::MINIMAP_BORDER_COLOR)
- #@border.bitmap.clear_rect(MiniMap::MINIMAP_BORDER_SIZE, MiniMap::MINIMAP_BORDER_SIZE,
- #@border.bitmap.width - (MiniMap::MINIMAP_BORDER_SIZE * 2),
- #@border.bitmap.height - (MiniMap::MINIMAP_BORDER_SIZE * 2))
-
- @map_sprite = Sprite.new
- @map_sprite.x = map_rect.x
- @map_sprite.y = map_rect.y
- @map_sprite.z = MiniMap::MAP_Z
- bitmap_width = $game_map.width * grid_size + map_rect.width
- bitmap_height = $game_map.height * grid_size + map_rect.height
- @map_sprite.bitmap = Bitmap.new(bitmap_width, bitmap_height)
- @map_sprite.src_rect = map_rect
- @object_sprite = Sprite.new
- @object_sprite.x = map_rect.x
- @object_sprite.y = map_rect.y
- @object_sprite.z = MiniMap::MAP_Z + 1
- @object_sprite.bitmap = Bitmap.new(bitmap_width, bitmap_height)
- @object_sprite.src_rect = map_rect
- @object_sprite1 = {}
-
- @position_sprite = Sprite_Base.new
- @position_sprite.x = map_rect.x + @size[0] / 2 * grid_size
- @position_sprite.y = map_rect.y + @size[1] / 2 * grid_size
- @position_sprite.z = MiniMap::MAP_Z + 2
-
- bitmap = Bitmap.new(grid_size, grid_size)
- # Player's Outline
- if MiniMap::USE_OUTLINE_PLAYER and MiniMap::GRID_SIZE >= 3
- bitmap.fill_rect(bitmap.rect, MiniMap::PLAYER_OUTLINE_COLOR)
- brect = Rect.new(bitmap.rect.x + 1, bitmap.rect.y + 1, bitmap.rect.width - 2,
- bitmap.rect.height - 2)
- #bitmap.clear_rect(brect)
- else
- brect = bitmap.rect
- end
-
- bitmap.fill_rect(brect, MiniMap::PLAYER_COLOR)
- @position_sprite.bitmap = bitmap
- draw_map
- update_object_list
- draw_object
- update_position
- end
- def draw_map
- bitmap = @map_sprite.bitmap
- bitmap.fill_rect(bitmap.rect, MiniMap::BACKGROUND_COLOR)
- map_rect = Rect.new(@mmr[0], @mmr[1], @mmr[2], @mmr[3])
- grid_size = [MiniMap::GRID_SIZE, 1].max
-
- $game_map.width.times do |i|
- $game_map.height.times do |j|
- if !$game_map.passable?(i, j)
- next
- end
- rect = Rect.new(map_rect.width / 2 + grid_size * i,
- map_rect.height / 2 + grid_size * j,
- grid_size, grid_size)
- if grid_size >= 3
- if !$game_map.passable?(i, j)
- rect.height -= 1
- rect.x += 1
- rect.width -= 1
- rect.width -= 1
- rect.y += 1
- rect.height -= 1
- end
- end
- bitmap.fill_rect(rect, MiniMap::FOREGROUND_COLOR)
- end
- end
- end
- def update_object_list
- @object_list = {}
- $game_map.events.values.each do |e|
- comment = e.mm_comment?(MiniMap::TAG_EVENT, true)
- if comment != ''
- #type = comment.gsub(/#{MiniMap::TAG_EVENT}/){}.gsub(/\s+/){}
- type = comment
- @object_list[type] = [] if @object_list[type].nil?
- @object_list[type] << e
- end
- end
- end
- def draw_object
- bitmap = @object_sprite.bitmap
- bitmap.clear
- map_rect = Rect.new(@mmr[0], @mmr[1], @mmr[2], @mmr[3])
- grid_size = [MiniMap::GRID_SIZE, 1].max
- rect = Rect.new(0, 0, grid_size, grid_size)
- mw = map_rect.width / 2
- mh = map_rect.height / 2
- @object_list.each do |key, events|
- color = MiniMap::OBJECT_COLOR[key]
- next if events.nil? or color.nil?
- events.each do |obj|
- if !obj.character_name.empty?
- obj_pic = obj.character_name
- obj_hue = obj.character_hue
- end
- rect.x = mw + obj.real_x * grid_size / 256
- rect.y = mh + obj.real_y * grid_size / 256
- # Event's Outline
- if MiniMap::USE_OUTLINE_EVENT and MiniMap::GRID_SIZE >= 3
- bitmap.fill_rect(rect, MiniMap::EVENT_OUTLINE_COLOR)
- brect = Rect.new(rect.x + 1, rect.y + 1, rect.width - 2,
- rect.height - 2)
- if obj_pic != nil and obj.view_charactor
- @object_sprite1[obj].dispose if @object_sprite1[obj] != nil
- @object_sprite1[obj] = Sprite.new
- #p rect.x,rect.y,brect.x,brect.y
- @object_sprite1[obj].x = map_rect.x + rect.x
- @object_sprite1[obj].y = map_rect.y + rect.y
- @object_sprite1[obj].z = MiniMap::MAP_Z + 1
- @object_sprite1[obj].bitmap = RPG::Cache.character(obj_pic,obj_hue)
- @object_sprite1[obj].zoom_x ,@object_sprite1[obj].zoom_y = MiniMap::EVENT_CHARACTOR_ZOOM ,MiniMap::EVENT_CHARACTOR_ZOOM
- @cw = @object_sprite1[obj].bitmap.width / 4
- @ch = @object_sprite1[obj].bitmap.height / 4
- @object_sprite1[obj].ox = @cw / 2
- @object_sprite1[obj].oy = @ch
- @object_sprite1[obj].src_rect.set(0, 0, @cw, @ch*MiniMap::EVENT_CHARACTOR_H)
- #brect1 = Rect.new(rect.x + 1, rect.y + 1, rect.width - 2, rect.height - 2)
- #@object_sprite1[obj].src_rect = map_rect
- end
- #bitmap.clear_rect(brect)
- else
- #brect = bitmap.rect
- end
- bitmap.fill_rect(brect, color)
- #end
- end
- end
- end
- def update
- if @mmr != $game_system.minimap
- dispose
- refresh
- end
- draw_object
- update_position
- if @map_sprite.visible
- @map_sprite.update
- @object_sprite.update
- for obj in @object_sprite1.values
- obj.update
- end
- @position_sprite.update
- end
- end
- def update_position
- map_rect = Rect.new(@mmr[0], @mmr[1], @mmr[2], @mmr[3])
- grid_size = [MiniMap::GRID_SIZE, 1].max
- sx = $game_player.real_x * grid_size / 256
- sy = $game_player.real_y * grid_size / 256
- @map_sprite.src_rect.x = sx
- @map_sprite.src_rect.y = sy
- a = @object_sprite.x - sx ; b = @object_sprite.y - sy
- @object_sprite.src_rect.x = sx
- @object_sprite.src_rect.y = sy
- for obj in @object_sprite1.values
- obj.x += a - map_rect.x + MiniMap::EVENT_CHARACTOR_X
- obj.y += b - map_rect.y + MiniMap::EVENT_CHARACTOR_Y
- end
- end
- end
- #==============================================================================
- # ■ Spriteset_Map
- #------------------------------------------------------------------------------
- class Spriteset_Map
- attr_reader :minimap
- alias wora_minimap_sprsetmap_ini initialize
- alias wora_minimap_sprsetmap_dis dispose
- alias wora_minimap_sprsetmap_upd update
-
- def initialize
- wora_minimap_sprsetmap_ini
- if $game_map.show_minimap?
- @minimap = Game_MiniMap.new(@tilemap)
- $game_system.show_minimap = true if $game_system.show_minimap.nil?
- @minimap.visible = $game_system.show_minimap
- end
- end
-
- def dispose
- @minimap.dispose if [email protected]?
- wora_minimap_sprsetmap_dis
- end
- def update
- if [email protected]?
- if $game_system.show_minimap
- @minimap.visible = true
- @minimap.update
- else
- @minimap.visible = false
- end
- end
- wora_minimap_sprsetmap_upd
- end
- end
复制代码 |
|