comparison pytouhou/vm/eclrunner.py @ 87:fda176f07d6d

Fix add_int
author Thibaut Girka <thib@sitedethib.com>
date Sun, 04 Sep 2011 01:09:28 +0200
parents fc0294c745b6
children f7525fa66bb0
comparison
equal deleted inserted replaced
86:a87a3c080585 87:fda176f07d6d
200 @instruction(10) 200 @instruction(10)
201 def store_x(self, variable_id): 201 def store_x(self, variable_id):
202 self._setval(variable_id, self._enemy.x) 202 self._setval(variable_id, self._enemy.x)
203 203
204 204
205 @instruction(13)
206 def set_random_int2(self, variable_id, minval, amp):
207 self._setval(variable_id, int(self._getval(minval)) + int(self._getval(amp)) * self._game_state.prng.rand_double())
208
209
210 @instruction(14) 205 @instruction(14)
211 @instruction(21) 206 @instruction(21)
212 def substract(self, variable_id, a, b): 207 def substract(self, variable_id, a, b):
213 #TODO: 14 takes only ints and 21 only floats. 208 #TODO: 14 takes only ints and 21 only floats.
214 # 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. 209 # 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.
215 self._setval(variable_id, self._getval(a) - self._getval(b)) 210 self._setval(variable_id, self._getval(a) - self._getval(b))
216 211
217 212
213 @instruction(13)
214 @instruction(20)
215 def add(self, variable_id, a, b):
216 #TODO: 13 takes only ints and 20 only floats.
217 # 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.
218 self._setval(variable_id, self._getval(a) + self._getval(b))
219
220
218 @instruction(15) 221 @instruction(15)
219 def multiply_int(self, variable_id, a, b): 222 def multiply_int(self, variable_id, a, b):
220 #TODO: takes only ints. 223 #TODO: takes only ints.
221 self._setval(variable_id, self._getval(a) * self._getval(b)) 224 self._setval(variable_id, self._getval(a) * self._getval(b))
222 225
228 231
229 232
230 @instruction(17) 233 @instruction(17)
231 def modulo(self, variable_id, a, b): 234 def modulo(self, variable_id, a, b):
232 self._setval(variable_id, self._getval(a) % self._getval(b)) 235 self._setval(variable_id, self._getval(a) % self._getval(b))
233
234
235 @instruction(20)
236 def add_float(self, variable_id, a, b):
237 #TODO: takes only floats.
238 self._setval(variable_id, self._getval(a) + self._getval(b))
239 236
240 237
241 @instruction(23) 238 @instruction(23)
242 def divide_float(self, variable_id, a, b): 239 def divide_float(self, variable_id, a, b):
243 #TODO: takes only floats. 240 #TODO: takes only floats.