From 4e38509f967f3b7044f614b7d5046ad5bbf01e9d Mon Sep 17 00:00:00 2001 From: Jon Dowland Date: Sun, 24 Feb 2008 22:21:17 +0000 Subject: [PATCH] create_new.py: will create a new texture1 lump --- tools/cleanroom/create_new.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tools/cleanroom/create_new.py diff --git a/tools/cleanroom/create_new.py b/tools/cleanroom/create_new.py new file mode 100644 index 00000000..1bdd32af --- /dev/null +++ b/tools/cleanroom/create_new.py @@ -0,0 +1,30 @@ +#!/usr/bin/python +from doom import Patch, Texture + +import sys,re + +if len(sys.argv) != 2: + sys.stderr.write("usage: sw1_sw2.py \n") + sys.exit() + +infile = sys.argv[1] + +# TODO: a generalized form of this para should probably be moved into the +# Texture class +texture1 = file(infile, "r").read() +textures = {} +current = None +for line in texture1.split("\n"): + if len(line) == 0 or line[0] == ";" or line[0] == "#": + continue + elif line[0] == "*" and current: + junk,name,y,x= line.split() + current.patches.append(Patch(name,int(x),int(y))) + else: + line = line.split() + current = Texture(line[0],line[1],line[2]) + textures[line[0]] = current + +a = textures.values() +a.sort(lambda a,b: cmp(a.name,b.name)) +sys.stdout.write(''.join(map(str,a)))