comparison pytouhou/vm/eclrunner.py @ 157:ca6f8b3f739d

Remove half of the new_enemy/pop_enemy mess.
author Thibaut Girka <thib@sitedethib.com>
date Mon, 10 Oct 2011 18:42:02 +0200
parents ed86bec43b93
children 7769ce7be03c
comparison
equal deleted inserted replaced
156:ebfd328e700c 157:ca6f8b3f739d
23 23
24 24
25 25
26 class ECLMainRunner(object): 26 class ECLMainRunner(object):
27 __metaclass__ = MetaRegistry 27 __metaclass__ = MetaRegistry
28 __slots__ = ('_ecl', '_new_enemy_func', '_game', 'processes', 28 __slots__ = ('_ecl', '_game', 'processes',
29 'instruction_pointer') 29 'instruction_pointer')
30 30
31 def __init__(self, ecl, new_enemy_func, game): 31 def __init__(self, ecl, game):
32 self._ecl = ecl 32 self._ecl = ecl
33 self._new_enemy_func = new_enemy_func
34 self._game = game 33 self._game = game
35 34
36 self.processes = [] 35 self.processes = []
37 36
38 self.instruction_pointer = 0 37 self.instruction_pointer = 0
68 x = self._game.prng.rand_double() * 368 67 x = self._game.prng.rand_double() * 368
69 if y < -990: #102h.exe@0x41184b 68 if y < -990: #102h.exe@0x41184b
70 y = self._game.prng.rand_double() * 416 69 y = self._game.prng.rand_double() * 416
71 if z < -990: #102h.exe@0x411881 70 if z < -990: #102h.exe@0x411881
72 y = self._game.prng.rand_double() * 800 71 y = self._game.prng.rand_double() * 800
73 enemy = self._new_enemy_func((x, y), life, instr_type, bonus_dropped, self._pop_enemy) 72 enemy = self._game.new_enemy((x, y), life, instr_type, bonus_dropped, self._pop_enemy)
74 process = ECLRunner(self._ecl, sub, enemy, self._game) 73 process = ECLRunner(self._ecl, sub, enemy, self._game)
75 self.processes.append(process) 74 self.processes.append(process)
76 process.run_iteration() 75 process.run_iteration()
77 76
78 77