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

Project1

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

关于《蒙古西征记》第三章

 关闭 [复制链接]
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-12-16
帖子
7
跳转到指定楼层
1
发表于 2007-12-20 18:52:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-12-16
帖子
7
2
 楼主| 发表于 2007-12-20 18:52:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽

Lv3.寻梦者

梦石
0
星屑
1696
在线时间
235 小时
注册时间
2005-10-23
帖子
106
3
发表于 2007-12-20 21:24:57 | 只看该作者
这里用了两个国外玩家做的脚本。使用方法按照惯例复制到Main以上,见脚本的说明。



  1. #================================
  2. # ■ Dynamic Maps
  3. #================================
  4. #  By: Near Fantastica
  5. #   Date: 05.09.05
  6. #   Version: 1
  7. #================================

  8. module Map
  9. #--------------------------------------------------------------
  10. @map_data = {}
  11. #--------------------------------------------------------------------------  
  12. def Map.set_map(map, map_id)
  13.    @map_data[map_id] = map
  14. end
  15. #--------------------------------------------------------------------------  
  16. def Map.data(map_id)
  17.    return @map_data[map_id]
  18. end
  19. end

  20. class Map_Data
  21. #--------------------------------------------------------------
  22. attr_accessor :map_id
  23. attr_accessor :map
  24. attr_accessor :tileset_name
  25. attr_accessor :autotile_names
  26. attr_accessor :panorama_name
  27. attr_accessor :panorama_hue
  28. attr_accessor :fog_name
  29. attr_accessor :fog_hue
  30. attr_accessor :fog_opacity
  31. attr_accessor :fog_blend_type
  32. attr_accessor :fog_zoom
  33. attr_accessor :fog_sx
  34. attr_accessor :fog_sy
  35. attr_accessor :battleback_name
  36. attr_accessor :passages
  37. attr_accessor :priorities
  38. attr_accessor :terrain_tags
  39. attr_accessor :display_x
  40. attr_accessor :display_y
  41. attr_accessor :need_refresh
  42. attr_accessor :events
  43. attr_accessor :common_events
  44. attr_accessor :fog_ox
  45. attr_accessor :fog_oy
  46. attr_accessor :fog_tone
  47. attr_accessor :fog_tone_target
  48. attr_accessor :fog_tone_duration
  49. attr_accessor :fog_opacity_duration
  50. attr_accessor :fog_opacity_target
  51. attr_accessor :scroll_direction
  52. attr_accessor :scroll_rest
  53. attr_accessor :scroll_speed
  54. attr_accessor :fow_on
  55. attr_accessor :fow_grid
  56. attr_accessor :fow_range
  57. #-------------------------------------------------------------
  58. def initialize
  59.    @map_id = 0
  60.    @map = 0
  61.    @tileset_name = 0
  62.    @autotile_names = 0
  63.    @panorama_name = 0
  64.    @panorama_hue = 0
  65.    @fog_name = 0
  66.    @fog_hue = 0
  67.    @fog_opacity = 0
  68.    @fog_blend_type = 0
  69.    @fog_zoom = 0
  70.    @fog_sx = 0
  71.    @fog_sy = 0
  72.    @battleback_name = 0
  73.    @passages = 0
  74.    @priorities = 0
  75.    @terrain_tags = 0
  76.    @display_x = 0
  77.    @display_y = 0
  78.    @need_refresh = 0
  79.    @events = 0
  80.    @common_events = 0
  81.    @fog_ox = 0
  82.    @fog_oy = 0
  83.    @fog_tone = 0
  84.    @fog_tone_target = 0
  85.    @fog_tone_duration = 0
  86.    @fog_opacity_duration = 0
  87.    @fog_opacity_target = 0
  88.    @scroll_direction = 0
  89.    @scroll_rest = 0
  90.    @scroll_speed = 0
  91.    @fow_on = 0 # FOW   
  92.    @fow_grid = 0 # FOW  
  93.    @fow_range = 0 # FOW   
  94. end
  95. end

  96. class Game_Map
  97.   

  98.   
  99.   
  100. #--------------------------------------------------------------
  101. def setup(map_id)
  102.    save_map(@map_id)
  103.    if Map.data(map_id) == nil
  104.      setup_map(map_id)
  105.    else
  106.      load_map(map_id)
  107.    end
  108. end
  109. #--------------------------------------------------------------
  110. def setup_map(map_id)
  111.    @map_id = map_id
  112.    @map = load_data(sprintf("Data/Map%03d.rxdata", @map_id))
  113.    tileset = $data_tilesets[@map.tileset_id]
  114.    @tileset_name = tileset.tileset_name
  115.    @autotile_names = tileset.autotile_names
  116.    @panorama_name = tileset.panorama_name
  117.    @panorama_hue = tileset.panorama_hue
  118.    @fog_name = tileset.fog_name
  119.    @fog_hue = tileset.fog_hue
  120.    @fog_opacity = tileset.fog_opacity
  121.    @fog_blend_type = tileset.fog_blend_type
  122.    @fog_zoom = tileset.fog_zoom
  123.    @fog_sx = tileset.fog_sx
  124.    @fog_sy = tileset.fog_sy
  125.    @battleback_name = tileset.battleback_name
  126.    @passages = tileset.passages
  127.    @priorities = tileset.priorities
  128.    @terrain_tags = tileset.terrain_tags
  129.    @display_x = 0
  130.    @display_y = 0
  131.    @need_refresh = false
  132.    @events = {}
  133.    for i in @map.events.keys
  134.      @events[i] = Game_Event.new(@map_id, @map.events[i])
  135.    end
  136.    @common_events = {}
  137.    for i in 1...$data_common_events.size
  138.      @common_events[i] = Game_CommonEvent.new(i)
  139.    end
  140.    @fog_ox = 0
  141.    @fog_oy = 0
  142.    @fog_tone = Tone.new(0, 0, 0, 0)
  143.    @fog_tone_target = Tone.new(0, 0, 0, 0)
  144.    @fog_tone_duration = 0
  145.    @fog_opacity_duration = 0
  146.    @fog_opacity_target = 0
  147.    @scroll_direction = 2
  148.    @scroll_rest = 0
  149.    @scroll_speed = 4
  150. end
  151. #-----------------------------------------------------------
  152. def load_map(map_id)
  153.    map_data = Map.data(map_id)
  154.    @map_id = map_data.map_id
  155.    @map = map_data.map
  156.    @tileset_name = map_data.tileset_name
  157.    @autotile_names = map_data.autotile_names
  158.    @panorama_name = map_data.panorama_name
  159.    @panorama_hue =  map_data.panorama_hue
  160.    @fog_name = map_data.fog_name
  161.    @fog_hue = map_data.fog_hue
  162.    @fog_opacity = map_data.fog_opacity
  163.    @fog_blend_type = map_data.fog_blend_type
  164.    @fog_zoom = map_data.fog_zoom
  165.    @fog_sx = map_data.fog_sx
  166.    @fog_sy = map_data.fog_sy
  167.    @battleback_name = map_data.battleback_name
  168.    @passages = map_data.passages
  169.    @priorities = map_data.priorities
  170.    @terrain_tags = map_data.terrain_tags
  171.    @display_x = map_data.display_x
  172.    @display_y = map_data.display_y
  173.    @need_refresh = map_data.need_refresh
  174.    @events = map_data.events
  175.    @common_events = map_data.common_events
  176.    @fog_ox = map_data.fog_ox
  177.    @fog_oy = map_data.fog_oy
  178.    @fog_tone = map_data.fog_tone
  179.    @fog_tone_target = map_data.fog_tone_target
  180.    @fog_tone_duration = map_data.fog_tone_duration
  181.    @fog_opacity_duration = map_data.fog_opacity_duration
  182.    @fog_opacity_target = map_data.fog_opacity_target
  183.    @scroll_direction = map_data.scroll_direction
  184.    @scroll_rest = map_data.scroll_rest
  185.    @scroll_speed = map_data.scroll_speed
  186.    @fow_on = map_data.fow_on # FOW     
  187.    @fow_grid = map_data.fow_grid # FOW
  188.    @fow_range = map_data.fow_range # FOW
  189. end
  190. #--------------------------------------------------------------
  191. def save_map(map_id)
  192.    return if map_id == 0
  193.    map_data = Map_Data.new
  194.    map_data.map_id = map_id
  195.    map_data.map = @map
  196.    map_data.tileset_name = @tileset_name
  197.    map_data.autotile_names = @autotile_names
  198.    map_data.panorama_name = @panorama_name
  199.    map_data.panorama_hue = @panorama_hue
  200.    map_data.fog_name = @fog_name
  201.    map_data.fog_hue = @fog_hue
  202.    map_data.fog_opacity = @fog_opacity
  203.    map_data.fog_blend_type = @fog_blend_type
  204.    map_data.fog_zoom = @fog_zoom
  205.    map_data.fog_sx = @fog_sx
  206.    map_data.fog_sy = @fog_sy
  207.    map_data.battleback_name = @battleback_name
  208.    map_data.passages = @passages
  209.    map_data.priorities = @priorities
  210.    map_data.terrain_tags =  @terrain_tags
  211.    map_data.display_x = @display_x
  212.    map_data.display_y = @display_y
  213.    map_data.need_refresh = @need_refresh
  214.    map_data.events = @events
  215.    map_data.common_events = @common_events
  216.    map_data.fog_ox = @fog_ox
  217.    map_data.fog_oy = @fog_oy
  218.    map_data.fog_tone = @fog_tone
  219.    map_data.fog_tone_target = @fog_tone_target
  220.    map_data.fog_tone_duration =  @fog_tone_duration
  221.    map_data.fog_opacity_duration = @fog_opacity_duration
  222.    map_data.fog_opacity_target = @fog_opacity_target
  223.    map_data.scroll_direction = @scroll_direction
  224.    map_data.scroll_rest = @scroll_rest
  225.    map_data.scroll_speed = @scroll_speed
  226.    map_data.fow_on = @fow_on # FOW      
  227.    map_data.fow_grid = @fow_grid # FOW
  228.    map_data.fow_range = @fow_range # FOW
  229.    Map.set_map(map_data, map_id)
  230. end
  231. end
复制代码


  1. =begin
  2.   ============
  3.    Fog of War - version 1.0 (2005-10-26)
  4.   ============
  5.    by Wachunga
  6.    
  7.   0.8 - original release
  8.   0.85
  9.     - added colour parameter to map names
  10.     - fixed bug where map grids overlapped
  11.   0.9
  12.     - switched over to a tilemap (from a sprite)
  13.     - now more compatible with minimap scripts (but they'll have to take
  14.     extra tilemap into account)
  15.   1.0
  16.     - switched over to an autotile instead of using a custom tileset
  17.       * edges looks nicer, but gradual fading had to be removed
  18.       * colour parameter no longer possible (set by autotile)
  19.     - move event (including jumping and speed changes) bug fixed
  20.     - teleportation bug fixed
  21.     - some optimization
  22.     - made compatible with Cogwheel's Pixel Movement script
  23.     (see http://www.rmxp.net/forums/index.php?showtopic=24716 for details)
  24.    
  25.   Note:
  26.   There's no need to add the autotile via the database. Just place the file in
  27.   the autotile folder, import it, and change the FOW_AT_NAME constant to
  28.   the appropriate filename. To change the colour of the fog of war, create a
  29.   new autotile.
  30.   
  31.   To indicate a map is to have fog of war (i.e. its tiles are dark until
  32.   the player gets within visual range), include <FoW> in its name.  You may
  33.   also optionally specify a range between 0 and 3. This may also be
  34.   included in the map name, as in this example:
  35.   "your-map-name <FoW><2>" (range is 2)
  36.   
  37.   The ranges work as follows:
  38.   
  39.   range = 0 reveals just the square on which the player stands
  40.   
  41.   range = 1 is the same as range 0 plus four adjacent tiles
  42.   i.e.   @
  43.         @P@
  44.          @
  45.   
  46.   range = 2 is the same as range 1 plus eight additional tiles
  47.    i.e.  @
  48.         @@@
  49.        @@P@@
  50.         @@@
  51.          @
  52.          
  53.   range = 3 (default) is the same as range 2 plus twelve additional tiles
  54.    i.e.  @
  55.         @@@
  56.        @@@@@
  57.       @@@P@@@
  58.        @@@@@
  59.         @@@      
  60.          @
  61. =end

  62. #-------------------------------------------------------------------------------

  63.   FOW = 0b00
  64.   REVEALED = 0b01
  65.   # tiles with no surrounding fog are flagged "SKIP" for efficiency
  66.   SKIP = 0b10

  67.   FOW_AT_NAME = "fow_default"
  68.   
  69. #-------------------------------------------------------------------------------  
  70.   
  71. class Game_Map
  72.   
  73.   attr_reader :fow_on
  74.   attr_reader :fow_grid
  75.   attr_reader :fow_range

  76.   alias dm_setup setup_map
  77.   def setup_map(map_id)
  78.     dm_setup(map_id)
  79.     # set defaults
  80.     @fow_on = false
  81.     @fow_grid = nil   
  82.     @fow_range = 3
  83.     # get any tags from the map name
  84.     tags = $game_map.map_name.delete(' ').scan(/<[A-Za-z0-9_.,]+>/)
  85.     if not tags.empty? and tags[0].upcase == '<FOW>'
  86.       tags.shift # remove FOW tag
  87.       @fow_on = true
  88.       if @fow_grid == nil # only if not already defined
  89.           @fow_grid = Array.new(@map.width, FOW)
  90.           for i in [email protected]
  91.             @fow_grid[i] = Array.new(@map.height, FOW)
  92.           end
  93.       end
  94.       # check if range specified, else default to 3
  95.       if not tags.empty?
  96.         x = tags[0].delete("<>").to_i
  97.         @fow_range = x if x >= 0 and x < 4
  98.       end
  99.     end
  100.   end
  101.   
  102. =begin  
  103.   Updates the underlying grid which keeps track of which tiles have been
  104.   "discovered" (i.e. no fog of war) based on where player has already explored.
  105. =end
  106.   def update_fow_grid
  107.     px = $game_player.x
  108.     py = $game_player.y

  109.     @fow_grid[px][py] |= REVEALED
  110.     # reveal more, depending on range
  111.     if @fow_range > 0
  112.       if px > 0
  113.         @fow_grid[px-1][py] |= REVEALED
  114.       end
  115.       if py < @map.height-1
  116.         @fow_grid[px][py+1] |= REVEALED
  117.       end
  118.       if py > 0
  119.         @fow_grid[px][py-1] |= REVEALED
  120.       end
  121.       if px < @map.width-1
  122.         @fow_grid[px+1][py] |= REVEALED
  123.       end
  124.      
  125.       if @fow_range > 1
  126.         if px > 0
  127.           if py > 0
  128.             @fow_grid[px-1][py-1] |= REVEALED
  129.           end
  130.           if py < @map.height-1
  131.             @fow_grid[px-1][py+1] |= REVEALED   
  132.           end            
  133.           if px > 1      
  134.             @fow_grid[px-2][py] |= REVEALED
  135.           end
  136.         end
  137.         if px < @map.width-1
  138.           if py > 0
  139.             @fow_grid[px+1][py-1] |= REVEALED
  140.           end
  141.           if py < @map.height-1
  142.             @fow_grid[px+1][py+1] |= REVEALED
  143.           end
  144.         end
  145.         if px < @map.width-2
  146.           @fow_grid[px+2][py] |= REVEALED
  147.         end           
  148.         if py > 1
  149.           @fow_grid[px][py-2] |= REVEALED      
  150.         end
  151.         if py < @map.height-2
  152.           @fow_grid[px][py+2] |= REVEALED
  153.         end        

  154.         if @fow_range > 2
  155.           if px > 0
  156.             if py > 1
  157.               @fow_grid[px-1][py-2] |= REVEALED
  158.             end
  159.             if py < @map.height-2
  160.               @fow_grid[px-1][py+2] |= REVEALED   
  161.             end               
  162.             if px > 1
  163.               if py > 0
  164.                 @fow_grid[px-2][py-1] |= REVEALED
  165.               end
  166.               if py < @map.height-1
  167.                 @fow_grid[px-2][py+1] |= REVEALED  
  168.               end              
  169.               if px > 2
  170.                 @fow_grid[px-3][py] |= REVEALED               
  171.               end
  172.             end
  173.           end
  174.           if px < @map.width-1
  175.             if py > 1
  176.               @fow_grid[px+1][py-2] |= REVEALED
  177.             end
  178.             if py < @map.height-2
  179.               @fow_grid[px+1][py+2] |= REVEALED
  180.             end
  181.             if px < @map.width-2
  182.               if py > 0
  183.                 @fow_grid[px+2][py-1] |= REVEALED
  184.               end
  185.               if py < @map.height-1
  186.                 @fow_grid[px+2][py+1] |= REVEALED               
  187.               end              
  188.               if px < @map.width-3
  189.                 @fow_grid[px+3][py] |= REVEALED   
  190.               end               
  191.             end
  192.           end         
  193.           if py > 2
  194.             @fow_grid[px][py-3] |= REVEALED      
  195.           end         
  196.           if py < @map.height-3
  197.             @fow_grid[px][py+3] |= REVEALED
  198.           end         
  199.         end
  200.       end
  201.     end
  202.   end  
  203.   
  204.   def map_name
  205.     return load_data("Data/MapInfos.rxdata")[@map_id].name
  206.   end  
  207.       
  208. end      

  209. #-------------------------------------------------------------------------------

  210. class Spriteset_Map
  211.   
  212.   def initialize
  213.     @viewport1 = Viewport.new(0, 0, 640, 480)
  214.     @viewport2 = Viewport.new(0, 0, 640, 480)
  215.     @viewport3 = Viewport.new(0, 0, 640, 480)
  216.     @viewport2.z = 200
  217.     @viewport3.z = 5000
  218.     @tilemap = Tilemap.new(@viewport1)
  219.     @tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
  220.     for i in 0..6
  221.       autotile_name = $game_map.autotile_names[i]
  222.       @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
  223.     end
  224.     @tilemap.map_data = $game_map.data
  225.     @tilemap.priorities = $game_map.priorities
  226.     @panorama = Plane.new(@viewport1)
  227.     @panorama.z = -1000
  228.     @fog = Plane.new(@viewport1)
  229.     @fog.z = 3000
  230.     @character_sprites = []
  231.     for i in $game_map.events.keys.sort
  232.       sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
  233.       @character_sprites.push(sprite)
  234.     end
  235.     @character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
  236.     @weather = RPG::Weather.new(@viewport1)
  237.     @picture_sprites = []
  238.     for i in 1..50
  239.       @picture_sprites.push(Sprite_Picture.new(@viewport2,
  240.         $game_screen.pictures[i]))
  241.     end
  242.     @timer_sprite = Sprite_Timer.new

  243.     # add fog of war tilemap...
  244.     if $game_map.fow_on
  245.       for m in 0...$game_map.width
  246.         for n in 0...$game_map.height
  247.           # reset SKIP flag
  248.           $game_map.fow_grid[m][n] &= ~SKIP
  249.         end
  250.       end
  251.       @fow_tilemap = Tilemap.new(@viewport1)
  252.       @fow_tilemap.autotiles[0] = RPG::Cache.autotile(FOW_AT_NAME)
  253.       @fow_autotiles = Hash.new(0)
  254.       j = 48 # starting autotile index
  255.       for i in Autotile_Keys
  256.         @fow_autotiles[i] = j
  257.         j += 1
  258.       end
  259.       # add duplicates
  260.       for i in Duplicate_Keys.keys
  261.         @fow_autotiles[i] = @fow_autotiles[Duplicate_Keys[i]]
  262.       end
  263.       data = Table.new($game_map.width, $game_map.height, 3)
  264.       # set everything to fog
  265.       for x in 0...$game_map.width
  266.         for y in 0...$game_map.height
  267.           data[x,y,2] = 48 # fog
  268.         end
  269.       end
  270.       @fow_tilemap.map_data = data
  271.       priorities = Table.new(96)
  272.       # set to highest priority to ensure everything is covered
  273.       for i in 48...96
  274.         priorities[i] = 5
  275.       end
  276.       @fow_tilemap.priorities = priorities
  277.       $game_map.update_fow_grid
  278.       update_fow_tilemap # reveal any explored tiles
  279.     end
  280.     update   
  281.   end
  282.   
  283. =begin
  284.   Updates the fog of war tilemap based on the map's underlying grid.
  285.   
  286.   This method is called by Game_Player.update whenever the player moves.
  287. =end
  288.   def update_fow_tilemap
  289.     checked = Array.new($game_map.width,0)
  290.     for k in 0...$game_map.width
  291.       checked[k] = Array.new($game_map.height,0)
  292.     end
  293.     for x in (($game_map.display_x/128)-1).round .. (($game_map.display_x/128)+21).round
  294.       for y in (($game_map.display_y/128)-1).round .. (($game_map.display_y/128)+16).round
  295.         # check boundaries
  296.         if x > $game_map.width - 1 or x < 0 then next end
  297.         if y > $game_map.height - 1 or y < 0 then next end   
  298.         if $game_map.fow_grid[x][y] == REVEALED # (but not SKIP)
  299.           others = false
  300.           @fow_tilemap.map_data[x,y,2] = 0 if @fow_tilemap.map_data[x,y,2] != 0
  301.           for i in x-1 .. x+1
  302.             for j in y-1 .. y+1
  303.               # check new boundaries
  304.               if i > $game_map.width - 1 or i < 0 then next end
  305.               if j > $game_map.height - 1 or j < 0 then next end
  306.               if $game_map.fow_grid[i][j] == FOW
  307.                 others = true # can't flag as SKIP because there's nearby fog
  308.                 if checked[i][j] == 0
  309.                   checked[i][j] = 1
  310.                   # only fill if not already revealed
  311.                   if @fow_tilemap.map_data[i,j,2] != 0
  312.                     # calculate adjacent fog
  313.                     adj = ''
  314.                     if (i == 0)
  315.                       adj << '147'
  316.                     else
  317.                       if (j == 0) then adj << '1'
  318.                       else
  319.                         if ($game_map.fow_grid[i-1][j-1] == FOW) then adj << '1' end
  320.                       end
  321.                       if ($game_map.fow_grid[i-1][j] == FOW) then adj << '4' end
  322.                       if (j == $game_map.height-1) then adj << '7'
  323.                       else
  324.                         if ($game_map.fow_grid[i-1][j+1] == FOW) then adj << '7' end
  325.                       end
  326.                     end
  327.                     if (i == $game_map.width-1)
  328.                       adj << '369'
  329.                     else
  330.                       if (j == 0) then adj << '3'
  331.                       else
  332.                         if ($game_map.fow_grid[i+1][j-1] == FOW) then adj << '3' end
  333.                       end
  334.                       if ($game_map.fow_grid[i+1][j] == FOW) then adj << '6' end
  335.                       if (j == $game_map.height-1) then adj << '9'
  336.                       else
  337.                         if ($game_map.fow_grid[i+1][j+1] == FOW) then adj << '9' end
  338.                       end
  339.                     end
  340.                     if (j == 0)
  341.                       adj << '2'
  342.                     else
  343.                       if ($game_map.fow_grid[i][j-1] == FOW) then adj << '2' end
  344.                     end
  345.                     if (j == $game_map.height-1)
  346.                       adj << '8'
  347.                     else
  348.                       if ($game_map.fow_grid[i][j+1] == FOW) then adj << '8' end
  349.                     end
  350.                     # if no adjacent fog, set it as 0
  351.                     if (adj == '') then adj = '0' end
  352.                     # convert to an array, sort, and then back to a string
  353.                     adj = adj.split(//).sort.join
  354.                     @fow_tilemap.map_data[i,j,2] = eval '@fow_autotiles[adj.to_i]'
  355.                   end
  356.                 end
  357.               end
  358.             end
  359.           end
  360.           if not others
  361.             # no adjacent fog found, so flag tile to prevent processing again
  362.             $game_map.fow_grid[x][y] |= SKIP
  363.           end
  364.         end
  365.       end
  366.     end   
  367.   end

  368.   alias old_dispose dispose
  369.   def dispose
  370.     if $game_map.fow_on == true
  371.     end
  372.     old_dispose
  373.   end

  374.   alias old_update update
  375.   def update
  376.     if $game_map.fow_on == true
  377.       @fow_tilemap.ox = $game_map.display_x / 4   
  378.       @fow_tilemap.oy = $game_map.display_y / 4   
  379.       @fow_tilemap.update   
  380.     end
  381.     old_update
  382.   end
  383. end

  384. #-------------------------------------------------------------------------------

  385. class Game_Player

  386.   def initialize
  387.     super
  388.     @last_x = @x
  389.     @last_y = @y
  390.   end  

  391.   def update_jump
  392.     super
  393.     # only update when about to land, not revealing anything jumped over
  394.     if $game_map.fow_on and @jump_count == 0
  395.       $game_map.update_fow_grid
  396.       $scene.spriteset.update_fow_tilemap
  397.     end
  398.   end
  399.   
  400.   def update_move
  401.     super
  402.     if $game_map.fow_on and (@x != @last_x or @y != @last_y)
  403.         unless jumping?
  404.           $game_map.update_fow_grid         
  405.           $scene.spriteset.update_fow_tilemap
  406.         end
  407.     end  
  408.     @last_x = @x
  409.     @last_y = @y     
  410.   end

  411. end

  412. #-------------------------------------------------------------------------------

  413. class Scene_Map
  414.   attr_reader :spriteset
  415. end

  416. =begin
  417.         Autotile in column 2:
  418.    
  419. row\col| 1  2  3  4  5  6  7  8
  420.      ---------------------------
  421.      1 | 48 49 50 51 52 53 54 55
  422.      2 | 56 57 58 59 60 61 62 63
  423.      3 | 64 65 66 67 68 69 70 71
  424.      4 | 72 73 74 75 76 77 78 79
  425.      5 | 80 81 82 83 84 85 86 87
  426.      6 | 88 89 90 91 92 93 94 95
  427.      
  428.      The function to return the index of a single tile within an autotile
  429.      (given by at_index) is (at_index-1)*48 + col-1 + (row-1)*8
  430.      (where row, col, and at_index are again NOT zero-indexed)
  431. =end

  432. =begin
  433.     The following array lists systematic keys which are based on adjacent
  434.     walls (where 'W' is the wall itself):
  435.     1 2 3
  436.     4 W 6
  437.     7 8 9
  438.     e.g. 268 is the key that will be used to refer to the autotile
  439.     which has adjacent walls north, east, and south.  For the Castle Prison
  440.     tileset (autotile #1), this is 67.
  441.    
  442.     (It's a bit unwieldy, but it works.)
  443. =end

  444.   Autotile_Keys = [
  445.   12346789,
  446.   2346789,
  447.   1246789,
  448.   246789,
  449.   1234678,
  450.   234678,
  451.   124678,
  452.   24678,
  453.   
  454.   1234689,
  455.   234689,
  456.   124689,
  457.   24689,
  458.   123468,
  459.   23468,
  460.   12468,
  461.   2468,
  462.   
  463.   23689,
  464.   2689,
  465.   2368,
  466.   268,
  467.   46789,
  468.   4678,
  469.   4689,
  470.   468,
  471.   
  472.   12478,
  473.   1248,
  474.   2478,
  475.   248,
  476.   12346,
  477.   2346,
  478.   1246,
  479.   246,
  480.   
  481.   28,
  482.   46,
  483.   689,
  484.   68,
  485.   478,
  486.   48,
  487.   124,
  488.   24,
  489.   
  490.   236,
  491.   26,
  492.   8,
  493.   6,
  494.   2,
  495.   4,
  496.   0 ]
  497.    
  498.   # many autotiles handle multiple situations
  499.   # this hash keeps track of which keys are identical
  500.   # to ones already defined above
  501.   Duplicate_Keys = {
  502.   123689 => 23689,
  503.   236789 => 23689,
  504.   1236789 => 23689,
  505.   34689 => 4689,
  506.   14689 => 4689,
  507.   134689 => 4689,
  508.   14678 => 4678,
  509.   34678 => 4678,
  510.   134678 => 4678,
  511.   146789 => 46789,
  512.   346789 => 46789,
  513.   1346789 => 46789,
  514.   23467 => 2346,
  515.   23469 => 2346,
  516.   234679 => 2346,
  517.   123467 => 12346,
  518.   123469 => 12346,
  519.   1234679 => 12346,
  520.   12467 => 1246,
  521.   12469 => 1246,
  522.   124679 => 1246,
  523.   124789 => 12478,
  524.   123478 => 12478,
  525.   1234789 => 12478,
  526.   146 => 46,
  527.   346 => 46,
  528.   467 => 46,
  529.   469 => 46,
  530.   1346 => 46,
  531.   1467 => 46,
  532.   1469 => 46,
  533.   3467 => 46,
  534.   3469 => 46,
  535.   4679 => 46,
  536.   13467 => 46,
  537.   13469 => 46,
  538.   14679 => 46,
  539.   34679 => 46,
  540.   134679 => 46,
  541.   128 => 28,
  542.   238 => 28,
  543.   278 => 28,
  544.   289 => 28,
  545.   1238 => 28,
  546.   1278 => 28,
  547.   1289 => 28,
  548.   2378 => 28,
  549.   2389 => 28,
  550.   2789 => 28,
  551.   12378 => 28,
  552.   12389 => 28,
  553.   12789 => 28,
  554.   23789 => 28,
  555.   123789 => 28,
  556.   
  557.   1247 => 124,
  558.   2369 => 236,
  559.   147 => 4,
  560.   247 => 24,
  561.   14 => 4,
  562.   47 => 4,
  563.   1478 => 478,
  564.   3478 => 478,
  565.   4789 => 478,
  566.   134789 => 478,
  567.   14789 => 478,  
  568.   13478 => 478,
  569.   34789 => 478,
  570.   1234 => 124,
  571.   1247 => 124,
  572.   1249 => 124,
  573.   12347 => 124,
  574.   12349 => 124,
  575.   12479 => 124,
  576.   123479 => 124,
  577.   1236 => 236,
  578.   2367 => 236,
  579.   2369 => 236,
  580.   12367 => 236,
  581.   12369 => 236,
  582.   23679 => 236,
  583.   123679 => 236,
  584.   12368 => 2368,
  585.   23678 => 2368,  
  586.   123678 => 2368,
  587.   12348 => 1248,
  588.   12489 => 1248,
  589.   123489 => 1248,
  590.   1689 => 689,
  591.   3689 => 689,
  592.   6789 => 689,
  593.   13689 => 689,
  594.   16789 => 689,
  595.   36789 => 689,
  596.   136789 => 689,
  597.   12689 => 2689,
  598.   26789 => 2689,  
  599.   126789 => 2689,
  600.   23478 => 2478,
  601.   24789 => 2478,
  602.   234789 => 2478,

  603.   12 => 2,
  604.   23 => 2,
  605.   27 => 2,
  606.   29 => 2,  
  607.   123 => 2,
  608.   127 => 2,
  609.   129 => 2,
  610.   237 => 2,
  611.   239 => 2,
  612.   279 => 2,
  613.   1237 => 2,
  614.   1239 => 2,  
  615.   1279 => 2,
  616.   2379 => 2,
  617.   12379 => 2,

  618.   
  619.   14 => 4,
  620.   47 => 4,
  621.   34 => 4,
  622.   49 => 4,  
  623.   147 => 4,
  624.   134 => 4,
  625.   347 => 4,
  626.   349 => 4,  
  627.   149 => 4,
  628.   479 => 4,
  629.   1347 => 4,
  630.   1479 => 4,   
  631.   1349 => 4,
  632.   3479 => 4,
  633.   13479 => 4,   

  634.   16 => 6,
  635.   36 => 6,
  636.   67 => 6,
  637.   69 => 6,
  638.   136 => 6,
  639.   167 => 6,
  640.   169 => 6,
  641.   367 => 6,
  642.   369 => 6,
  643.   679 => 6,
  644.   1369 => 6,  
  645.   3679 => 6,  
  646.   1367 => 6,
  647.   1679 => 6,
  648.   13679 => 6,  
  649.   
  650.   78 => 8,
  651.   89 => 8,
  652.   18 => 8,
  653.   38 => 8,
  654.   138 => 8,
  655.   789 => 8,
  656.   178 => 8,
  657.   189 => 8,
  658.   378 => 8,
  659.   389 => 8,
  660.   1789 => 8,  
  661.   3789 => 8,
  662.   1378 => 8,
  663.   1389 => 8,
  664.   13789 => 8,
  665.   
  666.   1468 => 468,
  667.   3468 => 468,
  668.   13468 => 468,
  669.   
  670.   2467 => 246,
  671.   2469 => 246,
  672.   24679 => 246,
  673.   
  674.   2348 => 248,
  675.   2489 => 248,
  676.   23489 => 248,
  677.   
  678.   1268 => 268,
  679.   2678 => 268,
  680.   12678 => 268,
  681.   
  682.   148 => 48,
  683.   348 => 48,
  684.   489 => 48,
  685.   1348 => 48,
  686.   1489 => 48,
  687.   3489 => 48,
  688.   13489 => 48,
  689.   
  690.   168 => 68,
  691.   368 => 68,
  692.   678 => 68,
  693.   1368 => 68,
  694.   1678 => 68,
  695.   3678 => 68,
  696.   13678 => 68,
  697.   
  698.   234 => 24,
  699.   247 => 24,
  700.   249 => 24,
  701.   2347 => 24,
  702.   2349 => 24,
  703.   2479 => 24,
  704.   23479 => 24,
  705.   
  706.   126 => 26,
  707.   267 => 26,
  708.   269 => 26,
  709.   1267 => 26,
  710.   1269 => 26,
  711.   2679 => 26,
  712.   12679 => 26,  
  713.   }
复制代码
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-12-16
帖子
7
4
 楼主| 发表于 2007-12-23 04:45:03 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-12-16
帖子
7
5
 楼主| 发表于 2007-12-29 04:03:35 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-19 15:32

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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