Cerberuser

Spriteset_Map part

May 13th, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.23 KB | None | 0 0
  1. #==============================================================================
  2. # ** Spriteset_Map
  3. #------------------------------------------------------------------------------
  4. #  This class brings together map screen sprites, tilemaps, etc. It's used
  5. # within the Scene_Map class.
  6. #==============================================================================
  7. class Spriteset_Map
  8.  
  9.   #--------------------------------------------------------------------------
  10.   # * Cerberus's Changed Method : Create Tilemap
  11.   #--------------------------------------------------------------------------
  12.   def create_tilemap
  13.   #--------------------------------------------------------------------------
  14.   # if we start on XP map - we'll use the ZTilemap
  15.   #--------------------------------------------------------------------------
  16.     klass = $game_map.xp_base ? ZTilemap : Tilemap
  17.     @tilemap = klass.new(@viewport1)
  18.     @tilemap.map_data = $game_map.data
  19.     load_tileset
  20.   end
  21.  
  22.   #--------------------------------------------------------------------------
  23.   # * Cerberus's Changed Method : Load Tileset
  24.   #--------------------------------------------------------------------------
  25.   alias ztilemap_load_tileset load_tileset
  26.   def load_tileset
  27.     if @tilemap.is_a?(Tilemap)
  28.       ztilemap_load_tileset
  29.     else
  30.   #--------------------------------------------------------------------------
  31.   # if we are on XP map - we'll load the XP tileset
  32.   #--------------------------------------------------------------------------
  33.       @tilemap.tileset = ModCache.tileset($game_map.xp_map[:tileset_name])
  34.       @tilemap.priorities = $game_map.xp_map[:priorities]
  35.       $game_map.xp_map[:autotile_names] .each_with_index do |name, i|
  36.           @tilemap.autotiles[i] = LiTTleDRAgo.cache.autotile_cr_tilemap(name)
  37.       end
  38.     end
  39.   end  
  40.  
  41.   #--------------------------------------------------------------------------
  42.   # * Cerberus's Changed Method : Update Tileset
  43.   #--------------------------------------------------------------------------
  44.   def update_tileset
  45.     if (@tileset != $game_map.tileset) ||
  46.       ($game_map.xp_base && @tileset.id != $game_map.xp_map[:tileset_id])
  47.         load_tileset
  48.         refresh_characters
  49.     end
  50.   end
  51.  
  52. end
Advertisement
Add Comment
Please, Sign In to add comment