neonblack

Better Autoshadow Removal

Dec 11th, 2014
264
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ##------
  2. ## By Neon Black
  3.  
  4. module MapInfo
  5.   def self.begin
  6.     return unless $TEST
  7.     @mapinfo = mapinfo
  8.     remove_autoshadows
  9.   end
  10.  
  11.   def self.mapinfo
  12.     load_data("Data/MapInfos.rvdata2")
  13.   end
  14.  
  15.   def self.remove_autoshadows
  16.     return unless @mapinfo
  17.     @mapinfo.keys.each do |map_id|
  18.       map = load_map(map_id)
  19.       map.width.times do |x|
  20.         map.height.times do |y|
  21.           remove = map.data[x, y, 3] & 0b1111
  22.           map.data[x, y, 3] -= remove
  23.         end
  24.       end
  25.       save_map(map, map_id)
  26.     end
  27.   end
  28.  
  29.   def self.load_map(map_id)
  30.     load_data(sprintf("Data/Map%03d.rvdata2", map_id))
  31.   end
  32.  
  33.   def self.save_map(map, map_id)
  34.     save_data(map, sprintf("Data/Map%03d.rvdata2", map_id))
  35.   end
  36. end
  37.  
  38. MapInfo.begin
RAW Paste Data