aboutsummaryrefslogtreecommitdiff
path: root/fonts
ModeNameSize
-rw-r--r--DroidSansFallbackFull.ttf4529044logplain
-rw-r--r--liberationmono.ttf333636logplain
-rw-r--r--liberationsans.ttf133828logplain
-rwxr-xr-xlucida_sans_10.xml156248logplain
-rwxr-xr-xlucida_sans_100.png12245logplain
-rwxr-xr-xlucida_sans_11.xml157272logplain
-rwxr-xr-xlucida_sans_110.png15193logplain
-rwxr-xr-xlucida_sans_12.xml157058logplain
-rwxr-xr-xlucida_sans_120.png16596logplain
-rwxr-xr-xlucida_sans_14.xml159272logplain
-rwxr-xr-xlucida_sans_140.png47080logplain
-rwxr-xr-xlucida_sans_16.xml160744logplain
-rwxr-xr-xlucida_sans_160.png53771logplain
-rwxr-xr-xlucida_sans_18.xml162284logplain
-rwxr-xr-xlucida_sans_180.png63899logplain
-rwxr-xr-xlucida_sans_20.xml162438logplain
-rwxr-xr-xlucida_sans_200.png76914logplain
-rwxr-xr-xlucida_sans_22.xml162936logplain
-rwxr-xr-xlucida_sans_220.png82941logplain
-rwxr-xr-xlucida_sans_24.xml166358logplain
-rwxr-xr-xlucida_sans_240.png94928logplain
-rwxr-xr-xlucida_sans_26.xml167054logplain
-rwxr-xr-xlucida_sans_260.png105072logplain
-rwxr-xr-xlucida_sans_28.xml167156logplain
-rwxr-xr-xlucida_sans_280.png114619logplain
-rwxr-xr-xlucida_sans_36.xml169606logplain
-rwxr-xr-xlucida_sans_360.png162310logplain
-rwxr-xr-xlucida_sans_4.xml136910logplain
-rwxr-xr-xlucida_sans_40.png8487logplain
-rwxr-xr-xlucida_sans_48.xml171972logplain
-rwxr-xr-xlucida_sans_480.png231593logplain
-rwxr-xr-xlucida_sans_56.xml174174logplain
-rwxr-xr-xlucida_sans_560.png278999logplain
-rwxr-xr-xlucida_sans_6.xml140552logplain
-rwxr-xr-xlucida_sans_60.png15405logplain
-rwxr-xr-xlucida_sans_8.xml154564logplain
-rwxr-xr-xlucida_sans_80.png10040logplain
-rwxr-xr-xlucida_sans_9.xml154830logplain
-rwxr-xr-xlucida_sans_90.png10974logplain
-rwxr-xr-xmono_dejavu_sans_10.xml257014logplain
-rwxr-xr-xmono_dejavu_sans_100.png61308logplain
-rwxr-xr-xmono_dejavu_sans_11.xml263644logplain
-rwxr-xr-xmono_dejavu_sans_110.png74668logplain
-rwxr-xr-xmono_dejavu_sans_12.xml268932logplain
-rwxr-xr-xmono_dejavu_sans_120.png80486logplain
-rwxr-xr-xmono_dejavu_sans_14.xml269188logplain
-rwxr-xr-xmono_dejavu_sans_140.png98222logplain
-rwxr-xr-xmono_dejavu_sans_16.xml275642logplain
-rwxr-xr-xmono_dejavu_sans_160.png111526logplain
-rwxr-xr-xmono_dejavu_sans_18.xml279962logplain
-rwxr-xr-xmono_dejavu_sans_180.png134816logplain
-rwxr-xr-xmono_dejavu_sans_20.xml282588logplain
-rwxr-xr-xmono_dejavu_sans_200.png152413logplain
-rwxr-xr-xmono_dejavu_sans_22.xml283950logplain
-rwxr-xr-xmono_dejavu_sans_220.png168185logplain
-rwxr-xr-xmono_dejavu_sans_24.xml286626logplain
-rwxr-xr-xmono_dejavu_sans_240.png187484logplain
-rwxr-xr-xmono_dejavu_sans_26.xml289710logplain
-rwxr-xr-xmono_dejavu_sans_260.png210322logplain
-rwxr-xr-xmono_dejavu_sans_28.xml292596logplain
-rwxr-xr-xmono_dejavu_sans_280.png223051logplain
-rwxr-xr-xmono_dejavu_sans_4.xml237740logplain
-rwxr-xr-xmono_dejavu_sans_40.png17182logplain
-rwxr-xr-xmono_dejavu_sans_6.xml245472logplain
-rwxr-xr-xmono_dejavu_sans_60.png31749logplain
-rwxr-xr-xmono_dejavu_sans_8.xml251876logplain
-rwxr-xr-xmono_dejavu_sans_80.png49875logplain
-rwxr-xr-xmono_dejavu_sans_9.xml254016logplain
-rwxr-xr-xmono_dejavu_sans_90.png55338logplain
opt">< l): i = l return i def readU8(f): return ord(f.read(1)) def readU16(f): return ord(f.read(1))*256 + ord(f.read(1)) def readU32(f): return ord(f.read(1))*256*256*256 + ord(f.read(1))*256*256 + ord(f.read(1))*256 + ord(f.read(1)) def readS32(f): return unsignedToSigned(ord(f.read(1))*256*256*256 + ord(f.read(1))*256*256 + ord(f.read(1))*256 + ord(f.read(1)), 2**31) usagetext = """minetestmapper.py [options] -i/--input <world_path> -o/--output <output_image.png> --bgcolor <color> --scalecolor <color> --playercolor <color> --origincolor <color> --drawscale --drawplayers --draworigin --drawunderground Color format: '#000000'""" def usage(): print(usagetext) try: opts, args = getopt.getopt(sys.argv[1:], "hi:o:", ["help", "input=", "output=", "bgcolor=", "scalecolor=", "origincolor=", "playercolor=", "draworigin", "drawplayers", "drawscale", "drawunderground"]) except getopt.GetoptError as err: # print help information and exit: print(str(err)) # will print something like "option -a not recognized" usage() sys.exit(2) path = None output = "map.png" border = 0 scalecolor = "black" bgcolor = "white" origincolor = "red" playercolor = "red" drawscale = False drawplayers = False draworigin = False drawunderground = False sector_xmin = -1500 / 16 sector_xmax = 1500 / 16 sector_zmin = -1500 / 16 sector_zmax = 1500 / 16 for o, a in opts: if o in ("-h", "--help"): usage() sys.exit() elif o in ("-i", "--input"): path = a elif o in ("-o", "--output"): output = a elif o == "--bgcolor": bgcolor = ImageColor.getrgb(a) elif o == "--scalecolor": scalecolor = ImageColor.getrgb(a) elif o == "--playercolor": playercolor = ImageColor.getrgb(a) elif o == "--origincolor": origincolor = ImageColor.getrgb(a) elif o == "--drawscale": drawscale = True border = 40 elif o == "--drawplayers": drawplayers = True elif o == "--draworigin": draworigin = True elif o == "--drawunderground": drawunderground = True else: assert False, "unhandled option" if path is None: print("Please select world path (eg. -i ../worlds/yourworld) (or use --help)") sys.exit(1) if path[-1:] != "/" and path[-1:] != "\\": path = path + "/" # Load color information for the blocks. colors = {} try: f = file("colors.txt") except IOError: f = file(os.path.join(os.path.dirname(__file__), "colors.txt")) for line in f: values = string.split(line) if len(values) < 4: continue identifier = values[0] is_hex = True for c in identifier: if c not in "0123456789abcdefABCDEF": is_hex = False break if is_hex: colors[int(values[0], 16)] = ( int(values[1]), int(values[2]), int(values[3])) else: colors[values[0]] = ( int(values[1]), int(values[2]), int(values[3])) f.close() #print("colors: "+repr(colors)) #sys.exit(1) xlist = [] zlist = [] # List all sectors to memory and calculate the width and heigth of the # resulting picture. conn = None cur = None if os.path.exists(path + "map.sqlite"): import sqlite3 conn = sqlite3.connect(path + "map.sqlite") cur = conn.cursor() cur.execute("SELECT `pos` FROM `blocks`") while True: r = cur.fetchone() if not r: break x, y, z = getIntegerAsBlock(r[0]) if x < sector_xmin or x > sector_xmax: continue if z < sector_zmin or z > sector_zmax: continue xlist.append(x) zlist.append(z) if os.path.exists(path + "sectors2"): for filename in os.listdir(path + "sectors2"): for filename2 in os.listdir(path + "sectors2/" + filename): x = hex_to_int(filename) z = hex_to_int(filename2) if x < sector_xmin or x > sector_xmax: continue if z < sector_zmin or z > sector_zmax: continue xlist.append(x) zlist.append(z) if os.path.exists(path + "sectors"): for filename in os.listdir(path + "sectors"): x = hex4_to_int(filename[:4]) z = hex4_to_int(filename[-4:]) if x < sector_xmin or x > sector_xmax: continue if z < sector_zmin or z > sector_zmax: continue xlist.append(x) zlist.append(z) if len(xlist) == 0 or len(zlist) == 0: print("World does not exist.") sys.exit(1) # Get rid of doubles xlist, zlist = zip(*sorted(set(zip(xlist, zlist)))) minx = min(xlist) minz = min(zlist) maxx = max(xlist) maxz = max(zlist) w = (maxx - minx) * 16 + 16 h = (maxz - minz) * 16 + 16 print("Result image (w=" + str(w) + " h=" + str(h) + ") will be written to " + output) im = Image.new("RGB", (w + border, h + border), bgcolor) draw = ImageDraw.Draw(im) impix = im.load() stuff = {} unknown_node_names = [] unknown_node_ids = [] starttime = time.time() CONTENT_WATER = 2 def content_is_ignore(d): return d in [0, "ignore"] def content_is_water(d): return d in [2, 9] def content_is_air(d): return d in [126, 127, 254, "air"] def read_content(mapdata, version, datapos): if version >= 24: return (mapdata[datapos*2] << 8) | (mapdata[datapos*2 + 1]) elif version >= 20: if mapdata[datapos] < 0x80: return mapdata[datapos] else: return (mapdata[datapos] << 4) | (mapdata[datapos + 0x2000] >> 4) elif 16 <= version < 20: return TRANSLATION_TABLE.get(mapdata[datapos], mapdata[datapos]) else: raise Exception("Unsupported map format: " + str(version)) def read_mapdata(mapdata, version, pixellist, water, day_night_differs, id_to_name): global stuff # oh my :-) global unknown_node_names global unknown_node_ids if(len(mapdata) < 4096): print("bad: " + xhex + "/" + zhex + "/" + yhex + " " + \ str(len(mapdata))) else: chunkxpos = xpos * 16 chunkypos = ypos * 16 chunkzpos = zpos * 16 content = 0 datapos = 0 for (x, z) in reversed(pixellist): for y in reversed(range(16)): datapos = x + y * 16 + z * 256 content = read_content(mapdata, version, datapos) # Try to convert id to name try: content = id_to_name[content] except KeyError: pass if content_is_ignore(content): pass elif content_is_air(content): pass elif content_is_water(content): water[(x, z)] += 1 # Add dummy stuff for drawing sea without seabed stuff[(chunkxpos + x, chunkzpos + z)] = ( chunkypos + y, content, water[(x, z)], day_night_differs) elif content in colors: # Memorize information on the type and height of # the block and for drawing the picture. stuff[(chunkxpos + x, chunkzpos + z)] = ( chunkypos + y, content, water[(x, z)], day_night_differs) pixellist.remove((x, z)) break else: if type(content) == str: if content not in unknown_node_names: unknown_node_names.append(content) #print("unknown node: %s/%s/%s x: %d y: %d z: %d block name: %s" # % (xhex, zhex, yhex, x, y, z, content)) else: if content not in unknown_node_ids: unknown_node_ids.append(content) #print("unknown node: %s/%s/%s x: %d y: %d z: %d block id: %x" # % (xhex, zhex, yhex, x, y, z, content)) # Go through all sectors. for n in range(len(xlist)): #if n > 500: # break if n % 200 == 0: nowtime = time.time() dtime = nowtime - starttime try: n_per_second = 1.0 * n / dtime except ZeroDivisionError: n_per_second = 0 if n_per_second != 0: seconds_per_n = 1.0 / n_per_second time_guess = seconds_per_n * len(xlist) remaining_s = time_guess - dtime remaining_minutes = int(remaining_s / 60) remaining_s -= remaining_minutes * 60 print("Processing sector " + str(n) + " of " + str(len(xlist)) + " (" + str(round(100.0 * n / len(xlist), 1)) + "%)" + " (ETA: " + str(remaining_minutes) + "m " + str(int(remaining_s)) + "s)") xpos = xlist[n] zpos = zlist[n] xhex = int_to_hex3(xpos) zhex = int_to_hex3(zpos) xhex4 = int_to_hex4(xpos) zhex4 = int_to_hex4(zpos) sector1 = xhex4.lower() + zhex4.lower() sector2 = xhex.lower() + "/" + zhex.lower() ylist = [] sectortype = "" if cur: psmin = getBlockAsInteger((xpos, -2048, zpos)) psmax = getBlockAsInteger((xpos, 2047, zpos)) cur.execute("SELECT `pos` FROM `blocks` WHERE `pos`>=? AND `pos`<=? AND (`pos` - ?) % 4096 = 0", (psmin, psmax, psmin)) while True: r = cur.fetchone() if not r: break pos = getIntegerAsBlock(r[0])[1] ylist.append(pos) sectortype = "sqlite" try: for filename in os.listdir(path + "sectors/" + sector1): if(filename != "meta"): pos = int(filename, 16) if(pos > 32767): pos -= 65536 ylist.append(pos) sectortype = "old" except OSError: pass if sectortype == "": try: for filename in os.listdir(path + "sectors2/" + sector2): if(filename != "meta"): pos = int(filename, 16) if(pos > 32767): pos -= 65536 ylist.append(pos) sectortype = "new" except OSError: pass if sectortype == "": continue ylist.sort() # Make a list of pixels of the sector that are to be looked for. pixellist = [] water = {} for x in range(16): for z in range(16): pixellist.append((x, z)) water[(x, z)] = 0 # Go through the Y axis from top to bottom. for ypos in reversed(ylist): try: #print("("+str(xpos)+","+str(ypos)+","+str(zpos)+")") yhex = int_to_hex4(ypos) if sectortype == "sqlite": ps = getBlockAsInteger((xpos, ypos, zpos)) cur.execute("SELECT `data` FROM `blocks` WHERE `pos`==? LIMIT 1", (ps,)) r = cur.fetchone() if not r: continue f = cStringIO.StringIO(r[0]) else: if sectortype == "old": filename = path + "sectors/" + sector1 + "/" + yhex.lower() else: filename = path + "sectors2/" + sector2 + "/" + yhex.lower() f = file(filename, "rb") # Let's just memorize these even though it's not really necessary. version = readU8(f) flags = f.read(1) #print("version="+str(version)) #print("flags="+str(version)) # Check flags is_underground = ((ord(flags) & 1) != 0) day_night_differs = ((ord(flags) & 2) != 0) lighting_expired = ((ord(flags) & 4) != 0) generated = ((ord(flags) & 8) != 0) #print("is_underground="+str(is_underground)) #print("day_night_differs="+str(day_night_differs)) #print("lighting_expired="+str(lighting_expired)) #print("generated="+str(generated)) if version >= 22: content_width = readU8(f) params_width = readU8(f) # Node data dec_o = zlib.decompressobj() try: mapdata = array.array("B", dec_o.decompress(f.read())) except: mapdata = [] # Reuse the unused tail of the file f.close(); f = cStringIO.StringIO(dec_o.unused_data) #print("unused data: "+repr(dec_o.unused_data)) # zlib-compressed node metadata list dec_o = zlib.decompressobj() try: metaliststr = array.array("B", dec_o.decompress(f.read())) # And do nothing with it except: metaliststr = [] # Reuse the unused tail of the file f.close(); f = cStringIO.StringIO(dec_o.unused_data)