From 4bece07dc09ed7d0624a40fefc3876d7ca90b82e Mon Sep 17 00:00:00 2001 From: Ingo Ruhnke Date: Thu, 25 Mar 2004 00:24:55 +0000 Subject: [PATCH] fixed converter to handle the new format SVN-Revision: 350 --- contrib/levelconverter-0.0.6_0.0.7.py | 51 +++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/contrib/levelconverter-0.0.6_0.0.7.py b/contrib/levelconverter-0.0.6_0.0.7.py index 2a921b255..26257d06f 100755 --- a/contrib/levelconverter-0.0.6_0.0.7.py +++ b/contrib/levelconverter-0.0.6_0.0.7.py @@ -2,6 +2,53 @@ import sys +translate_array \ + =[['.', "none", 0], + ['0', "enemy0", 0], + ['1', "enemy1", 1], + ['2', "enemy2", 2], + ['x', "brick0.png", 77], + ['X', "brick0.png", 77], + ['y', "brick1.png", 78], + ['Y', "brick1.png", 78], + ['A', "box-full.png", 83], + ['B', "box-full.png", 83], + ['!', "box-full.png", 83], + ['a', "box-empty.png", 84], + ['C', "cloud-00.png", 85], + ['D', "cloud-00.png", 86], + ['E', "cloud-00.png", 87], + ['F', "cloud-00.png", 88], + ['c', "cloud-00.png", 89], + ['d', "cloud-00.png", 90], + ['e', "cloud-00.png", 91], + ['f', "cloud-00.png", 92], + ['g', "bkgd-00.png", 93], + ['h', "bkgd-01.png", 94], + ['i', "bkgd-02.png", 95], + ['j', "bkgd-03.png", 96], + ['G', "bkgd-10.png", 97], + ['H', "bkgd-11.png", 98], + ['I', "bkgd-12.png", 99], + ['J', "bkgd-13.png", 100], + ['#', "solid0.png", 11], + ['[', "solid1.png", 13], + ['=', "solid2.png", 14], + [']', "solid3.png", 15], + ['$', "distro", 82], + ['^', "water", 76], + ['*', "poletop.png", 80], + ['|', "pole.png", 79], + ['\\',"flag.png", 81], + ['&', "water.png", 75]] + +def translate(c): + for i in translate_array: + if c == i[0]: + return i[2] + print >>sys.stderr, "Couldn't translate tile %s" % c + return 0 + if len(sys.argv) != 2: print "Usage: %s FILENAME" % sys.argv[0] sys.exit() @@ -39,10 +86,10 @@ print " (bkgd_blue %s)" % blue print " (time %s)" % time print " (width %s)" % width print " (gravity %s)" % gravity -print " (tilemap " +print " (interactive-tm " for i in content[10:]: for x in i: - sys.stdout.write("%3d" % ord(x)) + sys.stdout.write("%3d" % translate(x)) sys.stdout.write(" ") print "" print " )" -- 2.11.0