Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Game_System
- attr_reader :remove_shadows
- alias :th_remove_shadows_initialize :initialize
- def initialize
- th_remove_shadows_initialize
- @remove_shadows = false
- end
- def remove_shadows=(val)
- @remove_shadows = val
- @remove_shadows ? $game_map.remove_shadows : $game_map.restore_shadows
- end
- end
- class Game_Map
- alias :th_remove_shadows_setup :setup
- def setup(map_id)
- th_remove_shadows_setup(map_id)
- @memory_shadow_map = data.clone
- remove_shadows if $game_system.remove_shadows
- end
- def remove_shadows
- for x in 0...data.xsize
- for y in 0...data.ysize
- # check lowest 4 bits
- if (data[x,y,3] & 0xF) != 0
- # data stored in 2 bytes. Zero out the shadow bits
- data[x,y,3] &= 0xFFF0
- end
- end
- end
- end
- def restore_shadows
- for x in 0 ... @memory_shadow_map.xsize
- for y in 0... @memory_shadow_map.ysize
- data[x,y,3] = @memory_shadow_map[x, y, 3]
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement