Advertisement
Vendily

Map Screenshot

Oct 1st, 2019
1,241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.62 KB | None | 0 0
  1. def saveMapScreenShot(mapid)
  2.   map=load_data(sprintf("Data/Map%03d.rxdata",mapid)) rescue nil
  3.   return BitmapWrapper.new(32,32) if !map
  4.   bitmap=BitmapWrapper.new(map.width*32,map.height*32)
  5.   black=Color.new(0,0,0)
  6.   tilesets=load_data("Data/Tilesets.rxdata")
  7.   tileset=tilesets[map.tileset_id]
  8.   return bitmap if !tileset
  9.   helper=TileDrawingHelper.fromTileset(tileset)
  10.   for y in 0...map.height
  11.     for x in 0...map.width
  12.       for z in 0..2
  13.         id=map.data[x,y,z]
  14.         id=0 if !id
  15.         helper.bltTile(bitmap,x*32,y*32,id)
  16.       end
  17.     end
  18.   end
  19.   bitmap.saveToPng(sprintf("Map%03d.png",mapid))
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement