#=============================================================================== # Cache Optimization # By Jet10985 (Jet) #=============================================================================== # This snippet will pre-cache all images at the beginning of the game to # quicken the loading of bitmaps in-game, and return dups instead of originals # to prevent having to recreate after disposing it. # This script has: 0 customization options. #=============================================================================== # Overwritten Methods: # None #------------------------------------------------------------------------------- # Aliased methods: # Cache: load_bitmap #=============================================================================== if File.directory?("Graphics") g_array = Dir.entries("Graphics") g_array.each {|a| next if [".", ".."].include?(a) if !File.directory?("Graphics/#{a}") Cache.load_bitmap("Graphics/", a) rescue next next end file = Dir.entries("Graphics/#{a}") file.each {|b| next if [".", ".."].include?(b) if File.directory?("Graphics/#{a}/#{b}") g_array << "#{a}/#{b}" next end Cache.load_bitmap("Graphics/#{a}/", b) rescue next } } end class << Cache alias jet3745_load_bitmap load_bitmap unless $@ def load_bitmap(*args, &block) (jet3745_load_bitmap(*args, &block)).dup end end