diff pytouhou/vm/eclrunner.py @ 107:5d9052b9a4e8

(almost) implement Cirno's freezing spellcard
author Thibaut Girka <thib@sitedethib.com>
date Mon, 05 Sep 2011 23:04:43 +0200
parents c7847bfed427
children 8ba018617829
line wrap: on
line diff
--- a/pytouhou/vm/eclrunner.py
+++ b/pytouhou/vm/eclrunner.py
@@ -13,7 +13,7 @@
 ##
 
 
-from math import atan2, cos, sin
+from math import atan2, cos, sin, pi
 
 from pytouhou.utils.helpers import get_logger
 
@@ -763,6 +763,21 @@ class ECLRunner(object):
         self._enemy.automatic_orientation = bool(flags & 1)
 
 
+    @instruction(121)
+    def call_special_function(self, function, arg):
+        if function == 0: # Cirno
+            if arg == 0:
+                for bullet in self._game_state.bullets:
+                    bullet.speed = bullet.angle = 0.
+                    bullet.set_anim(sprite_idx_offset=0) #TODO: check
+            else:
+                for bullet in self._game_state.bullets:
+                    bullet.speed = 2.0 #TODO
+                    bullet.angle = self._game_state.prng.rand_double() * pi #TODO
+        else:
+            logger.warn("Unimplemented special function %d!", function)
+
+
     @instruction(123)
     def skip_frames(self, frames):
         #TODO: is that all?