# HG changeset patch # User Thibaut Girka # Date 1318264922 -7200 # Node ID ca6f8b3f739d95a689a9acd0561e0a56aa7fd44e # Parent ebfd328e700c6e70a247de0d71c6ec29f1be6640 Remove half of the new_enemy/pop_enemy mess. diff --git a/pytouhou/game/game.py b/pytouhou/game/game.py --- a/pytouhou/game/game.py +++ b/pytouhou/game/game.py @@ -48,7 +48,7 @@ class Game(object): self.enm_anm_wrapper = resource_loader.get_anm_wrapper2(('stg%denm.anm' % stage, 'stg%denm2.anm' % stage)) ecl = resource_loader.get_ecl('ecldata%d.ecl' % stage) - self.ecl_runner = ECLMainRunner(ecl, self.new_enemy, self) + self.ecl_runner = ECLMainRunner(ecl, self) def drop_bonus(self, x, y, _type): diff --git a/pytouhou/vm/eclrunner.py b/pytouhou/vm/eclrunner.py --- a/pytouhou/vm/eclrunner.py +++ b/pytouhou/vm/eclrunner.py @@ -25,12 +25,11 @@ logger = get_logger(__name__) class ECLMainRunner(object): __metaclass__ = MetaRegistry - __slots__ = ('_ecl', '_new_enemy_func', '_game', 'processes', + __slots__ = ('_ecl', '_game', 'processes', 'instruction_pointer') - def __init__(self, ecl, new_enemy_func, game): + def __init__(self, ecl, game): self._ecl = ecl - self._new_enemy_func = new_enemy_func self._game = game self.processes = [] @@ -70,7 +69,7 @@ class ECLMainRunner(object): y = self._game.prng.rand_double() * 416 if z < -990: #102h.exe@0x411881 y = self._game.prng.rand_double() * 800 - enemy = self._new_enemy_func((x, y), life, instr_type, bonus_dropped, self._pop_enemy) + enemy = self._game.new_enemy((x, y), life, instr_type, bonus_dropped, self._pop_enemy) process = ECLRunner(self._ecl, sub, enemy, self._game) self.processes.append(process) process.run_iteration()