diff options
author | Nils Dagsson Moskopp <nils@dieweltistgarnichtso.net> | 2011-07-30 18:53:54 +0200 |
---|---|---|
committer | Nils Dagsson Moskopp <nils@dieweltistgarnichtso.net> | 2011-07-30 18:55:43 +0200 |
commit | 4ef9c7675ada82961d83601712a47ebad78b67b5 (patch) | |
tree | cdfd863219a8dc1031e727740e7d895296c5855d /util | |
parent | f69123050b62ada635751b7155bb6822b0a97a9b (diff) | |
parent | dbea511a6f877450cfd5adb86efa55a8f00cc9a1 (diff) | |
download | minetest-4ef9c7675ada82961d83601712a47ebad78b67b5.tar.gz minetest-4ef9c7675ada82961d83601712a47ebad78b67b5.tar.bz2 minetest-4ef9c7675ada82961d83601712a47ebad78b67b5.zip |
Merge remote-tracking branch 'origin/upstream'
Diffstat (limited to 'util')
-rwxr-xr-x | util/minetestmapper.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/util/minetestmapper.py b/util/minetestmapper.py index 5f3aab456..162ceb204 100755 --- a/util/minetestmapper.py +++ b/util/minetestmapper.py @@ -170,6 +170,9 @@ stuff = {} starttime = time.time() +def data_is_air(d): + return (d == 254 or d == 126) + # Go through all sectors. for n in range(len(xlist)): #if n > 500: @@ -283,7 +286,7 @@ for n in range(len(xlist)): for (x, z) in reversed(pixellist): for y in reversed(range(16)): datapos = x + y * 16 + z * 256 - if(ord(mapdata[datapos]) != 254 and ord(mapdata[datapos]) in colors): + if(not data_is_air(ord(mapdata[datapos])) and ord(mapdata[datapos]) in colors): if(ord(mapdata[datapos]) == 2 or ord(mapdata[datapos]) == 9): water[(x, z)] += 1 # Add dummy stuff for drawing sea without seabed @@ -293,7 +296,7 @@ for n in range(len(xlist)): # Memorize information on the type and height of the block and for drawing the picture. stuff[(chunkxpos + x, chunkzpos + z)] = (chunkypos + y, ord(mapdata[datapos]), water[(x, z)]) break - elif(ord(mapdata[datapos]) != 254 and ord(mapdata[datapos]) not in colors): + elif(not data_is_air(ord(mapdata[datapos])) and ord(mapdata[datapos]) not in colors): print "strange block: " + xhex + "/" + zhex + "/" + yhex + " x: " + str(x) + " y: " + str(y) + " z: " + str(z) + " palikka: " + str(ord(mapdata[datapos])) # After finding all the pixels in the sector, we can move on to the next sector without having to continue the Y axis. @@ -324,7 +327,7 @@ for n in range(len(xlist)): for (x, z) in reversed(pixellist): for y in reversed(range(16)): datapos = x + y * 16 + z * 256 - if(ord(mapdata[datapos]) != 254 and ord(mapdata[datapos]) in colors): + if(not data_is_air(ord(mapdata[datapos])) and ord(mapdata[datapos]) in colors): if(ord(mapdata[datapos]) == 2 or ord(mapdata[datapos]) == 9): water[(x, z)] += 1 # Add dummy stuff for drawing sea without seabed @@ -334,7 +337,7 @@ for n in range(len(xlist)): # Memorize information on the type and height of the block and for drawing the picture. stuff[(chunkxpos + x, chunkzpos + z)] = (chunkypos + y, ord(mapdata[datapos]), water[(x, z)]) break - elif(ord(mapdata[datapos]) != 254 and ord(mapdata[datapos]) not in colors): + elif(not data_is_air(ord(mapdata[datapos])) and ord(mapdata[datapos]) not in colors): print "outo palikka: " + xhex + "/" + zhex + "/" + yhex + " x: " + str(x) + " y: " + str(y) + " z: " + str(z) + " palikka: " + str(ord(mapdata[datapos])) # After finding all the pixels in the sector, we can move on to the next sector without having to continue the Y axis. |