Mercurial > touhou
changeset 87:fda176f07d6d
Fix add_int
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Sun, 04 Sep 2011 01:09:28 +0200 |
parents | a87a3c080585 |
children | 2cc60137d368 |
files | pytouhou/formats/ecl.py pytouhou/vm/eclrunner.py |
diffstat | 2 files changed, 9 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/pytouhou/formats/ecl.py +++ b/pytouhou/formats/ecl.py @@ -31,7 +31,7 @@ class ECL(object): 8: ('if', 'set_random_float'), 9: ('iff', 'set_random_float2'), 10: ('i', 'store_x'), - 13: ('iii', 'set_random_int2'), + 13: ('iii', 'add_int'), 14: ('iii', 'substract_int'), 15: ('iii', 'multiply_int'), 16: ('iii', 'divide_int'),
--- a/pytouhou/vm/eclrunner.py +++ b/pytouhou/vm/eclrunner.py @@ -202,11 +202,6 @@ class ECLRunner(object): self._setval(variable_id, self._enemy.x) - @instruction(13) - def set_random_int2(self, variable_id, minval, amp): - self._setval(variable_id, int(self._getval(minval)) + int(self._getval(amp)) * self._game_state.prng.rand_double()) - - @instruction(14) @instruction(21) def substract(self, variable_id, a, b): @@ -215,6 +210,14 @@ class ECLRunner(object): self._setval(variable_id, self._getval(a) - self._getval(b)) + @instruction(13) + @instruction(20) + def add(self, variable_id, a, b): + #TODO: 13 takes only ints and 20 only floats. + # The original engine dereferences the variables in the type it waits for, so this isn't exactly the correct implementation, but the data don't contain such case. + self._setval(variable_id, self._getval(a) + self._getval(b)) + + @instruction(15) def multiply_int(self, variable_id, a, b): #TODO: takes only ints. @@ -232,12 +235,6 @@ class ECLRunner(object): self._setval(variable_id, self._getval(a) % self._getval(b)) - @instruction(20) - def add_float(self, variable_id, a, b): - #TODO: takes only floats. - self._setval(variable_id, self._getval(a) + self._getval(b)) - - @instruction(23) def divide_float(self, variable_id, a, b): #TODO: takes only floats.