comparison pytouhou/vm/eclrunner.py @ 155:ed86bec43b93

Implement two new instructions.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 09 Oct 2011 16:55:49 -0700
parents 364935f6e313
children ca6f8b3f739d
comparison
equal deleted inserted replaced
154:364935f6e313 155:ed86bec43b93
342 def get_direction(self, variable_id, x1, y1, x2, y2): 342 def get_direction(self, variable_id, x1, y1, x2, y2):
343 #TODO: takes only floats. 343 #TODO: takes only floats.
344 self._setval(variable_id, atan2(self._getval(y2) - self._getval(y1), self._getval(x2) - self._getval(x1))) 344 self._setval(variable_id, atan2(self._getval(y2) - self._getval(y1), self._getval(x2) - self._getval(x1)))
345 345
346 346
347 @instruction(26)
348 def float_to_unit_circle(self, variable_id):
349 #TODO: takes only floats.
350 self._setval(variable_id, (self._getval(variable_id) + pi) % (2*pi) - pi)
351
352
347 @instruction(27) 353 @instruction(27)
348 @instruction(28) 354 @instruction(28)
349 def compare(self, a, b): 355 def compare(self, a, b):
350 #TODO: 27 takes only ints and 28 only floats. 356 #TODO: 27 takes only ints and 28 only floats.
351 a, b = self._getval(a), self._getval(b) 357 a, b = self._getval(a), self._getval(b)
664 670
665 671
666 @instruction(93) 672 @instruction(93)
667 def set_spellcard(self, unknown, number, name): 673 def set_spellcard(self, unknown, number, name):
668 #TODO: display it on the game. 674 #TODO: display it on the game.
669 print("%d - %s" % (number, name)) 675 #TODO: change the background.
676 #TODO: make the enemies more resistants (and find how).
677 print("%d - %s" % (number+1, name))
678
679
680 @instruction(94)
681 def end_spellcard(self):
682 #TODO: return everything back to normal
683 #TODO: give the spellcard bonus.
684 self._game.change_bullets_into_star_items()
670 685
671 686
672 @instruction(95) 687 @instruction(95)
673 def pop_enemy(self, sub, x, y, z, life, bonus_dropped, unknown2): 688 def pop_enemy(self, sub, x, y, z, life, bonus_dropped, unknown2):
674 self._enemy.pop_enemy(sub, 0, self._getval(x), self._getval(y), 0, life, bonus_dropped, unknown2, 0) # TODO: check about unknown values 689 self._enemy.pop_enemy(sub, 0, self._getval(x), self._getval(y), 0, life, bonus_dropped, unknown2, 0) # TODO: check about unknown values