comparison pytouhou/vm/eclrunner.py @ 77:6fa6d74a049a

Handle a new ECL instruction, and add some names.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 30 Aug 2011 18:44:58 -0700
parents f305c0e406d6
children bcf965ede96c
comparison
equal deleted inserted replaced
76:f305c0e406d6 77:6fa6d74a049a
243 def divide_float(self, variable_id, a, b): 243 def divide_float(self, variable_id, a, b):
244 #TODO: takes only floats. 244 #TODO: takes only floats.
245 self._setval(variable_id, self._getval(a) / self._getval(b)) 245 self._setval(variable_id, self._getval(a) / self._getval(b))
246 246
247 247
248 @instruction(25)
249 def get_direction(self, variable_id, x1, y1, x2, y2):
250 #TODO: takes only floats.
251 self._setval(variable_id, math.atan2(self._getval(y2) - self._getval(y1), self._getval(x2) - self._getval(x1)))
252
253
248 @instruction(27) 254 @instruction(27)
249 @instruction(28) 255 @instruction(28)
250 def compare(self, a, b): 256 def compare(self, a, b):
251 #TODO: 27 takes only ints and 28 only floats. 257 #TODO: 27 takes only ints and 28 only floats.
252 a, b = self._getval(a), self._getval(b) 258 a, b = self._getval(a), self._getval(b)