comparison pytouhou/vm/eclrunner.py @ 307:5930b33a0370

Minor refactoring
author Thibaut Girka <thib@sitedethib.com>
date Tue, 13 Mar 2012 19:52:42 +0100
parents 52d791bb7c32
children 7a464291dd9d
comparison
equal deleted inserted replaced
306:52d791bb7c32 307:5930b33a0370
106 106
107 107
108 @instruction(10) 108 @instruction(10)
109 def resume_ecl(self, sub, instr_type, unk1, unk2): 109 def resume_ecl(self, sub, instr_type, unk1, unk2):
110 boss = self._game.boss 110 boss = self._game.boss
111 enemy = boss._enemy
112 self._game.msg_wait = False 111 self._game.msg_wait = False
113 if enemy.boss_callback: 112 if boss._enemy.boss_callback > -1:
114 boss.frame = 0 113 boss.switch_to_sub(boss._enemy.boss_callback)
115 boss.sub = enemy.boss_callback 114 boss._enemy.boss_callback = -1
116 boss.instruction_pointer = 0
117 enemy.boss_callback = None
118 else: 115 else:
119 raise Exception #TODO 116 raise Exception #TODO
120 117
121 118
122 @instruction(12) 119 @instruction(12)
140 # Things supposed to change (and be put in the stack) 137 # Things supposed to change (and be put in the stack)
141 self.variables = [0, 0, 0, 0, 138 self.variables = [0, 0, 0, 0,
142 0., 0., 0., 0., 139 0., 0., 0., 0.,
143 0, 0, 0, 0] 140 0, 0, 0, 0]
144 self.comparison_reg = 0 141 self.comparison_reg = 0
145 self.sub = sub 142 self.switch_to_sub(sub)
146 self.frame = 0
147 self.instruction_pointer = 0
148 143
149 self.stack = [] 144 self.stack = []
150 145
151 146
152 def switch_to_sub(self, sub): 147 def switch_to_sub(self, sub):
837 elif proc._enemy.touchable: 832 elif proc._enemy.touchable:
838 proc._enemy.life = 0 833 proc._enemy.life = 0
839 elif proc._enemy.death_callback > 0: 834 elif proc._enemy.death_callback > 0:
840 #TODO: check 835 #TODO: check
841 #TODO: refactor 836 #TODO: refactor
842 proc.frame = 0 837 self.switch_to_sub(proc._enemy.death_callback)
843 proc.instruction_pointer = 0
844 proc.sub = proc._enemy.death_callback
845 proc._enemy.death_callback = -1 838 proc._enemy.death_callback = -1
846 839
847 840
848 @instruction(97) 841 @instruction(97)
849 def set_anim(self, script): 842 def set_anim(self, script):