Mercurial > touhou
comparison pytouhou/game/enemymanager.py @ 93:d167280a82fc
Handle timeout callbacks, and clean up unneeded things
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Sun, 04 Sep 2011 17:34:45 +0200 |
parents | 630e9045e851 |
children | ca571697ec83 |
comparison
equal
deleted
inserted
replaced
92:85f3b8ba3f24 | 93:d167280a82fc |
---|---|
269 self._game_state = game_state | 269 self._game_state = game_state |
270 self.stage = stage | 270 self.stage = stage |
271 self.anm_wrapper = anm_wrapper | 271 self.anm_wrapper = anm_wrapper |
272 self.main = [] | 272 self.main = [] |
273 self.ecl = ecl | 273 self.ecl = ecl |
274 self.objects_by_texture = {} | |
275 self.enemies = [] | 274 self.enemies = [] |
276 self.processes = [] | 275 self.processes = [] |
277 self.bullets = [] | 276 self.bullets = [] |
278 | 277 |
279 # Populate main | 278 # Populate main |
295 | 294 |
296 | 295 |
297 def update(self, frame): | 296 def update(self, frame): |
298 if self.main and self.main[0][0] == frame: | 297 if self.main and self.main[0][0] == frame: |
299 for sub, instr_type, args in self.main.pop(0)[1]: | 298 for sub, instr_type, args in self.main.pop(0)[1]: |
300 if instr_type in (0, 2, 4, 6): # Normal/mirrored enemy | 299 if instr_type in (0, 2, 4, 6) and not self._game_state.boss: |
301 x, y, z, life, unknown1, unknown2, unknown3 = args | 300 x, y, z, life, unknown1, unknown2, unknown3 = args |
302 if instr_type & 4: | 301 if instr_type & 4: |
303 if x < -990: #102h.exe@0x411820 | 302 if x < -990: #102h.exe@0x411820 |
304 x = self._game_state.prng.rand_double() * 368 | 303 x = self._game_state.prng.rand_double() * 368 |
305 if y < -990: #102h.exe@0x41184b | 304 if y < -990: #102h.exe@0x41184b |
348 | 347 |
349 #TODO: disable boss mode if it is dead/it has timeout | 348 #TODO: disable boss mode if it is dead/it has timeout |
350 if self._game_state.boss and self._game_state.boss._removed: | 349 if self._game_state.boss and self._game_state.boss._removed: |
351 self._game_state.boss = None | 350 self._game_state.boss = None |
352 | 351 |
353 #TODO | |
354 self.objects_by_texture = {} | |
355 self.get_objects_by_texture(self.objects_by_texture) | |
356 for key, (nb_vertices, vertices, uvs, colors) in self.objects_by_texture.items(): | |
357 nb_vertices = len(vertices) | |
358 vertices = pack('f' * (3 * nb_vertices), *chain(*vertices)) | |
359 uvs = pack('f' * (2 * nb_vertices), *chain(*uvs)) | |
360 colors = pack('B' * (4 * nb_vertices), *chain(*colors)) | |
361 self.objects_by_texture[key] = (nb_vertices, vertices, uvs, colors) | |
362 |