Fuzz and Shadow patches working
authorDan Olson <theoddone33@icculus.org>
Fri, 27 Nov 2009 11:57:32 +0000 (03:57 -0800)
committerDan Olson <theoddone33@icculus.org>
Fri, 27 Nov 2009 11:57:32 +0000 (03:57 -0800)
pyhexen.py
pyhexen/vid.py

index d35199d..5dbc1c6 100644 (file)
@@ -8,11 +8,11 @@ def input(events):
                if event.type == QUIT:
                        sys.exit(0)
 
-wad = pyhexen.wad.WadReader()
+wad = pyhexen.wad.WadReader ()
 wad.InitMultipleFiles (['heretic.wad'])
 
-vid = pyhexen.vid.Video()
-vid.Init()
+vid = pyhexen.vid.Video (wad)
+vid.Init ()
 
 vid.SetPalette (wad.CacheLumpName('PLAYPAL'))
 vid.DrawRawScreen (wad.CacheLumpName('TITLE'))
index 6023a98..4fde48a 100644 (file)
@@ -1,13 +1,16 @@
 import pygame
 import struct
 import string
+import wad
 
 class VidException(Exception):
        pass
        
 class Video:
-       def __init__(self):
+       def __init__(self, wad):
                self.palette = []
+               self.wad = wad
+               self.tinttab = self.wad.CacheLumpName ('TINTTAB')
                
        # Stuff from I_* in the C code.
        def SetPalette(self, data):
@@ -57,18 +60,16 @@ class Video:
                self.screen = pygame.display.get_surface()
                
        def DrawRawScreen(self, lump):
-               # Horribly inefficent for now.
                self.__blitRaw (lump, 320, 200)
                                
        def DrawPatch(self, x, y, lump):
-               # Horribly inefficent for now.
                self.__blitPatch (lump, x, y)
                                
        def DrawFuzzPatch(self, x, y, lump):
-               # Stub
-               self.DrawPatch(x,y,lump)
+               trans = lambda x: ord (self.tinttab[x])
+               self.__blitPatch (lump, x, y, trans)
                
-       def DrawShadowedPatch(self,x,y,lump):
-               # Stub
-               self.DrawPatch(x,y,lump)
+       def DrawShadowedPatch(self, x, y, lump):
+               self.DrawFuzzPatch (x + 2, y + 2, lump)
+               self.DrawPatch (x, y, lump)
                
\ No newline at end of file