Cheesy stubbed main menu
authorDan Olson <theoddone33@icculus.org>
Fri, 27 Nov 2009 12:54:05 +0000 (04:54 -0800)
committerDan Olson <theoddone33@icculus.org>
Fri, 27 Nov 2009 12:54:05 +0000 (04:54 -0800)
pyhexen.py
pyhexen/menu.py

index fed6d51..065095e 100644 (file)
@@ -17,11 +17,16 @@ vid.Init ()
 menu = pyhexen.menu.Menu (wad, vid)
 
 vid.SetPalette (wad.CacheLumpName('PLAYPAL'))
-vid.DrawRawScreen (wad.CacheLumpName('TITLE'))
-vid.DrawPatch (4, 160, wad.CacheLumpName('ADVISOR'))
-
-vid.WaitVBL ()
 
 while True:
+       menu.Tick ()
+       
+       vid.DrawRawScreen (wad.CacheLumpName('TITLE'))
+       vid.DrawPatch (4, 160, wad.CacheLumpName('ADVISOR'))
+
+       menu.DrawMainMenu ()
+       
+       vid.WaitVBL ()
+       
        input (pygame.event.get())
 
index c753823..032564a 100644 (file)
@@ -6,22 +6,20 @@ class Menu:
        def __init__ (self, wad, vid):
                self.wad = wad
                self.vid = vid
+               self.time = 0
+               self.active = True
                self.SkullBaseLump = self.wad.GetNumForName("M_SKL00")
                self.FontABaseLump = self.wad.GetNumForName("FONTA_S")+1
                self.FontBBaseLump = self.wad.GetNumForName("FONTB_S")+1
                
        def ProcessText (self, text, x, y, baselump, draw=True):
-               print 'Processing %s' % text
                for c in text:
-                       print 'ord %d' % ord (c)
                        if ord (c) < 33:
-                               print ("skipzored")
                                x = x + 5
                        else:
                                patch = self.wad.CacheLumpNum (baselump + ord (c) - 33)
                                (w, h) = struct.unpack_from ('<hh', patch, 0)
                                if draw:
-                                       print "Drawing at %d,%d" % (x,y)
                                        self.vid.DrawPatch (x, y, patch)
                                x  = x + w - 1
                return x
@@ -37,3 +35,17 @@ class Menu:
                
        def TextBWidth (self, text):
                return self.ProcessText (text, 0, 0, self.FontBBaseLump, False)
+               
+       def Tick (self):
+               if self.active:
+                       self.time = self.time + 1
+                       
+       def Draw (self):
+               self.DrawMainMenu ()
+               pass
+               
+       def DrawMainMenu (self):
+               frame = (self.time/3) % 18
+               self.vid.DrawPatch (88, 0, self.wad.CacheLumpName ('M_HTIC'))
+               self.vid.DrawPatch (40, 10, self.wad.CacheLumpNum (self.SkullBaseLump + (17 - frame)))
+               self.vid.DrawPatch (232, 10, self.wad.CacheLumpNum (self.SkullBaseLump + frame))