comparison pytouhou/vm/eclrunner.py @ 134:e9ac3640280b

Add support for enemy spawnling enemies.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 16 Sep 2011 11:21:33 -0700
parents 8ba018617829
children a9d46c4b5764
comparison
equal deleted inserted replaced
133:2cad2e84a49e 134:e9ac3640280b
64 64
65 @instruction(0) 65 @instruction(0)
66 @instruction(2) 66 @instruction(2)
67 @instruction(4) 67 @instruction(4)
68 @instruction(6) 68 @instruction(6)
69 def pop_enemy(self, sub, instr_type, x, y, z, life, unknown1, unknown2, unknown3): 69 def pop_enemy(self, sub, instr_type, x, y, z, life, bonus_dropped, unknown2, unknown3):
70 if self._game_state.boss: 70 if self._game_state.boss:
71 return 71 return
72 if instr_type & 4: 72 if instr_type & 4:
73 if x < -990: #102h.exe@0x411820 73 if x < -990: #102h.exe@0x411820
74 x = self._game_state.prng.rand_double() * 368 74 x = self._game_state.prng.rand_double() * 368
75 if y < -990: #102h.exe@0x41184b 75 if y < -990: #102h.exe@0x41184b
76 y = self._game_state.prng.rand_double() * 416 76 y = self._game_state.prng.rand_double() * 416
77 if z < -990: #102h.exe@0x411881 77 if z < -990: #102h.exe@0x411881
78 y = self._game_state.prng.rand_double() * 800 78 y = self._game_state.prng.rand_double() * 800
79 enemy = self._new_enemy_func((x, y), life, instr_type) 79 enemy = self._new_enemy_func((x, y), life, instr_type, self.pop_enemy)
80 process = ECLRunner(self._ecl, sub, enemy, self._game_state) 80 process = ECLRunner(self._ecl, sub, enemy, self._game_state)
81 self.processes.append(process) 81 self.processes.append(process)
82 process.run_iteration() 82 process.run_iteration()
83 83
84 84
638 self._enemy.delay_attack = False 638 self._enemy.delay_attack = False
639 639
640 640
641 @instruction(81) 641 @instruction(81)
642 def set_bullet_launch_offset(self, x, y, z): 642 def set_bullet_launch_offset(self, x, y, z):
643 self._enemy.bullet_launch_offset = (x, y) 643 self._enemy.bullet_launch_offset = (self._getval(x), self._getval(y))
644 644
645 645
646 @instruction(82) 646 @instruction(82)
647 def set_extended_bullet_attributes(self, *attributes): 647 def set_extended_bullet_attributes(self, *attributes):
648 self._enemy.extended_bullet_attributes = tuple(self._getval(attr) for attr in attributes) 648 self._enemy.extended_bullet_attributes = tuple(self._getval(attr) for attr in attributes)
650 650
651 @instruction(93) 651 @instruction(93)
652 def set_spellcard(self, unknown, number, name): 652 def set_spellcard(self, unknown, number, name):
653 #TODO: display it on the game. 653 #TODO: display it on the game.
654 print("%d - %s" % (number, name)) 654 print("%d - %s" % (number, name))
655
656
657 @instruction(95)
658 def pop_enemy(self, sub, x, y, z, life, bonus_dropped, unknown2):
659 self._enemy.pop_enemy(sub, 0, self._getval(x), self._getval(y), 0, life, bonus_dropped, unknown2, 0) # TODO: check about unknown values
655 660
656 661
657 @instruction(97) 662 @instruction(97)
658 def set_anim(self, sprite_index): 663 def set_anim(self, sprite_index):
659 self._enemy.set_anim(sprite_index) 664 self._enemy.set_anim(sprite_index)