Add menu, fix fuzz/shadow pass to use dest instead of source color.
authorDan Olson <theoddone33@icculus.org>
Fri, 27 Nov 2009 12:12:29 +0000 (04:12 -0800)
committerDan Olson <theoddone33@icculus.org>
Fri, 27 Nov 2009 12:12:29 +0000 (04:12 -0800)
pyhexen/menu.py [new file with mode: 0644]
pyhexen/vid.py

diff --git a/pyhexen/menu.py b/pyhexen/menu.py
new file mode 100644 (file)
index 0000000..e69de29
index 4fde48a..663b75a 100644 (file)
@@ -30,7 +30,7 @@ class Video:
                        for x in range (0, w):
                                screen[x,y] = ord (data[y * w + x])
                
-       def __blitPatch(self, data, x, y, trans = lambda x: x):
+       def __blitPatch(self, data, x, y, trans = lambda a,b: a):
                (width, height) = struct.unpack_from ('<hh', data, 0)
                (left_offset, top_offset) = struct.unpack_from('<hh', data, 4)
                column_offsets =  struct.unpack_from('<8i', data, 8)
@@ -49,7 +49,7 @@ class Video:
                                length = ord (data[col_ofs + 1])
                                source_ofs = col_ofs + 3
                                for y_ofs in range (0, length):
-                                       screen[x + x_ofs, topdelta + y_ofs] = trans(ord (data[source_ofs + y_ofs]))
+                                       screen[x + x_ofs, topdelta + y_ofs] = trans(ord (data[source_ofs + y_ofs]),screen[x + x_ofs, topdelta + y_ofs])
                                col_ofs = col_ofs + length + 4
                                topdelta = ord (data[col_ofs + 0])
                                
@@ -66,10 +66,11 @@ class Video:
                self.__blitPatch (lump, x, y)
                                
        def DrawFuzzPatch(self, x, y, lump):
-               trans = lambda x: ord (self.tinttab[x])
-               self.__blitPatch (lump, x, y, trans)
+               transparent = lambda a, b: ord (self.tinttab[a + b * 256])
+               self.__blitPatch (lump, x, y, transparent)
                
        def DrawShadowedPatch(self, x, y, lump):
-               self.DrawFuzzPatch (x + 2, y + 2, lump)
-               self.DrawPatch (x, y, lump)
+               shadow = lambda a,b: ord (self.tinttab[b * 256])
+               self.__blitPatch (lump, x + 2, y + 2, shadow)
+               self.__blitPatch (lump, x, y)
                
\ No newline at end of file