[pypy-svn] r62413 - pypy/trunk/pypy/lang/gameboy

cami at codespeak.net cami at codespeak.net
Mon Mar 2 17:34:05 CET 2009


Author: cami
Date: Mon Mar  2 17:34:05 2009
New Revision: 62413

Modified:
   pypy/trunk/pypy/lang/gameboy/constants.py
   pypy/trunk/pypy/lang/gameboy/video.py
Log:
renaming OBJECTS_PER_LINE to SPRITES_PER_LINE


Modified: pypy/trunk/pypy/lang/gameboy/constants.py
==============================================================================
--- pypy/trunk/pypy/lang/gameboy/constants.py	(original)
+++ pypy/trunk/pypy/lang/gameboy/constants.py	Mon Mar  2 17:34:05 2009
@@ -143,7 +143,7 @@
 MODE_1_END_TICKS   = 1 # V-Blank Line 153
  
 # Objects per Line
-OBJECTS_PER_LINE   = 10
+SPRITES_PER_LINE   = 10
  
 # LCD Color Palette
 #COLOR_MAP =[

Modified: pypy/trunk/pypy/lang/gameboy/video.py
==============================================================================
--- pypy/trunk/pypy/lang/gameboy/video.py	(original)
+++ pypy/trunk/pypy/lang/gameboy/video.py	Mon Mar  2 17:34:05 2009
@@ -139,9 +139,9 @@
         self.oam        = [0] * constants.OAM_SIZE
         self.reset_all_sprites()
         
-        #XXX remove those dumb helper "objects"
+        #XXX remove those dumb helper "shown_sprites"
         self.line       = [0] * (SPRITE_SIZE + GAMEBOY_SCREEN_WIDTH + SPRITE_SIZE)
-        self.objects    = [0] * constants.OBJECTS_PER_LINE
+        self.shown_sprites    = [0] * constants.SPRITES_PER_LINE
         self.palette    = [0] * 1024
         
         self.frames     = 0
@@ -460,7 +460,7 @@
         count = self.scan_sprites()
         lastx = SPRITE_SIZE + GAMEBOY_SCREEN_WIDTH + SPRITE_SIZE
         for index in range(count):
-            sprite = self.objects[index]
+            sprite = self.shown_sprites[index]
             if (sprite.x + SPRITE_SIZE <= lastx):
                 sprite.draw(self)
             else:
@@ -468,27 +468,27 @@
             lastx = sprite.x
             
     def scan_sprites(self):
-        # search active objects
+        # search active shown_sprites
         count = 0
         for sprite in self.sprites:
             if sprite.is_shown_on_current_line(self):
-                self.objects[count] = sprite
+                self.shown_sprites[count] = sprite
                 count += 1
-                if count >= constants.OBJECTS_PER_LINE:
+                if count >= constants.SPRITES_PER_LINE:
                     break
         self.sort_scan_sprite(count)
         return count
 
     def sort_scan_sprite(self, count):
         # TODO: optimize :)
-        # sort objects from high to low priority using the real tile_address
+        # sort shown_sprites from high to low priority using the real tile_address
         for index in range(count):
             highest = index
             for right in range(index+1, count):
-                if self.objects[right].x > self.objects[highest].x:
+                if self.shown_sprites[right].x > self.shown_sprites[highest].x:
                     highest = right
-            self.objects[index], self.objects[highest] = \
-                    self.objects[highest], self.objects[index]
+            self.shown_sprites[index], self.shown_sprites[highest] = \
+                    self.shown_sprites[highest], self.shown_sprites[index]
 
     def draw_tiles(self, x, tile_map, tile_data):
         while x < GAMEBOY_SCREEN_WIDTH+SPRITE_SIZE:



More information about the Pypy-commit mailing list