设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1459|回复: 4
打印 上一主题 下一主题

求修改远景缩略图脚本 判断文件有无

 关闭 [复制链接]

Lv1.梦旅人

看不到我

梦石
0
星屑
50
在线时间
229 小时
注册时间
2005-11-6
帖子
1741

贵宾

跳转到指定楼层
1
发表于 2007-8-19 21:32:23 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
脚本如下:
功能为显示Icons下的图片 地图XX 为小地图
现修改要求为:当图片地图XX存在时,脚本才可工作,当图片地图XX不存在时,脚本不工作

  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================

  4. #==============================================================================
  5. # ■ 全景地图显示小地图
  6. #########################
  7. # by      sphinger      #
  8. #########################
  9. #==============================================================================
  10. #==============================================================================
  11. # □ 前期定义
  12. #==============================================================================
  13. module PLAN_Map_Window
  14.   WIN_X       = 480      # 窗口的初始 X 座標
  15.   WIN_Y       = 10       # 窗口的初始 Y 座標
  16.   WIN_WIDTH   = 160      # 地图的宽度
  17.   WIN_HEIGHT  = 120      # 地图的高度
  18.   ZOOM        = 32.0      # 地图的放缩比例
  19.   ZOOMP       = 1         # 小地图上角色的缩放(1为图片原来大小,往大调节时图片变小)
  20.   SHOWPLAYER  = false     # 是否显示角色,当为true时,小地图将显示角色为false时显示兰色的标记
  21.   PLAYCW      = 8         #当使用上面的显示角色时,这个用来设置,角色的横向帧数
  22.   PLAYCH      = 8         #当使用上面的显示角色时,这个用来设置,角色的综向帧数
  23.   WINDOWSKIN  = ""        # 自定义地图窗口素材,如果留空则是默认的

  24.   SWITCH      = 7         # 禁用地图功能的开关,默认这个就是打开7号开关则禁止
  25.                           # 使用地图功能,关闭则可以使用地图功能

  26.   WINDOW_MOVE = false     # 是否可以自动改变窗口位置(true:可改变, false:固定)
  27.   
  28.   OVER_X      = 480       # 自动改变后窗口的位置x
  29.   OVER_Y      = 0         #自动改变后窗口的位置y

  30.   OPACITY     = 0         # 窗口的透明度
  31.   C_OPACITY   = 192       # 地图的透明度
  32.   VISIBLE     = false     # 最初是否可见
  33. end
  34. #==============================================================================
  35. # ■ Game_Temp
  36. #==============================================================================
  37. class Game_Temp
  38.   attr_accessor  :map_visible     # 地图的表示状態
  39.   alias plan_map_window_initialize initialize
  40.   def initialize
  41.     plan_map_window_initialize
  42.     @map_visible = false
  43.   end
  44. end
  45. #==============================================================================
  46. # ■ Scene_Map
  47. #==============================================================================
  48. class Scene_Map
  49.   #--------------------------------------------------------------------------
  50.   # ● 主处理
  51.   #--------------------------------------------------------------------------
  52.   alias plan_map_window_main main
  53.   def main
  54.     @map_window         = Window_Map.new
  55.     @map_window.visible = $game_temp.map_visible
  56.     plan_map_window_main
  57.     @map_window.dispose
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # ● 更新
  61.   #--------------------------------------------------------------------------
  62.   alias plan_map_window_update update
  63.   def update
  64.     $game_temp.map_visible = @map_window.visible
  65.     plan_map_window_update
  66.     if $game_switches[PLAN_Map_Window::SWITCH]
  67.         @map_window.visible = true
  68.     else
  69.         @map_window.visible = false  
  70.     end
  71.     if @map_window.visible
  72.       @map_window.update
  73.     end
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● 场所移动的变化
  77.   #--------------------------------------------------------------------------
  78.   alias plan_map_window_transfer_player transfer_player
  79.   def transfer_player
  80.     visible = @map_window.visible
  81.     @map_window.visible = false
  82.     plan_map_window_transfer_player
  83.     @map_window.dispose
  84.     @map_window = Window_Map.new
  85.     @map_window.visible = visible
  86.   end
  87. end
  88. #==============================================================================
  89. # ■ Window_Map
  90. #==============================================================================
  91. class Window_Map < Window_Base
  92.   #--------------------------------------------------------------------------
  93.   # ● 初始化
  94.   #--------------------------------------------------------------------------
  95.   def initialize
  96.     x = PLAN_Map_Window::WIN_X
  97.     y = PLAN_Map_Window::WIN_Y
  98.     w = PLAN_Map_Window::WIN_WIDTH
  99.     h = PLAN_Map_Window::WIN_HEIGHT
  100.     super(x, y, w, h)
  101.     unless PLAN_Map_Window::WINDOWSKIN.empty?
  102.       self.windowskin = RPG::Cache.windowskin(PLAN_Map_Window::WINDOWSKIN)
  103.     end
  104.     self.contents = Bitmap.new(width - 32, height - 32)
  105.     self.opacity = PLAN_Map_Window::OPACITY
  106.     self.contents_opacity = PLAN_Map_Window::C_OPACITY
  107.     @old_real_x = $game_player.real_x
  108.     @old_real_y = $game_player.real_y
  109.     @all_map = make_all_map
  110.     self.visible = PLAN_Map_Window::VISIBLE
  111.     refresh
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # ● 缩小图做成
  115.   #--------------------------------------------------------------------------
  116.   def make_all_map
  117.     all_map = RPG::Cache.icon("地图" + $game_map.map_id.to_s)
  118.     cw = $game_map.width * 32
  119.     ch = $game_map.height * 32
  120.     src_rect = Rect.new(0, 0, cw, ch)
  121.     self.contents.blt(0 , 0, all_map, src_rect)
  122.     w = ($game_map.width / PLAN_Map_Window::ZOOM) * 32
  123.     h = ($game_map.height / PLAN_Map_Window::ZOOM) * 32
  124.     ret_bitmap = Bitmap.new(w, h)
  125.     src_rect = Rect.new(0, 0, all_map.width, all_map.height)
  126.     dest_rect = Rect.new(0, 0, ret_bitmap.width, ret_bitmap.height)
  127.     ret_bitmap.stretch_blt(dest_rect, all_map, src_rect)
  128.     all_map.dispose
  129.     return ret_bitmap
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # ● 刷新
  133.   #--------------------------------------------------------------------------
  134.   def refresh
  135.     self.contents.clear
  136.     one_tile_size = 32 / PLAN_Map_Window::ZOOM
  137.     x = $game_player.real_x - 64 * (self.contents.width / one_tile_size) / 2
  138.     y = $game_player.real_y - 64 * (self.contents.height / one_tile_size) / 2
  139.     x = x * one_tile_size / 64
  140.     y = y * one_tile_size / 64
  141.     half_width = self.contents.width * 64 / 2
  142.     rest_width = ($game_map.width * 64 - $game_player.real_x) * one_tile_size
  143.     rev_x = 0
  144.     if @all_map.width < self.contents.width
  145.       rev_x = (half_width - $game_player.real_x * one_tile_size) / 64
  146.       rev_x -= (self.contents.width - @all_map.width) / 2
  147.       x += rev_x
  148.     elsif half_width > $game_player.real_x * one_tile_size
  149.       rev_x = (half_width - $game_player.real_x * one_tile_size) / 64
  150.       x += rev_x
  151.     elsif half_width > rest_width
  152.       rev_x = -((half_width - rest_width) / 64)
  153.       x += rev_x
  154.     end
  155.     half_height = self.contents.height * 64 / 2
  156.     rest_height = ($game_map.height * 64 - $game_player.real_y) * one_tile_size
  157.     rev_y = 0
  158.     if @all_map.height < self.contents.height
  159.       rev_y = (half_height - $game_player.real_y * one_tile_size) / 64
  160.       rev_y -= (self.contents.height - @all_map.height) / 2
  161.       y += rev_y
  162.     elsif half_height > $game_player.real_y * one_tile_size
  163.       rev_y = (half_height - $game_player.real_y * one_tile_size) / 64
  164.       y += rev_y
  165.     elsif half_height > rest_height
  166.       rev_y = -((half_height - rest_height) / 64)
  167.       y += rev_y
  168.     end
  169.     src_rect = Rect.new(x, y, self.contents.width, self.contents.height)
  170.     self.contents.blt(0, 0, @all_map, src_rect)
  171.     if PLAN_Map_Window::WINDOW_MOVE == true
  172.       wr = PLAN_Map_Window::WIN_X + self.width
  173.       wl = PLAN_Map_Window::WIN_X
  174.       ht = PLAN_Map_Window::WIN_Y
  175.       he = PLAN_Map_Window::WIN_Y + self.height
  176.       if $game_player.screen_x >= wl and $game_player.screen_x <= wr
  177.         if $game_player.screen_y >= ht and $game_player.screen_y <= he
  178.           self.x = PLAN_Map_Window::OVER_X
  179.           self.y = PLAN_Map_Window::OVER_Y
  180.         else
  181.           self.x = PLAN_Map_Window::WIN_X
  182.           self.y = PLAN_Map_Window::WIN_Y
  183.         end
  184.       else
  185.         self.x = PLAN_Map_Window::WIN_X
  186.         self.y = PLAN_Map_Window::WIN_Y
  187.       end
  188.     end
  189.     if $game_party.actors.size > 0
  190.       actor = $game_party.actors[0]
  191.       if PLAN_Map_Window::SHOWPLAYER
  192.       bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  193.       width = bitmap.width / PLAN_Map_Window::PLAYCW
  194.       height = bitmap.height / PLAN_Map_Window::PLAYCH
  195.       src_rect = Rect.new(0, 0, width, height)
  196.       w = width / $game_variables[30]
  197.       h = height / $game_variables[30]
  198.       else
  199.       bitmap = RPG::Cache.icon("方向" + $game_player.direction.to_s)
  200.       width = bitmap.width / PLAN_Map_Window::ZOOMP
  201.       height = bitmap.height / PLAN_Map_Window::ZOOMP
  202.       src_rect = Rect.new(0, 0, width, height)
  203.       w = width
  204.       h = height
  205.       end
  206.       x = self.contents.width / 2 - w / 2 + one_tile_size / 2 - rev_x
  207.       y = self.contents.height / 2 - h / 2 - rev_y
  208.       dest_rect = Rect.new(x, y, w, h)
  209.       self.contents.stretch_blt(dest_rect, bitmap, src_rect)
  210.     end
  211.   end
  212.   #--------------------------------------------------------------------------
  213.   # ● 更新
  214.   #--------------------------------------------------------------------------
  215.   def update
  216.     super
  217.     if @old_real_x != $game_player.real_x or @old_real_y != $game_player.real_y
  218.       @old_real_x = $game_player.real_x
  219.       @old_real_y = $game_player.real_y
  220.       refresh
  221.     end
  222.   end
  223.   #--------------------------------------------------------------------------
  224.   # ● 释放
  225.   #--------------------------------------------------------------------------
  226.   def dispose
  227.     super
  228.     @all_map.dispose
  229.   end
  230. end

  231. #==============================================================================
  232. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  233. #==============================================================================  
复制代码



此贴于 2007-8-19 15:13:21 被版主K’提醒,请楼主看到后对本贴做出回应。
版务信息:本贴由楼主自主结贴~

Lv1.梦旅人

看不到我

梦石
0
星屑
50
在线时间
229 小时
注册时间
2005-11-6
帖子
1741

贵宾

2
 楼主| 发表于 2007-8-19 21:32:23 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
脚本如下:
功能为显示Icons下的图片 地图XX 为小地图
现修改要求为:当图片地图XX存在时,脚本才可工作,当图片地图XX不存在时,脚本不工作

  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================

  4. #==============================================================================
  5. # ■ 全景地图显示小地图
  6. #########################
  7. # by      sphinger      #
  8. #########################
  9. #==============================================================================
  10. #==============================================================================
  11. # □ 前期定义
  12. #==============================================================================
  13. module PLAN_Map_Window
  14.   WIN_X       = 480      # 窗口的初始 X 座標
  15.   WIN_Y       = 10       # 窗口的初始 Y 座標
  16.   WIN_WIDTH   = 160      # 地图的宽度
  17.   WIN_HEIGHT  = 120      # 地图的高度
  18.   ZOOM        = 32.0      # 地图的放缩比例
  19.   ZOOMP       = 1         # 小地图上角色的缩放(1为图片原来大小,往大调节时图片变小)
  20.   SHOWPLAYER  = false     # 是否显示角色,当为true时,小地图将显示角色为false时显示兰色的标记
  21.   PLAYCW      = 8         #当使用上面的显示角色时,这个用来设置,角色的横向帧数
  22.   PLAYCH      = 8         #当使用上面的显示角色时,这个用来设置,角色的综向帧数
  23.   WINDOWSKIN  = ""        # 自定义地图窗口素材,如果留空则是默认的

  24.   SWITCH      = 7         # 禁用地图功能的开关,默认这个就是打开7号开关则禁止
  25.                           # 使用地图功能,关闭则可以使用地图功能

  26.   WINDOW_MOVE = false     # 是否可以自动改变窗口位置(true:可改变, false:固定)
  27.   
  28.   OVER_X      = 480       # 自动改变后窗口的位置x
  29.   OVER_Y      = 0         #自动改变后窗口的位置y

  30.   OPACITY     = 0         # 窗口的透明度
  31.   C_OPACITY   = 192       # 地图的透明度
  32.   VISIBLE     = false     # 最初是否可见
  33. end
  34. #==============================================================================
  35. # ■ Game_Temp
  36. #==============================================================================
  37. class Game_Temp
  38.   attr_accessor  :map_visible     # 地图的表示状態
  39.   alias plan_map_window_initialize initialize
  40.   def initialize
  41.     plan_map_window_initialize
  42.     @map_visible = false
  43.   end
  44. end
  45. #==============================================================================
  46. # ■ Scene_Map
  47. #==============================================================================
  48. class Scene_Map
  49.   #--------------------------------------------------------------------------
  50.   # ● 主处理
  51.   #--------------------------------------------------------------------------
  52.   alias plan_map_window_main main
  53.   def main
  54.     @map_window         = Window_Map.new
  55.     @map_window.visible = $game_temp.map_visible
  56.     plan_map_window_main
  57.     @map_window.dispose
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # ● 更新
  61.   #--------------------------------------------------------------------------
  62.   alias plan_map_window_update update
  63.   def update
  64.     $game_temp.map_visible = @map_window.visible
  65.     plan_map_window_update
  66.     if $game_switches[PLAN_Map_Window::SWITCH]
  67.         @map_window.visible = true
  68.     else
  69.         @map_window.visible = false  
  70.     end
  71.     if @map_window.visible
  72.       @map_window.update
  73.     end
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● 场所移动的变化
  77.   #--------------------------------------------------------------------------
  78.   alias plan_map_window_transfer_player transfer_player
  79.   def transfer_player
  80.     visible = @map_window.visible
  81.     @map_window.visible = false
  82.     plan_map_window_transfer_player
  83.     @map_window.dispose
  84.     @map_window = Window_Map.new
  85.     @map_window.visible = visible
  86.   end
  87. end
  88. #==============================================================================
  89. # ■ Window_Map
  90. #==============================================================================
  91. class Window_Map < Window_Base
  92.   #--------------------------------------------------------------------------
  93.   # ● 初始化
  94.   #--------------------------------------------------------------------------
  95.   def initialize
  96.     x = PLAN_Map_Window::WIN_X
  97.     y = PLAN_Map_Window::WIN_Y
  98.     w = PLAN_Map_Window::WIN_WIDTH
  99.     h = PLAN_Map_Window::WIN_HEIGHT
  100.     super(x, y, w, h)
  101.     unless PLAN_Map_Window::WINDOWSKIN.empty?
  102.       self.windowskin = RPG::Cache.windowskin(PLAN_Map_Window::WINDOWSKIN)
  103.     end
  104.     self.contents = Bitmap.new(width - 32, height - 32)
  105.     self.opacity = PLAN_Map_Window::OPACITY
  106.     self.contents_opacity = PLAN_Map_Window::C_OPACITY
  107.     @old_real_x = $game_player.real_x
  108.     @old_real_y = $game_player.real_y
  109.     @all_map = make_all_map
  110.     self.visible = PLAN_Map_Window::VISIBLE
  111.     refresh
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # ● 缩小图做成
  115.   #--------------------------------------------------------------------------
  116.   def make_all_map
  117.     all_map = RPG::Cache.icon("地图" + $game_map.map_id.to_s)
  118.     cw = $game_map.width * 32
  119.     ch = $game_map.height * 32
  120.     src_rect = Rect.new(0, 0, cw, ch)
  121.     self.contents.blt(0 , 0, all_map, src_rect)
  122.     w = ($game_map.width / PLAN_Map_Window::ZOOM) * 32
  123.     h = ($game_map.height / PLAN_Map_Window::ZOOM) * 32
  124.     ret_bitmap = Bitmap.new(w, h)
  125.     src_rect = Rect.new(0, 0, all_map.width, all_map.height)
  126.     dest_rect = Rect.new(0, 0, ret_bitmap.width, ret_bitmap.height)
  127.     ret_bitmap.stretch_blt(dest_rect, all_map, src_rect)
  128.     all_map.dispose
  129.     return ret_bitmap
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # ● 刷新
  133.   #--------------------------------------------------------------------------
  134.   def refresh
  135.     self.contents.clear
  136.     one_tile_size = 32 / PLAN_Map_Window::ZOOM
  137.     x = $game_player.real_x - 64 * (self.contents.width / one_tile_size) / 2
  138.     y = $game_player.real_y - 64 * (self.contents.height / one_tile_size) / 2
  139.     x = x * one_tile_size / 64
  140.     y = y * one_tile_size / 64
  141.     half_width = self.contents.width * 64 / 2
  142.     rest_width = ($game_map.width * 64 - $game_player.real_x) * one_tile_size
  143.     rev_x = 0
  144.     if @all_map.width < self.contents.width
  145.       rev_x = (half_width - $game_player.real_x * one_tile_size) / 64
  146.       rev_x -= (self.contents.width - @all_map.width) / 2
  147.       x += rev_x
  148.     elsif half_width > $game_player.real_x * one_tile_size
  149.       rev_x = (half_width - $game_player.real_x * one_tile_size) / 64
  150.       x += rev_x
  151.     elsif half_width > rest_width
  152.       rev_x = -((half_width - rest_width) / 64)
  153.       x += rev_x
  154.     end
  155.     half_height = self.contents.height * 64 / 2
  156.     rest_height = ($game_map.height * 64 - $game_player.real_y) * one_tile_size
  157.     rev_y = 0
  158.     if @all_map.height < self.contents.height
  159.       rev_y = (half_height - $game_player.real_y * one_tile_size) / 64
  160.       rev_y -= (self.contents.height - @all_map.height) / 2
  161.       y += rev_y
  162.     elsif half_height > $game_player.real_y * one_tile_size
  163.       rev_y = (half_height - $game_player.real_y * one_tile_size) / 64
  164.       y += rev_y
  165.     elsif half_height > rest_height
  166.       rev_y = -((half_height - rest_height) / 64)
  167.       y += rev_y
  168.     end
  169.     src_rect = Rect.new(x, y, self.contents.width, self.contents.height)
  170.     self.contents.blt(0, 0, @all_map, src_rect)
  171.     if PLAN_Map_Window::WINDOW_MOVE == true
  172.       wr = PLAN_Map_Window::WIN_X + self.width
  173.       wl = PLAN_Map_Window::WIN_X
  174.       ht = PLAN_Map_Window::WIN_Y
  175.       he = PLAN_Map_Window::WIN_Y + self.height
  176.       if $game_player.screen_x >= wl and $game_player.screen_x <= wr
  177.         if $game_player.screen_y >= ht and $game_player.screen_y <= he
  178.           self.x = PLAN_Map_Window::OVER_X
  179.           self.y = PLAN_Map_Window::OVER_Y
  180.         else
  181.           self.x = PLAN_Map_Window::WIN_X
  182.           self.y = PLAN_Map_Window::WIN_Y
  183.         end
  184.       else
  185.         self.x = PLAN_Map_Window::WIN_X
  186.         self.y = PLAN_Map_Window::WIN_Y
  187.       end
  188.     end
  189.     if $game_party.actors.size > 0
  190.       actor = $game_party.actors[0]
  191.       if PLAN_Map_Window::SHOWPLAYER
  192.       bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  193.       width = bitmap.width / PLAN_Map_Window::PLAYCW
  194.       height = bitmap.height / PLAN_Map_Window::PLAYCH
  195.       src_rect = Rect.new(0, 0, width, height)
  196.       w = width / $game_variables[30]
  197.       h = height / $game_variables[30]
  198.       else
  199.       bitmap = RPG::Cache.icon("方向" + $game_player.direction.to_s)
  200.       width = bitmap.width / PLAN_Map_Window::ZOOMP
  201.       height = bitmap.height / PLAN_Map_Window::ZOOMP
  202.       src_rect = Rect.new(0, 0, width, height)
  203.       w = width
  204.       h = height
  205.       end
  206.       x = self.contents.width / 2 - w / 2 + one_tile_size / 2 - rev_x
  207.       y = self.contents.height / 2 - h / 2 - rev_y
  208.       dest_rect = Rect.new(x, y, w, h)
  209.       self.contents.stretch_blt(dest_rect, bitmap, src_rect)
  210.     end
  211.   end
  212.   #--------------------------------------------------------------------------
  213.   # ● 更新
  214.   #--------------------------------------------------------------------------
  215.   def update
  216.     super
  217.     if @old_real_x != $game_player.real_x or @old_real_y != $game_player.real_y
  218.       @old_real_x = $game_player.real_x
  219.       @old_real_y = $game_player.real_y
  220.       refresh
  221.     end
  222.   end
  223.   #--------------------------------------------------------------------------
  224.   # ● 释放
  225.   #--------------------------------------------------------------------------
  226.   def dispose
  227.     super
  228.     @all_map.dispose
  229.   end
  230. end

  231. #==============================================================================
  232. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  233. #==============================================================================  
复制代码



此贴于 2007-8-19 15:13:21 被版主K’提醒,请楼主看到后对本贴做出回应。
版务信息:本贴由楼主自主结贴~

Lv2.观梦者

梦石
0
星屑
431
在线时间
125 小时
注册时间
2006-11-2
帖子
1200
3
发表于 2007-8-19 23:13:12 | 只看该作者
文件存在检测函数貌似不支持中文

所以 。。必须把文件名中 "地图" 改成 "map"

还有 文件格式最好统一 这个是JPG 如果你用的PNG 要在脚本修改相关部分

没素材,小湖自己测试下吧。{/hx}


  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================

  4. #==============================================================================
  5. # ■ 全景地图显示小地图
  6. #########################
  7. # by      sphinger      #
  8. #########################
  9. #==============================================================================
  10. #==============================================================================
  11. # □ 前期定义
  12. #==============================================================================
  13. module PLAN_Map_Window
  14. WIN_X       = 480      # 窗口的初始 X 座標
  15. WIN_Y       = 10       # 窗口的初始 Y 座標
  16. WIN_WIDTH   = 160      # 地图的宽度
  17. WIN_HEIGHT  = 120      # 地图的高度
  18. ZOOM        = 32.0      # 地图的放缩比例
  19. ZOOMP       = 1         # 小地图上角色的缩放(1为图片原来大小,往大调节时图片变小)
  20. SHOWPLAYER  = false     # 是否显示角色,当为true时,小地图将显示角色为false时显示兰色的标记
  21. PLAYCW      = 8         #当使用上面的显示角色时,这个用来设置,角色的横向帧数
  22. PLAYCH      = 8         #当使用上面的显示角色时,这个用来设置,角色的综向帧数
  23. WINDOWSKIN  = ""        # 自定义地图窗口素材,如果留空则是默认的

  24. SWITCH      = 7         # 禁用地图功能的开关,默认这个就是打开7号开关则禁止
  25.                          # 使用地图功能,关闭则可以使用地图功能

  26. WINDOW_MOVE = false     # 是否可以自动改变窗口位置(true:可改变, false:固定)

  27. OVER_X      = 480       # 自动改变后窗口的位置x
  28. OVER_Y      = 0         #自动改变后窗口的位置y

  29. OPACITY     = 0         # 窗口的透明度
  30. C_OPACITY   = 192       # 地图的透明度
  31. VISIBLE     = false     # 最初是否可见
  32. end
  33. #==============================================================================
  34. # ■ Game_Temp
  35. #==============================================================================
  36. class Game_Temp
  37. attr_accessor  :map_visible     # 地图的表示状態
  38. alias plan_map_window_initialize initialize
  39. def initialize
  40.    plan_map_window_initialize
  41.    @map_visible = false
  42. end
  43. end
  44. #==============================================================================
  45. # ■ Scene_Map
  46. #==============================================================================
  47. class Scene_Map
  48. #--------------------------------------------------------------------------
  49. # ● 主处理
  50. #--------------------------------------------------------------------------
  51. alias plan_map_window_main main
  52. def main
  53.    if  FileTest.exist?("Graphics/Icons/map" + $game_map.map_id.to_s + ".jpg")
  54.    @map_window         = Window_Map.new
  55.    @map_window.visible = $game_temp.map_visible
  56.    end
  57.    
  58.    plan_map_window_main
  59.    if !@map_window.nil?
  60.    @map_window.dispose
  61.    @map_window = nil
  62.    end
  63. end
  64. #--------------------------------------------------------------------------
  65. # ● 更新
  66. #--------------------------------------------------------------------------
  67. alias plan_map_window_update update
  68. def update
  69.    $game_temp.map_visible = @map_window.visible if  !@map_window.nil?
  70.    plan_map_window_update
  71.    if !@map_window.nil?
  72.    if $game_switches[PLAN_Map_Window::SWITCH]
  73.        @map_window.visible = true
  74.    else
  75.        @map_window.visible = false  
  76.      end
  77.       if @map_window.visible
  78.      @map_window.update
  79.    end

  80. end
  81. end

  82. #--------------------------------------------------------------------------
  83. # ● 场所移动的变化
  84. #--------------------------------------------------------------------------
  85. alias plan_map_window_transfer_player transfer_player
  86. def transfer_player
  87.    if !@map_window.nil?
  88.    visible = @map_window.visible
  89.    @map_window.visible = false
  90.    end
  91.    plan_map_window_transfer_player
  92.    if !@map_window.nil?
  93.    @map_window.dispose
  94.    @map_window = nil
  95.    end
  96.    if  FileTest.exist?("Graphics/Icons/map" + $game_map.map_id.to_s + ".jpg")
  97.    @map_window = Window_Map.new
  98.    @map_window.visible = visible == nil ? true : visible
  99. end
  100. end
  101. end
  102. #==============================================================================
  103. # ■ Window_Map
  104. #==============================================================================
  105. class Window_Map < Window_Base
  106. #--------------------------------------------------------------------------
  107. # ● 初始化
  108. #--------------------------------------------------------------------------
  109. def initialize
  110.    x = PLAN_Map_Window::WIN_X
  111.    y = PLAN_Map_Window::WIN_Y
  112.    w = PLAN_Map_Window::WIN_WIDTH
  113.    h = PLAN_Map_Window::WIN_HEIGHT
  114.    super(x, y, w, h)
  115.    unless PLAN_Map_Window::WINDOWSKIN.empty?
  116.      self.windowskin = RPG::Cache.windowskin(PLAN_Map_Window::WINDOWSKIN)
  117.    end
  118.    self.contents = Bitmap.new(width - 32, height - 32)
  119.    self.opacity = PLAN_Map_Window::OPACITY
  120.    self.contents_opacity = PLAN_Map_Window::C_OPACITY
  121.    @old_real_x = $game_player.real_x
  122.    @old_real_y = $game_player.real_y
  123.    @all_map = make_all_map
  124.    self.visible = PLAN_Map_Window::VISIBLE
  125.    refresh
  126. end
  127. #--------------------------------------------------------------------------
  128. # ● 缩小图做成
  129. #--------------------------------------------------------------------------
  130. def make_all_map
  131.    
  132.    all_map = RPG::Cache.icon("map" + $game_map.map_id.to_s)
  133.    cw = $game_map.width * 32
  134.    ch = $game_map.height * 32
  135.    src_rect = Rect.new(0, 0, cw, ch)
  136.    self.contents.blt(0 , 0, all_map, src_rect)
  137.    w = ($game_map.width / PLAN_Map_Window::ZOOM) * 32
  138.    h = ($game_map.height / PLAN_Map_Window::ZOOM) * 32
  139.    ret_bitmap = Bitmap.new(w, h)
  140.    src_rect = Rect.new(0, 0, all_map.width, all_map.height)
  141.    dest_rect = Rect.new(0, 0, ret_bitmap.width, ret_bitmap.height)
  142.    ret_bitmap.stretch_blt(dest_rect, all_map, src_rect)
  143.    all_map.dispose
  144.    return ret_bitmap
  145. end
  146. #--------------------------------------------------------------------------
  147. # ● 刷新
  148. #--------------------------------------------------------------------------
  149. def refresh
  150.    self.contents.clear
  151.    one_tile_size = 32 / PLAN_Map_Window::ZOOM
  152.    x = $game_player.real_x - 64 * (self.contents.width / one_tile_size) / 2
  153.    y = $game_player.real_y - 64 * (self.contents.height / one_tile_size) / 2
  154.    x = x * one_tile_size / 64
  155.    y = y * one_tile_size / 64
  156.    half_width = self.contents.width * 64 / 2
  157.    rest_width = ($game_map.width * 64 - $game_player.real_x) * one_tile_size
  158.    rev_x = 0
  159.    if @all_map.width < self.contents.width
  160.      rev_x = (half_width - $game_player.real_x * one_tile_size) / 64
  161.      rev_x -= (self.contents.width - @all_map.width) / 2
  162.      x += rev_x
  163.    elsif half_width > $game_player.real_x * one_tile_size
  164.      rev_x = (half_width - $game_player.real_x * one_tile_size) / 64
  165.      x += rev_x
  166.    elsif half_width > rest_width
  167.      rev_x = -((half_width - rest_width) / 64)
  168.      x += rev_x
  169.    end
  170.    half_height = self.contents.height * 64 / 2
  171.    rest_height = ($game_map.height * 64 - $game_player.real_y) * one_tile_size
  172.    rev_y = 0
  173.    if @all_map.height < self.contents.height
  174.      rev_y = (half_height - $game_player.real_y * one_tile_size) / 64
  175.      rev_y -= (self.contents.height - @all_map.height) / 2
  176.      y += rev_y
  177.    elsif half_height > $game_player.real_y * one_tile_size
  178.      rev_y = (half_height - $game_player.real_y * one_tile_size) / 64
  179.      y += rev_y
  180.    elsif half_height > rest_height
  181.      rev_y = -((half_height - rest_height) / 64)
  182.      y += rev_y
  183.    end
  184.    src_rect = Rect.new(x, y, self.contents.width, self.contents.height)
  185.    self.contents.blt(0, 0, @all_map, src_rect)
  186.    if PLAN_Map_Window::WINDOW_MOVE == true
  187.      wr = PLAN_Map_Window::WIN_X + self.width
  188.      wl = PLAN_Map_Window::WIN_X
  189.      ht = PLAN_Map_Window::WIN_Y
  190.      he = PLAN_Map_Window::WIN_Y + self.height
  191.      if $game_player.screen_x >= wl and $game_player.screen_x <= wr
  192.        if $game_player.screen_y >= ht and $game_player.screen_y <= he
  193.          self.x = PLAN_Map_Window::OVER_X
  194.          self.y = PLAN_Map_Window::OVER_Y
  195.        else
  196.          self.x = PLAN_Map_Window::WIN_X
  197.          self.y = PLAN_Map_Window::WIN_Y
  198.        end
  199.      else
  200.        self.x = PLAN_Map_Window::WIN_X
  201.        self.y = PLAN_Map_Window::WIN_Y
  202.      end
  203.    end
  204.    if $game_party.actors.size > 0
  205.      actor = $game_party.actors[0]
  206.      if PLAN_Map_Window::SHOWPLAYER
  207.      bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  208.      width = bitmap.width / PLAN_Map_Window::PLAYCW
  209.      height = bitmap.height / PLAN_Map_Window::PLAYCH
  210.      src_rect = Rect.new(0, 0, width, height)
  211.      w = width / $game_variables[30]
  212.      h = height / $game_variables[30]
  213.      else
  214.      bitmap = RPG::Cache.icon("方向" + $game_player.direction.to_s)
  215.      width = bitmap.width / PLAN_Map_Window::ZOOMP
  216.      height = bitmap.height / PLAN_Map_Window::ZOOMP
  217.      src_rect = Rect.new(0, 0, width, height)
  218.      w = width
  219.      h = height
  220.      end
  221.      x = self.contents.width / 2 - w / 2 + one_tile_size / 2 - rev_x
  222.      y = self.contents.height / 2 - h / 2 - rev_y
  223.      dest_rect = Rect.new(x, y, w, h)
  224.      self.contents.stretch_blt(dest_rect, bitmap, src_rect)
  225.    end
  226. end
  227. #--------------------------------------------------------------------------
  228. # ● 更新
  229. #--------------------------------------------------------------------------
  230. def update
  231.    super
  232.    if @old_real_x != $game_player.real_x or @old_real_y != $game_player.real_y
  233.      @old_real_x = $game_player.real_x
  234.      @old_real_y = $game_player.real_y
  235.      refresh
  236.    end
  237. end
  238. #--------------------------------------------------------------------------
  239. # ● 释放
  240. #--------------------------------------------------------------------------
  241. def dispose
  242.    super
  243.    @all_map.dispose
  244. end
  245. end

  246. #==============================================================================
  247. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  248. #==============================================================================
复制代码

系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
和记忆一起封存着的ID...
回复 支持 反对

使用道具 举报

Lv1.梦旅人

看不到我

梦石
0
星屑
50
在线时间
229 小时
注册时间
2005-11-6
帖子
1741

贵宾

4
 楼主| 发表于 2007-8-19 23:30:27 | 只看该作者
好的我试试{/hx}
回复 支持 反对

使用道具 举报

Lv1.梦旅人

看不到我

梦石
0
星屑
50
在线时间
229 小时
注册时间
2005-11-6
帖子
1741

贵宾

5
 楼主| 发表于 2007-8-19 23:36:17 | 只看该作者
测试无BUG 多谢啦{/cy}
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2026-6-26 04:23

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表