diff --git a/tools/cleanroom/cleanroom.glade b/tools/cleanroom/cleanroom.glade new file mode 100644 index 00000000..89f101e2 --- /dev/null +++ b/tools/cleanroom/cleanroom.glade @@ -0,0 +1,67 @@ + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-missing-image + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-missing-image + + + 1 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + + + + + 2 + + + + + 1 + + + + + + + + + diff --git a/tools/cleanroom/cleanroom.py b/tools/cleanroom/cleanroom.py new file mode 100644 index 00000000..ce765cb6 --- /dev/null +++ b/tools/cleanroom/cleanroom.py @@ -0,0 +1,57 @@ +#!/usr/bin/python + +# cleanroom.py: a clean-room IWAD texture1 lump constructor + +from sys import argv, exit +from os import rmdir, mkdir, system, chdir, getcwd +from tempfile import mkdtemp + +if len(argv) != 2: + print "usage: cleanroom.py IWAD" + exit(1) + +if system("which deutex >/dev/null"): + print "you need to install deutex in the PATH" + exit(1) + +iwad = argv[1] +origdir = getcwd() + +if iwad[0] != "/": + iwad = origdir + "/" + iwad + +tmpdir = mkdtemp() +chdir(tmpdir) + +system("deutex -textures -extract " +iwad + " >/dev/null 2>&1") +system("deutex -patches -extract " +iwad + " >/dev/null 2>&1") + +# parse the textures data + +texture1 = file(tmpdir + "/textures/texture1.txt", "r").read() + +class Texture: + def __init__(self,name,width,height): + self.name = name + self.width = width + self.height = height + self.patches = [] + +textures = [] +current = None +for line in texture1.split("\n"): + if len(line) == 0 or line[0] == ";": + continue + elif line[0] == "*" and current: + current.patches.append(line) + else: + line = line.split() + current = Texture(line[0],line[1],line[2]) + textures.append(current) + +# we are not interested in 1-patch textures +textures = filter(lambda x: len(x.patches) > 1, textures) +print len(textures) + +chdir(origdir) +rmdir(tmpdir) diff --git a/tools/cleanroom/sw2_1.gif b/tools/cleanroom/sw2_1.gif new file mode 100644 index 00000000..53182d40 Binary files /dev/null and b/tools/cleanroom/sw2_1.gif differ diff --git a/tools/cleanroom/tmp_cleanui.py b/tools/cleanroom/tmp_cleanui.py new file mode 100644 index 00000000..880328c0 --- /dev/null +++ b/tools/cleanroom/tmp_cleanui.py @@ -0,0 +1,20 @@ +#!/usr/bin/python + +import sys +import gtk +import gtk.glade + +class HellowWorldGTK: + """This is an Hello World GTK application""" + def __init__(self): + self.gladefile = "cleanroom.glade" + self.wTree = gtk.glade.XML(self.gladefile,"window1") + + self.image1 = self.wTree.get_widget("orig_texture") + self.image1.set_from_file("sw2_1.gif") + + self.wTree.get_widget("window1").connect("destroy", gtk.main_quit) + +if __name__ == "__main__": + hwg = HellowWorldGTK() + gtk.main()