Advertisement
Archeia

Better Autoshadow Removal by Neonblack

Dec 27th, 2014
1,529
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.19 KB | None | 0 0
  1. #==============================================================================
  2. # ■ Better Autoshadow Removal by Neonblack
  3. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  4. # This scriptlet removes your game's autoshadows that is also reflected on the
  5. # game editor itself! Just close your project and reopen after test playing your
  6. # game.
  7. #==============================================================================
  8.  
  9. module MapInfo
  10.   def self.begin
  11.     return unless $TEST
  12.     @mapinfo = mapinfo
  13.     remove_autoshadows
  14.   end
  15.  
  16.   def self.mapinfo
  17.     load_data("Data/MapInfos.rvdata2")
  18.   end
  19.  
  20.   def self.remove_autoshadows
  21.     return unless @mapinfo
  22.     @mapinfo.keys.each do |map_id|
  23.       map = load_map(map_id)
  24.       map.width.times do |x|
  25.         map.height.times do |y|
  26.           remove = map.data[x, y, 3] & 0b1111
  27.           map.data[x, y, 3] -= remove
  28.         end
  29.       end
  30.       save_map(map, map_id)
  31.     end
  32.   end
  33.  
  34.   def self.load_map(map_id)
  35.     load_data(sprintf("Data/Map%03d.rvdata2", map_id))
  36.   end
  37.  
  38.   def self.save_map(map, map_id)
  39.     save_data(map, sprintf("Data/Map%03d.rvdata2", map_id))
  40.   end
  41. end
  42.  
  43. MapInfo.begin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement