Mercurial > touhou
diff pytouhou/game/eclrunner.py @ 64:d469012368b3
Implement conditional jumps.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Wed, 24 Aug 2011 22:44:40 -0700 |
parents | 8527fe640844 |
children | 0efec109f798 |
line wrap: on
line diff
--- a/pytouhou/game/eclrunner.py +++ b/pytouhou/game/eclrunner.py @@ -288,12 +288,42 @@ class ECLRunner(object): self.comparison_reg = 1 + @instruction(29) + def relative_jump_if_lower_than(self, frame, instruction_pointer): + if self.comparison_reg == -1: + self.relative_jump(frame, instruction_pointer) + + + @instruction(30) + def relative_jump_if_lower_or_equal(self, frame, instruction_pointer): + if self.comparison_reg != 1: + self.relative_jump(frame, instruction_pointer) + + @instruction(31) def relative_jump_if_equal(self, frame, instruction_pointer): if self.comparison_reg == 0: self.relative_jump(frame, instruction_pointer) + @instruction(32) + def relative_jump_if_greater_than(self, frame, instruction_pointer): + if self.comparison_reg == 1: + self.relative_jump(frame, instruction_pointer) + + + @instruction(33) + def relative_jump_if_greater_or_equal(self, frame, instruction_pointer): + if self.comparison_reg != -1: + self.relative_jump(frame, instruction_pointer) + + + @instruction(34) + def relative_jump_if_not_equal(self, frame, instruction_pointer): + if self.comparison_reg != 0: + self.relative_jump(frame, instruction_pointer) + + @instruction(35) def call(self, sub, param1, param2): self.stack.append((self.sub, self.frame, self.instruction_pointer,