changeset 389:eef492100f4c

Add "explosion", instruction 118.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 21 Oct 2012 23:02:41 +0200
parents ac2891afb0bb
children b11953cf1d3b
files pytouhou/formats/ecl.py pytouhou/vm/eclrunner.py
diffstat 2 files changed, 28 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/formats/ecl.py
+++ b/pytouhou/formats/ecl.py
@@ -134,7 +134,7 @@ class ECL(object):
                      115: ('i', 'set_timeout'),
                      116: ('i', 'set_timeout_callback'),
                      117: ('i', 'set_touchable'),
-                     118: ('iihh', None),
+                     118: ('iIbbbb', 'drop_particles'),
                      119: ('i', 'drop_bonus'),
                      120: ('i', 'set_automatic_orientation'),
                      121: ('ii', 'call_special_function'),
--- a/pytouhou/vm/eclrunner.py
+++ b/pytouhou/vm/eclrunner.py
@@ -904,6 +904,33 @@ class ECLRunner(object):
         self._enemy.touchable = bool(value)
 
 
+    @instruction(118)
+    def drop_particles(self, anim, number, a, b, c, d):
+        #TODO: find the utility of the other values.
+
+        if number == 0 or number > 640: #TODO: remove that hardcoded 640, and verify it.
+            number = 640
+
+        if anim == -1:
+            return
+        if 0 <= anim <= 2:
+            self._game.new_effect((self._enemy.x, self._enemy.y), anim + 3, number=number)
+        elif anim == 3:
+            self._game.new_particle((self._enemy.x, self._enemy.y), 6, 256, number=number) #TODO: make it go back a bit at the end.
+        elif 4 <= anim <= 15:
+            self._game.new_particle((self._enemy.x, self._enemy.y), anim + 5, 192, number=number)
+        elif anim == 16:
+            self._game.new_effect((self._enemy.x, self._enemy.y), 0, self._game.spellcard_effect_anm_wrapper, number=number)
+        elif anim == 17:
+            self._game.new_particle((self._enemy.x, self._enemy.y), anim - 10, 640, number=number, reverse=True, duration=60)
+        elif anim == 18:
+            self._game.new_particle((self._enemy.x, self._enemy.y), anim - 10, 640, number=number, reverse=True, duration=240)
+        elif anim == 19:
+            self._game.new_effect((self._enemy.x, self._enemy.y), anim - 10, number=number)
+        else:
+            raise Exception #TODO
+
+
     @instruction(119)
     def drop_some_bonus(self, number):
         if self._enemy.select_player().state.power < 128: