- #××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××× 
- # In-Depth Maps v2.0 
- # FenixFyreX 
- # RPG Maker VxAce 
- #××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××× 
- # This script allows the player to define two regions: 
- # overhead ceilings, and blocking tiles. 
- # When the system finds the overhead ceilings region on top of a tile, it will 
- # move that tile to the highest layer in the tilemap, and put the tile above 
- # that tile (y - 1) in it's place on the 'ground', this allows the player to pass 
- # underneath the tile. 
- # To turn the system OFF, simply turn the switch defined below ON. To turn it  
- # on, flip the switch OFF. This allows the user to traverse the 'ceilings' when 
- # on top of them, but go behind them when on the ground. 
- # 
- #××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××× 
-   
- module Fyx 
-   module MapDepth 
-   
-     # This is the switch to turn ON to turn the overhead system OFF. 
-     # Remember, all switches are OFF by default, so the system is ON at startup. 
-     Switch = 1 
-   
-     # Does the script turn on the switch automatically when each map loads? 
-     AutoSwitch = true 
-   
-     # This is the region defining tiles that need to be above the player. 
-     Overhead_Region = 1 
-   
-     # This is the region defining tiles that need to be unpassable no matter 
-     # what. 
-     Block_Region = 2 
-   
-     # This is the region to use when defining 'secret passages'. This region 
-     # ensures that the tiles below it are ALWAYS above and passable. 
-     Secret_Region = 3 
-   
-     # This is the user defined fall-back for when the system can't obtain a 
-     # tile to place under overhead tiles. 
-     Default_Ground_Tile = 2816 
-   end 
- end 
-   
- #××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××× 
- # Don't edit below unless you know what it means. 
- #××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××× 
-   
- class Game_Map 
-   
-   alias setup_no_ceilings setup 
-   def setup(*a,&bl) 
-     setup_no_ceilings(*a,&bl) 
-     if Fyx::MapDepth::AutoSwitch 
-       $game_switches[ohead_switch] = false 
-     end 
-     @old_tileset_flags = tileset.flags 
-     @ohead_switch = ohead_sys_is_on? 
-     define_ceilings if ohead_sys_is_on? 
-   end 
-   
-   def ohead_sys_is_on? 
-     return false if $game_switches[ohead_switch] 
-     return true 
-   end 
-   
-   def ohead_switch 
-     Fyx::MapDepth::Switch 
-   end 
-   
-   def ohead_region 
-     Fyx::MapDepth::Overhead_Region 
-   end 
-   
-   def block_region 
-     Fyx::MapDepth::Block_Region 
-   end 
-   
-   def secret_region 
-     Fyx::MapDepth::Secret_Region 
-   end 
-   
-   def default_ground_tile 
-     Fyx::MapDepth::Default_Ground_Tile 
-   end 
-   
-   def ceiling_ground_tile(x,y) 
-     return valid?(x,y-1) ? $game_map.data[x,y-1,0] : default_ground_tile 
-   end 
-   
-   alias passable_no_ceilings? passable? 
-   def passable?(*a,&bl) 
-     if ohead_sys_is_on? 
-       return false if ceiling_block?(*a,&bl) 
-     end 
-     passable_no_ceilings?(*a,&bl) 
-   end 
-   
-   def ceiling?(x,y) 
-     region_id(x,y) == ohead_region 
-   end 
-   
-   def secret_passage?(x,y) 
-     region_id(x,y) == secret_region 
-   end 
-   
-   def ceiling_block?(*a,&bl) 
-     x,y = *a[0...2] 
-     region_id(x,y) == block_region 
-   end 
-   
-   def get_ceil_xys(clear=false) 
-     @ceilings = [] 
-     @ceiling_blocks = [] 
-     @pass_ceilings = [] 
-     if clear 
-       @map = load_data(sprintf("Data/Map%03d.rvdata2", @map_id)) 
-       tileset.flags = @old_tileset_flags 
-       return nil 
-     end 
-     height.times do |y| 
-       width.times do |x| 
-         @ceilings << [x,y] if ceiling?(x,y) 
-         @pass_ceilings << [x,y] if secret_passage?(x,y) 
-         @ceiling_blocks << [x,y] if ceiling_block?(x,y) 
-       end 
-     end 
-   end 
-   
-   def define_ceilings 
-     get_ceil_xys 
-     @ceilings.each do |x,y| 
-       tid = $game_map.data[x,y,0] 
-       tileset.flags[tid] = 0x10 
-       $game_map.data[x,y,2] = tid 
-       $game_map.data[x,y,0] = ceiling_ground_tile(x,y) 
-     end 
-     @pass_ceilings.each do |x,y| 
-       tid = $game_map.data[x,y,0] 
-       tileset.flags[tid] = 0x10 
-       $game_map.data[x,y,2] = tid 
-       $game_map.data[x,y,0] = default_ground_tile 
-     end 
-   end 
-   
-   alias update_no_ceilings update 
-   def update(*a,&bl) 
-     if @ohead_switch != ohead_sys_is_on? 
-       @ohead_switch = ohead_sys_is_on? 
-       if ohead_sys_is_on? 
-         define_ceilings 
-       else 
-         get_ceil_xys(true) 
-       end 
-     end 
-     update_no_ceilings(*a,&bl) 
-   end 
- end 
- #××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××× 
- # ×END OF SCRIPT× 
- #×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××