Mercurial > touhou
comparison pytouhou/game/eclrunner.py @ 57:694f25881d0f
Fix move_to interpolation, add support for a few ANM and ECL instructions
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Tue, 23 Aug 2011 19:27:24 +0200 |
parents | de358a7684c8 |
children | 3da4de9decd0 |
comparison
equal
deleted
inserted
replaced
56:299de3a9b69f | 57:694f25881d0f |
---|---|
79 try: | 79 try: |
80 frame, instr_type, rank_mask, param_mask, args = self._ecl.subs[self.sub][self.instruction_pointer] | 80 frame, instr_type, rank_mask, param_mask, args = self._ecl.subs[self.sub][self.instruction_pointer] |
81 except IndexError: | 81 except IndexError: |
82 return False | 82 return False |
83 | 83 |
84 #TODO: skip bad ranks | |
85 | |
86 if frame > self.frame: | 84 if frame > self.frame: |
87 break | 85 break |
88 else: | 86 else: |
89 self.instruction_pointer += 1 | 87 self.instruction_pointer += 1 |
88 | |
89 | |
90 #TODO: skip bad ranks | |
91 if not rank_mask & (0x100 << self._game_state.rank): | |
92 continue | |
93 | |
94 | |
90 if frame == self.frame: | 95 if frame == self.frame: |
91 try: | 96 try: |
92 callback = self._handlers[instr_type] | 97 callback = self._handlers[instr_type] |
93 except KeyError: | 98 except KeyError: |
94 print('Warning: unhandled opcode %d!' % instr_type) #TODO | 99 print('Warning: unhandled opcode %d!' % instr_type) #TODO |
124 return self._enemy.get_player_angle(player) | 129 return self._enemy.get_player_angle(player) |
125 elif value == -10022: | 130 elif value == -10022: |
126 return self._enemy.frame | 131 return self._enemy.frame |
127 elif value == -10024: | 132 elif value == -10024: |
128 return self._enemy.life | 133 return self._enemy.life |
129 raise NotImplementedError #TODO | 134 elif value == -10025: |
135 return self._enemy.select_player(self._game_state.players).character | |
136 raise NotImplementedError(value) #TODO | |
130 else: | 137 else: |
131 return value | 138 return value |
132 | 139 |
133 | 140 |
134 def _setval(self, variable_id, value): | 141 def _setval(self, variable_id, value): |
300 @instruction(57) | 307 @instruction(57) |
301 def move_to(self, duration, x, y, z): | 308 def move_to(self, duration, x, y, z): |
302 self._enemy.move_to(duration, x, y, z) | 309 self._enemy.move_to(duration, x, y, z) |
303 | 310 |
304 | 311 |
312 @instruction(61) | |
313 def stop_in(self, duration): | |
314 self._enemy.stop_in(duration) | |
315 | |
316 | |
305 @instruction(65) | 317 @instruction(65) |
306 def set_screen_box(self, xmin, ymin, xmax, ymax): | 318 def set_screen_box(self, xmin, ymin, xmax, ymax): |
307 self._enemy.screen_box = xmin, ymin, xmax, ymax | 319 self._enemy.screen_box = xmin, ymin, xmax, ymax |
308 | 320 |
309 | 321 |
310 @instruction(66) | 322 @instruction(66) |
311 def clear_screen_box(self): | 323 def clear_screen_box(self): |
312 self._enemy.screen_box = None | 324 self._enemy.screen_box = None |
325 | |
326 | |
327 @instruction(67) | |
328 def set_bullet_attributes1(self, bullet_anim, launch_anim, bullets_per_shot, | |
329 number_of_shots, speed, unknown, launch_angle, | |
330 angle, flags): | |
331 self._enemy.set_bullet_attributes(1, bullet_anim, launch_anim, | |
332 bullets_per_shot, number_of_shots, | |
333 speed, unknown, launch_angle, angle, | |
334 flags) | |
313 | 335 |
314 | 336 |
315 @instruction(77) | 337 @instruction(77) |
316 def set_bullet_interval(self, value): | 338 def set_bullet_interval(self, value): |
317 self._enemy.bullet_launch_interval = value | 339 self._enemy.bullet_launch_interval = value |
344 | 366 |
345 | 367 |
346 @instruction(100) | 368 @instruction(100) |
347 def set_death_anim(self, sprite_index): | 369 def set_death_anim(self, sprite_index): |
348 self._enemy.death_anim = sprite_index % 256 #TODO | 370 self._enemy.death_anim = sprite_index % 256 #TODO |
371 | |
372 | |
373 @instruction(101) | |
374 def set_boss_mode(self, unknown): | |
375 #TODO: unknown | |
376 self._game_state.boss = self._enemy | |
349 | 377 |
350 | 378 |
351 @instruction(103) | 379 @instruction(103) |
352 def set_hitbox(self, width, height, depth): | 380 def set_hitbox(self, width, height, depth): |
353 self._enemy.hitbox = (width, height) | 381 self._enemy.hitbox = (width, height) |