diff pytouhou/game/game.py @ 316:f0be7ea62330

Fix a bug with ECL instruction 96, and fix overall ECL handling. The issue with instruction 96 was about death callbacks, being executed on the caller of instruction 96 instead of the dying enemies. This was introduced by changeset 5930b33a0370. Additionnaly, ECL processes are now an attribute of the Enemy, and death/timeout conditions are checked right after the ECL frame, even if the ECL script has already ended, just like in the original game.
author Thibaut Girka <thib@sitedethib.com>
date Thu, 29 Mar 2012 21:18:35 +0200
parents 52d791bb7c32
children 1a4ffdda8735
line wrap: on
line diff
--- a/pytouhou/game/game.py
+++ b/pytouhou/game/game.py
@@ -163,10 +163,12 @@ class Game(object):
     def run_iter(self, keystate):
         # 1. VMs.
         self.ecl_runner.run_iter()
+
+        # 2. Modify difficulty
         if self.frame % (32*60) == (32*60): #TODO: check if that is really that frame.
             self.modify_difficulty(+100)
 
-        # 2. Filter out destroyed enemies
+        # 3. Filter out destroyed enemies
         self.enemies = [enemy for enemy in self.enemies if not enemy.removed]
         self.effects = [effect for effect in self.effects if not effect.removed]
         self.bullets = [bullet for bullet in self.bullets if not bullet.removed]
@@ -174,7 +176,7 @@ class Game(object):
         self.items = [item for item in self.items if not item.removed]
 
 
-        # 3. Let's play!
+        # 4. Let's play!
         # In the original game, updates are done in prioritized functions called "chains"
         # We have to mimic this functionnality to be replay-compatible with the official game.
 
@@ -191,7 +193,7 @@ class Game(object):
             laser.update()
         self.interface.update() # Pri 12
 
-        # 4. Cleaning
+        # 5. Clean up
         self.cleanup()
 
         self.frame += 1