comparison 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
comparison
equal deleted inserted replaced
315:e935ed8dc5e6 316:f0be7ea62330
161 161
162 162
163 def run_iter(self, keystate): 163 def run_iter(self, keystate):
164 # 1. VMs. 164 # 1. VMs.
165 self.ecl_runner.run_iter() 165 self.ecl_runner.run_iter()
166
167 # 2. Modify difficulty
166 if self.frame % (32*60) == (32*60): #TODO: check if that is really that frame. 168 if self.frame % (32*60) == (32*60): #TODO: check if that is really that frame.
167 self.modify_difficulty(+100) 169 self.modify_difficulty(+100)
168 170
169 # 2. Filter out destroyed enemies 171 # 3. Filter out destroyed enemies
170 self.enemies = [enemy for enemy in self.enemies if not enemy.removed] 172 self.enemies = [enemy for enemy in self.enemies if not enemy.removed]
171 self.effects = [effect for effect in self.effects if not effect.removed] 173 self.effects = [effect for effect in self.effects if not effect.removed]
172 self.bullets = [bullet for bullet in self.bullets if not bullet.removed] 174 self.bullets = [bullet for bullet in self.bullets if not bullet.removed]
173 self.cancelled_bullets = [bullet for bullet in self.cancelled_bullets if not bullet.removed] 175 self.cancelled_bullets = [bullet for bullet in self.cancelled_bullets if not bullet.removed]
174 self.items = [item for item in self.items if not item.removed] 176 self.items = [item for item in self.items if not item.removed]
175 177
176 178
177 # 3. Let's play! 179 # 4. Let's play!
178 # In the original game, updates are done in prioritized functions called "chains" 180 # In the original game, updates are done in prioritized functions called "chains"
179 # We have to mimic this functionnality to be replay-compatible with the official game. 181 # We have to mimic this functionnality to be replay-compatible with the official game.
180 182
181 # Pri 6 is background 183 # Pri 6 is background
182 self.update_background() #TODO: Pri unknown 184 self.update_background() #TODO: Pri unknown
189 self.update_bullets() # Pri 11 191 self.update_bullets() # Pri 11
190 for laser in self.lasers: #TODO: what priority is it? 192 for laser in self.lasers: #TODO: what priority is it?
191 laser.update() 193 laser.update()
192 self.interface.update() # Pri 12 194 self.interface.update() # Pri 12
193 195
194 # 4. Cleaning 196 # 5. Clean up
195 self.cleanup() 197 self.cleanup()
196 198
197 self.frame += 1 199 self.frame += 1
198 200
199 201