- added converter script for levels
authorIngo Ruhnke <grumbel@gmx.de>
Sat, 20 Mar 2004 21:21:11 +0000 (21:21 +0000)
committerIngo Ruhnke <grumbel@gmx.de>
Sat, 20 Mar 2004 21:21:11 +0000 (21:21 +0000)
SVN-Revision: 283

contrib/levelconvert.py [new file with mode: 0755]

diff --git a/contrib/levelconvert.py b/contrib/levelconvert.py
new file mode 100755 (executable)
index 0000000..7c7085b
--- /dev/null
@@ -0,0 +1,47 @@
+#!/usr/bin/python
+
+import sys
+
+print ";; Converting:", sys.argv[1]
+
+f = open(sys.argv[1], 'r')
+mycontent = f.readlines()
+
+content = []
+
+for i in mycontent:
+    content.append(i[:-1])
+
+name       = content[0]
+theme      = content[1]
+time       = content[2]
+music      = content[3]
+background = content[4]
+red        = content[5]
+blue       = content[6]
+green      = content[7]
+width      = content[8]
+height     = "15"
+gravity    = content[9]
+
+print "(level"
+print "  (name \"%s\")" % name
+print "  (theme \"%s\")" % theme
+print "  (music \"%s\")" % music
+print "  (background \"%s\")" % background
+print "  (bkgd_red   %s)" % red
+print "  (bkgd_green %s)" % green
+print "  (bkgd_blue  %s)" % blue
+print "  (time %s)" % time
+print "  (width %s)" % width
+print "  (gravity %s)" % gravity
+print "  (tilemap "
+for i in content[10:]:
+    for x in i:
+        sys.stdout.write("%3d" % ord(x))
+        sys.stdout.write(" ")
+    print ""
+print "   )"
+print ")"
+
+# EOF #