aboutsummaryrefslogtreecommitdiff
path: root/models/trackplane.b3d
blob: b4728c35e04661d11d1a4e61d19e2f821ab64761 (plain)
ofshex dumpascii
0000 42 42 33 44 fe 00 00 00 01 00 00 00 4e 4f 44 45 f2 00 00 00 50 6c 61 6e 65 00 00 00 00 00 00 00 BB3D........NODE....Plane.......
0020 00 00 00 00 00 00 00 00 80 3f 00 00 80 3f 00 00 80 3f 00 00 80 3f 00 00 00 00 00 00 00 00 00 00 .........?...?...?...?..........
0040 00 00 4d 45 53 48 bc 00 00 00 ff ff ff ff 56 52 54 53 8c 00 00 00 01 00 00 00 01 00 00 00 02 00 ..MESH........VRTS..............
0060 00 00 00 00 80 bf 58 81 f0 be 00 00 80 bf 00 00 00 00 00 00 80 3f 00 00 00 00 5a ac d1 38 70 f9 ......X..............?....Z..8p.
0080 7f 3f 00 00 80 3f 58 81 f0 be 00 00 80 bf 00 00 00 00 00 00 80 3f 00 00 00 00 6f f9 7f 3f 73 f9 .?...?X..............?....o..?s.
00a0 7f 3f 00 00 80 3f 58 81 f0 be 00 00 80 3f 00 00 00 00 00 00 80 3f 00 00 00 00 6f f9 7f 3f 00 c0 .?...?X......?.......?....o..?..
00c0 d1 38 00 00 80 bf 58 81 f0 be 00 00 80 3f 00 00 00 00 00 00 80 3f 00 00 00 00 5a ac d1 38 00 c0 .8....X......?.......?....Z..8..
00e0 d1 38 54 52 49 53 1c 00 00 00 ff ff ff ff 02 00 00 00 01 00 00 00 00 00 00 00 03 00 00 00 02 00 .8TRIS..........................
0100 00 00 00 00 00 00 ......
3' href='#n83'>83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
#!/usr/bin/python3

# Loads block files from sectors folders into map.sqlite database.
# The sectors folder should be safe to remove after this prints "Finished."

import time, os, sys

try:
	import sqlite3
except:
	exit('You need to have the Python sqlite3 module.')

path = "../world/"

paths = []

# sectors2 gets to try first
if os.path.isdir(path + 'sectors2/'):
	paths.append('sectors2')
if os.path.isdir(path + 'sectors/'):
	paths.append('sectors')

if not paths:
	exit('Could not find sectors folder at ' + path + 'sectors2/ or ' + path + 'sectors/')

def parseSigned12bit(u):
	u = int('0x'+u, 16)
	return (u if u < 2**11 else u - 2**12)

def parseSigned16bit(u):
	u = int('0x'+u, 16)
	return (u if u < 2**15 else u - 2**16)

def int64(u):
	while u >= 2**63:
		u -= 2**64
	while u <= -2**63:
		u += 2**64
	return u

# Convert sector folder(s) to integer
def getSectorPos(dirname):
	if len(dirname) == 8:
		# Old layout
		x = parseSigned16bit(dirname[:4])
		z = parseSigned16bit(dirname[4:])
	elif len(dirname) == 7:
		# New layout
		x = parseSigned12bit(dirname[:3])
		z = parseSigned12bit(dirname[4:])
	else:
		print('Terrible sector at ' + dirname)
		return
	
	return x, z

# Convert block file to integer position
def getBlockPos(sectordir, blockfile):
	p2d = getSectorPos(sectordir)
	
	if not p2d:
		return
	
	if len(blockfile) != 4:
		print("Invalid block filename: " + blockfile)
	
	y = parseSigned16bit(blockfile)
	
	return p2d[0], y, p2d[1]

# Convert location to integer
def getBlockAsInteger(p):