changeset 70:7c1f20407b3e

Add set_random_angle support
author Thibaut Girka <thib@sitedethib.com>
date Sat, 27 Aug 2011 11:24:22 +0200
parents a142e57218a0
children a03d7a94b997
files pytouhou/formats/ecl.py pytouhou/vm/eclrunner.py
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/formats/ecl.py
+++ b/pytouhou/formats/ecl.py
@@ -58,8 +58,8 @@ class ECL(object):
                      46: ('f', 'set_rotation_speed'),
                      47: ('f', 'set_speed'),
                      48: ('f', 'set_acceleration'),
-                     49: ('ff', None),
-                     50: ('ff', 'set_random_angle'),
+                     49: ('ff', 'set_random_angle'),
+                     50: ('ff', 'set_random_angle_ex'),
                      51: ('ff', 'set_speed_towards_player'),
                      52: ('iff', None),
                      56: ('iffi', None),
--- a/pytouhou/vm/eclrunner.py
+++ b/pytouhou/vm/eclrunner.py
@@ -337,8 +337,14 @@ class ECLRunner(object):
         self._enemy.acceleration = acceleration
 
 
+    @instruction(49)
+    def set_random_angle(self, min_angle, max_angle):
+        angle = self._game_state.prng.rand_double() * (max_angle - min_angle) + min_angle
+        self._enemy.angle = angle
+
+
     @instruction(50)
-    def set_random_angle(self, min_angle, max_angle):
+    def set_random_angle_ex(self, min_angle, max_angle):
         if self._enemy.screen_box:
             minx, miny, maxx, maxy = self._enemy.screen_box
         else: