summaryrefslogtreecommitdiff
path: root/src/exporter.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/exporter.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/exporter.py b/src/exporter.py
index b90cc49..48fff23 100644
--- a/src/exporter.py
+++ b/src/exporter.py
@@ -177,6 +177,7 @@ class KPMapExporter:
requiredFixUps = []
stringsToAdd = set()
textures = set()
+ texInfo = set()
tilesets = set()
offsets = {None: 0xFFFFFFFF}
@@ -250,6 +251,8 @@ class KPMapExporter:
w, h = doodad.size
data += struct.pack('>fffffii', x, y, w, h, doodad.angle, 0, len(doodad.animations))
+
+ texInfo.add((doodad.source[0], doodad.source[1].height() * doodad.source[1].width() * 2))
texture = doodad.source[1]
textures.add(texture)
requiredFixUps.append((len(data) - 8, texture))
@@ -308,7 +311,6 @@ class KPMapExporter:
oX, oY = opposite.position
deltaX, deltaY = oX-x, oY-y
angle = math.degrees(math.atan2(deltaX, deltaY)) % 360
- print "Here: %d,%d Opposite %d,%d Delta: %d,%d Angle: %d" % (x,y,oX,oY,deltaX,deltaY,angle)
# Left = 270, Right = 90, Up = 180, Down = 0
if angle >= 225 and angle <= 315:
@@ -394,6 +396,20 @@ class KPMapExporter:
data += '\0'
# textures
+ texA = sorted(texInfo, key=lambda x: x[1])
+
+ s = 0
+ d = 0
+ for texItem in texA:
+ print texItem[1]/1000, "kb:", texItem[0]
+ s += texItem[1]
+ d += 1
+ if d == 10:
+ d = 0
+ print "So far:", s/1000, "kb"
+
+ print "Total:", s/1000, "kb"
+
texPadding = ((len(data) + 0x1F) & ~0x1F) - len(data)
data += ('\0' * texPadding)