Mercurial > touhou
comparison pytouhou/vm/eclrunner.py @ 93:d167280a82fc
Handle timeout callbacks, and clean up unneeded things
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Sun, 04 Sep 2011 17:34:45 +0200 |
parents | f7525fa66bb0 |
children | e2d8f2a56ea4 |
comparison
equal
deleted
inserted
replaced
92:85f3b8ba3f24 | 93:d167280a82fc |
---|---|
44 self.instruction_pointer = 0 | 44 self.instruction_pointer = 0 |
45 | 45 |
46 self.stack = [] | 46 self.stack = [] |
47 | 47 |
48 | 48 |
49 def handle_callbacks(self): | |
50 #TODO | |
51 enm = self._enemy | |
52 if enm.timeout and enm.frame == enm.timeout: | |
53 enm.frame = 0 | |
54 if enm.timeout_callback: | |
55 self.frame = 0 | |
56 self.sub = enm.timeout_callback | |
57 self.instruction_pointer = 0 | |
58 else: | |
59 pass #TODO | |
60 #TODO: other callbacks (low life, etc.) | |
61 | |
62 | |
49 def run_iteration(self): | 63 def run_iteration(self): |
50 # First, if enemy is dead, return | 64 # First, if enemy is dead, return |
51 if self._enemy._removed: | 65 if self._enemy._removed: |
52 return False | 66 return False |
53 | 67 |
54 # Then, check for callbacks | 68 # Then, check for callbacks |
55 #TODO | 69 self.handle_callbacks() |
56 | 70 |
57 # Now, process script | 71 # Now, process script |
58 while True: | 72 while True: |
59 try: | 73 try: |
60 frame, instr_type, rank_mask, param_mask, args = self._ecl.subs[self.sub][self.instruction_pointer] | 74 frame, instr_type, rank_mask, param_mask, args = self._ecl.subs[self.sub][self.instruction_pointer] |