Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # RAFAEL_SOL_MAKER's VX MAP ADJUSTER v1.0 (Add-on for screen resolution)
- #-------------------------------------------------------------------------------
- # Description: Automatically resize your map if it's smaller than the screen
- # size, to prevent a bug in the map scrolling.
- # It warns you when you run the game, and you can save the map
- # with the size already corrected and filled up, if in test mode.
- # This code was made for me considering the fact that it's not
- # possible to resize Map Tables directly without crashing the game
- # OBS.: Generally speaking, it requires a "resolution script" to
- # scale the screen size and so do some real work...
- #-------------------------------------------------------------------------------
- # How to Use: Just configure it in the advanced configuration module(below).
- #-------------------------------------------------------------------------------
- # Special Thanks: -
- #-------------------------------------------------------------------------------
- #===============================================================================
- module PowerPackVX_Advanced_Configs
- Auto_Resize_Map = true # Automatically resize the smaller maps?
- Save_Resized_Map = false # Save the scaled map?
- Filler_Tile_ID = 2816 # Tile ID to fill the gaps
- end
- class Game_Map
- include PowerPackVX_Advanced_Configs
- alias sol_maker_setup setup unless $@
- def setup(map_id)
- sol_maker_setup (map_id)
- if Auto_Resize_Map
- # Discover what the minimum ideal size for the map;
- wd = Graphics.width / 32
- wd += 1 if (Graphics.width % 32) > 0
- hg = Graphics.height / 32
- hg += 1 if (Graphics.height % 32) > 0
- if @map.width < wd or @map.height < hg
- if $TEST
- p 'The map must have a minimum size of ' + wd.to_s +
- ' tiles of width, and '+ hg.to_s +
- ' tiles of height for the selected resolution;',
- 'It will be automatically resized to this size. '
- resize_map (wd,hg)
- end #if $TEST
- end #if map width/height
- end #if Resize
- end
- def resize_map (mapwidth, mapheight)
- # Create a bew map;
- map2 = RPG::Map.new ([@map.width, mapwidth].max, [@map.height, mapheight].max)
- # Fill it with the one-tile pattern...
- for x in 0.. map2.width-1
- for y in 0..map2.height-1
- map2.data[x,y,0] = Filler_Tile_ID
- map2.data[x,y,1] = 0
- map2.data[x,y,2] = 0
- end
- end
- # "Put" the open map into the new;
- for x in 0..@map.width-1
- for y in 0..@map.height-1
- for z in 0..2
- map2.data[x,y,z] = @map.data[x,y,z]
- end
- end
- end
- # Copy all properties, obviously;
- map2.scroll_type = @map.scroll_type
- map2.autoplay_bgm = @map.autoplay_bgm
- map2.bgm = @map.bgm
- map2.autoplay_bgs = @map.autoplay_bgs
- map2.bgs = @map.bgs
- map2.disable_dashing = @map.disable_dashing
- map2.encounter_list = @map.encounter_list
- map2.encounter_step = @map.encounter_step
- map2.parallax_name = @map.parallax_name
- map2.parallax_loop_x = @map.parallax_loop_x
- map2.parallax_loop_y = @map.parallax_loop_y
- map2.parallax_sx = @map.parallax_sx
- map2.parallax_sy = @map.parallax_sy
- map2.parallax_show = @map.parallax_show
- map2.events = @map.events
- # The map is finally ready, discards the temporary map.
- @map = map2; map2 = nil
- if Save_Resized_Map
- save_data(@map, sprintf("Data/Map%03d.rvdata", @map_id))
- p 'The map has been properly resized and saved successfully!'
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement