# HG changeset patch # User Thibaut Girka # Date 1314437062 -7200 # Node ID 7c1f20407b3e9a2f0d8db03c68343d355f5e1467 # Parent a142e57218a0fcea524c9053a997c58b789c45ba Add set_random_angle support diff --git a/pytouhou/formats/ecl.py b/pytouhou/formats/ecl.py --- 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), diff --git a/pytouhou/vm/eclrunner.py b/pytouhou/vm/eclrunner.py --- 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: