comparison pytouhou/vm/eclrunner.py @ 283:b6c068c8f7f2

Fix ECL time flow. Spellcard do not stop time. Instruction 0xc does.
author Thibaut Girka <thib@sitedethib.com>
date Sun, 12 Feb 2012 02:09:16 +0100
parents 3539520fff93
children 91eb0afcb1e3
comparison
equal deleted inserted replaced
282:dbb1a86c0235 283:b6c068c8f7f2
24 24
25 25
26 class ECLMainRunner(object): 26 class ECLMainRunner(object):
27 __metaclass__ = MetaRegistry 27 __metaclass__ = MetaRegistry
28 __slots__ = ('_ecl', '_game', 'processes', 'frame', 28 __slots__ = ('_ecl', '_game', 'processes', 'frame',
29 'instruction_pointer') 29 'instruction_pointer',
30 'time_stopped')
30 31
31 def __init__(self, ecl, game): 32 def __init__(self, ecl, game):
32 self._ecl = ecl 33 self._ecl = ecl
33 self._game = game 34 self._game = game
34 self.frame = 0 35 self.frame = 0
36 self.time_stopped = False
35 37
36 self.processes = [] 38 self.processes = []
37 39
38 self.instruction_pointer = 0 40 self.instruction_pointer = 0
39 41
59 callback(self, sub, instr_type, *args) 61 callback(self, sub, instr_type, *args)
60 62
61 self.processes[:] = (process for process in self.processes 63 self.processes[:] = (process for process in self.processes
62 if process.run_iteration()) 64 if process.run_iteration())
63 65
64 if not self._game.spellcard: 66 if not self._game.boss:
67 self.time_stopped = False
68
69 if not self.time_stopped:
65 self.frame += 1 70 self.frame += 1
66 71
67 72
68 def _pop_enemy(self, sub, instr_type, x, y, z, life, bonus_dropped, die_score): 73 def _pop_enemy(self, sub, instr_type, x, y, z, life, bonus_dropped, die_score):
69 if instr_type & 4: 74 if instr_type & 4:
85 @instruction(6) 90 @instruction(6)
86 def pop_enemy(self, sub, instr_type, x, y, z, life, bonus_dropped, die_score): 91 def pop_enemy(self, sub, instr_type, x, y, z, life, bonus_dropped, die_score):
87 if self._game.boss: 92 if self._game.boss:
88 return 93 return
89 self._pop_enemy(sub, instr_type, x, y, z, life, bonus_dropped, die_score) 94 self._pop_enemy(sub, instr_type, x, y, z, life, bonus_dropped, die_score)
95
96
97 @instruction(12)
98 def stop_time(self, sub, instr_type):
99 self.time_stopped = True
90 100
91 101
92 102
93 103
94 class ECLRunner(object): 104 class ECLRunner(object):