Commits

Anonymous committed 1c8cb3c Merge

Fixed some merging problems.

Comments (0)

Files changed (4)

FatxFast/graphics.py

         self.config = config
         flags = 0
         if self.config.fullscreen:
-            flags = pygame.FULLSCREEN
+            flags = flags | pygame.FULLSCREEN
         self.screen = pygame.display.set_mode(reso, flags)
         self.icon_image = resource_manager.load_image("ico.gif")
         pygame.display.set_icon(self.icon_image)

FatxFast/gui/hud/rageframe.py

 from FatxFast.gui.boxwidget import BoxWidget
 from FatxFast.gui.textwidget import TextWidget
 from FatxFast.gui.hud.frame import Frame
-from FatxFast.objects.animation import Animation
 from FatxFast.objects.buffs import COFFEE_BUFF_ID
 from FatxFast.resource import resource_manager
 import pygame
     Base image for the progression bar has to be supplied."""
     def __init__(self, game, player, **kwargs):
         super(RageFrame, self).__init__(game, **kwargs)
-        self.animation = Animation("progressbar.png", 
-            tilewidth=self.rect.width,
-            tileheight=self.rect.height)
         self.player = player
         self.image = resource_manager.load_image("progressbar.png")
         self._buffcount = 0

FatxFast/objects/player.py

             del self.items[itemname]
 
     def turbo(self):
+        if self._turboing:
+            return False
         self._turboing = True
+        self._delay = self._delay/2
         self.physics.maxspeed = self.physics.get_default_maxspeed()*1.5
 
     def set_turbo(self, amount):
         self._turbo = amount
 
     def stop_turbo(self):
-        self._turboing = False
+        if not self._turboing:
+            return False
+        self._turboing = False 
+        self._delay = self._delay*2
         self.physics.maxspeed = self.physics.get_default_maxspeed()
 
     def update(self, dt):
     import glob, fnmatch
     import sys, os, shutil
     import operator
+    import re
+    import subprocess
 except ImportError, message:
     raise SystemExit,  "Unable to load module. %s" % message
  
         #Add font to list of extension to be copied
         extensions.append(Module("pygame.font", pygame_default_font))
         py2exe.build_exe.py2exe.copy_extensions(self, extensions)
- 
+
 class BuildExe:
     def __init__(self):
         #Name of starting .py
  
         #Dist directory
         self.dist_dir ='dist'
- 
+        
+
     ## Code from DistUtils tutorial at http://wiki.python.org/moin/Distutils/Tutorial
     ## Originally borrowed from wxPython's setup and config files
     def opj(self, *args):
         path = os.path.join(*args)
         return os.path.normpath(path)
- 
+  
+    def _clean_up(self):
+        # Fixes any post build problems, THIS WILL REMOVE dist/FatxFast!
+        source_dir = "dist/FatxFast/rsc"
+        if not (os.path.isdir(source_dir)):
+            return False
+        if not subprocess.call(["mv", source_dir, "dist/"]):
+            subprocess.call(["rmdir", "dist/FatxFast"])
+
     def find_data_files(self, srcdir, *wildcards, **kw):
         # get a list of all files under the srcdir matching wildcards,
         # returned in a format to be used for install_data
                         srcdir,
                         [os.path.basename(f) for f in glob.glob(self.opj(srcdir, '*'))])
         return file_list
- 
+
+    def _release_fix_main(self, line):
+        # Adds a pygame._view to the imports, fixes the pathing
+        line = re.sub(
+            "import pygame", "import pygame, pygame._view", line)
+        line = re.sub(
+            "os.path.abspath\(__file__\)", 
+            "os.path.abspath(sys.argv[0])", line)
+        return line
+
+    def _release_fix_resources(self, line):
+        # Fixes the rsc pathing problem for the binary file
+        line = re.sub(
+            "return os.path.join\(os.path.dirname\(__file__\), "+\
+                "\"rsc\", resource_name\)",
+            "return os.path.join(\"rsc\", resource_name)", line)
+        return line
+
+    def release_fix_bugs(self):
+        # Fixes the explicit binary generation releated source "bugs"
+        # File name : method for regexing the line, method returns regex'd line
+        # Does multiple regular expressions per method call
+        files_to_fix = {
+            self.script: self._release_fix_main,
+            "FatxFast/resource.py": self._release_fix_resources
+            }
+        for filename, method in files_to_fix.items():
+            with open(filename, 'r') as resources:
+                lines = resources.readlines()
+            with open(filename, 'w') as resources:
+                for line in lines:
+                    resources.write(method(line))
+
     def run(self):
+        self.release_fix_bugs()
         if os.path.isdir(self.dist_dir): #Erase previous destination dir
             shutil.rmtree(self.dist_dir)
         
         
         if os.path.isdir('build'): #Clean up build dir
             shutil.rmtree('build')
+
+        
+ 
+        
  
 if __name__ == '__main__':
+    if not (sys.platform("win32") or sys.platform("cygwin")):
+        sys.exit("Only use this to build windows binaries!")
     if operator.lt(len(sys.argv), 2):
         sys.argv.append('py2exe')
     BuildExe().run() #Run generation