From 8b9951b410f17e4e478c1f79e667e5deb4339efb Mon Sep 17 00:00:00 2001 From: Dan Olson Date: Fri, 27 Nov 2009 03:57:32 -0800 Subject: [PATCH] Fuzz and Shadow patches working --- pyhexen.py | 6 +++--- pyhexen/vid.py | 17 +++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/pyhexen.py b/pyhexen.py index d35199d..5dbc1c6 100644 --- a/pyhexen.py +++ b/pyhexen.py @@ -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')) diff --git a/pyhexen/vid.py b/pyhexen/vid.py index 6023a98..4fde48a 100644 --- a/pyhexen/vid.py +++ b/pyhexen/vid.py @@ -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 -- 2.39.2