Mercurial > touhou
changeset 140:a9d46c4b5764
Fix move_to (handle variables) and spawn_enemy
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Sun, 25 Sep 2011 20:16:13 +0200 |
parents | 3af65541dfd3 |
children | 982b21222602 |
files | pytouhou/vm/eclrunner.py |
diffstat | 1 files changed, 24 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/pytouhou/vm/eclrunner.py +++ b/pytouhou/vm/eclrunner.py @@ -62,6 +62,20 @@ class ECLMainRunner(object): if process.run_iteration()) + def _pop_enemy(self, sub, instr_type, x, y, z, life, bonus_dropped, unknown2, unknown3): + if instr_type & 4: + if x < -990: #102h.exe@0x411820 + x = self._game_state.prng.rand_double() * 368 + if y < -990: #102h.exe@0x41184b + y = self._game_state.prng.rand_double() * 416 + if z < -990: #102h.exe@0x411881 + y = self._game_state.prng.rand_double() * 800 + enemy = self._new_enemy_func((x, y), life, instr_type, self._pop_enemy) + process = ECLRunner(self._ecl, sub, enemy, self._game_state) + self.processes.append(process) + process.run_iteration() + + @instruction(0) @instruction(2) @instruction(4) @@ -69,17 +83,7 @@ class ECLMainRunner(object): def pop_enemy(self, sub, instr_type, x, y, z, life, bonus_dropped, unknown2, unknown3): if self._game_state.boss: return - if instr_type & 4: - if x < -990: #102h.exe@0x411820 - x = self._game_state.prng.rand_double() * 368 - if y < -990: #102h.exe@0x41184b - y = self._game_state.prng.rand_double() * 416 - if z < -990: #102h.exe@0x411881 - y = self._game_state.prng.rand_double() * 800 - enemy = self._new_enemy_func((x, y), life, instr_type, self.pop_enemy) - process = ECLRunner(self._ecl, sub, enemy, self._game_state) - self.processes.append(process) - process.run_iteration() + self._pop_enemy(sub, instr_type, x, y, z, life, bonus_dropped, unknown2, unknown3) @@ -477,17 +481,23 @@ class ECLRunner(object): @instruction(56) def move_to_linear(self, duration, x, y, z): - self._enemy.move_to(duration, x, y, z, lambda x: x) + self._enemy.move_to(duration, + self._getval(x), self._getval(y), self._getval(z), + lambda x: x) @instruction(57) def move_to_decel(self, duration, x, y, z): - self._enemy.move_to(duration, x, y, z, lambda x: 2. * x - x ** 2) + self._enemy.move_to(duration, + self._getval(x), self._getval(y), self._getval(z), + lambda x: 2. * x - x ** 2) @instruction(59) def move_to_accel(self, duration, x, y, z): - self._enemy.move_to(duration, x, y, z, lambda x: x ** 2) + self._enemy.move_to(duration, + self._getval(x), self._getval(y), self._getval(z), + lambda x: x ** 2) @instruction(61)