changeset 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 dbb1a86c0235
children 91eb0afcb1e3
files pytouhou/formats/ecl.py pytouhou/vm/eclrunner.py
diffstat 2 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/formats/ecl.py
+++ b/pytouhou/formats/ecl.py
@@ -160,7 +160,7 @@ class ECL(object):
                           8: ('', None),
                           9: ('', None),
                           10: ('II', None),
-                          12: ('', None)}
+                          12: ('', 'stop_time')}
 
 
     def __init__(self):
--- a/pytouhou/vm/eclrunner.py
+++ b/pytouhou/vm/eclrunner.py
@@ -26,12 +26,14 @@ logger = get_logger(__name__)
 class ECLMainRunner(object):
     __metaclass__ = MetaRegistry
     __slots__ = ('_ecl', '_game', 'processes', 'frame',
-                 'instruction_pointer')
+                 'instruction_pointer',
+                 'time_stopped')
 
     def __init__(self, ecl, game):
         self._ecl = ecl
         self._game = game
         self.frame = 0
+        self.time_stopped = False
 
         self.processes = []
 
@@ -61,7 +63,10 @@ class ECLMainRunner(object):
         self.processes[:] = (process for process in self.processes
                                                 if process.run_iteration())
 
-        if not self._game.spellcard:
+        if not self._game.boss:
+            self.time_stopped = False
+
+        if not self.time_stopped:
             self.frame += 1
 
 
@@ -89,6 +94,11 @@ class ECLMainRunner(object):
         self._pop_enemy(sub, instr_type, x, y, z, life, bonus_dropped, die_score)
 
 
+    @instruction(12)
+    def stop_time(self, sub, instr_type):
+        self.time_stopped = True
+
+
 
 
 class ECLRunner(object):