changeset 77:6fa6d74a049a

Handle a new ECL instruction, and add some names.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 30 Aug 2011 18:44:58 -0700
parents f305c0e406d6
children bcf965ede96c
files pytouhou/formats/ecl.py pytouhou/vm/eclrunner.py
diffstat 2 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/formats/ecl.py
+++ b/pytouhou/formats/ecl.py
@@ -40,7 +40,7 @@ class ECL(object):
                      20: ('iff', 'add_float'),
                      21: ('iff', 'substract_float'),
                      23: ('iff', 'divide_float'),
-                     25: ('iffff', None),
+                     25: ('iffff', 'get_direction'),
                      26: ('i', None),
                      27: ('ii', 'compare_ints'),
                      28: ('ff', 'compare_floats'),
@@ -61,7 +61,7 @@ class ECL(object):
                      49: ('ff', 'set_random_angle'),
                      50: ('ff', 'set_random_angle_ex'),
                      51: ('ff', 'set_speed_towards_player'),
-                     52: ('iff', None),
+                     52: ('iff', 'move_in_decel'),
                      56: ('ifff', 'move_to_linear'),
                      57: ('ifff', 'move_to_decel'),
                      59: ('iffi', 'move_to_accel'),
@@ -76,12 +76,12 @@ class ECL(object):
                      71: ('hhiiffffi', 'set_bullet_attributes5'),
                      74: ('hhiiffffi', 'set_bullet_attributes6'),
                      75: ('hhiiffffi', 'set_bullet_attributes7'),
-                     76: ('i', None),
+                     76: ('i', 'stop_bullets'),
                      77: ('i', 'set_bullet_interval'),
                      78: ('', 'delay_attack'),
                      79: ('', 'no_delay_attack'),
                      81: ('fff', 'set_bullet_launch_offset'),
-                     82: ('iiiiffff', None),
+                     82: ('iiiiffff', 'set_bullet_attributes_ex'),
                      83: ('', None),
                      84: ('i', None),
                      85: ('hhffffffiiiiii', 'laser'),
@@ -99,7 +99,7 @@ class ECL(object):
                      99: ('ii', None),
                      100: ('i', 'set_death_anim'),
                      101: ('i', 'set_boss_mode?'),
-                     102: ('iffff', None),
+                     102: ('iffff', 'create_squares'),
                      103: ('fff', 'set_enemy_hitbox'),
                      104: ('i', None),
                      105: ('i', 'set_damageable'),
@@ -120,7 +120,7 @@ class ECL(object):
                      121: ('ii', None),
                      122: ('i', None),
                      123: ('i', 'skip_frames'),
-                     124: ('i', None),
+                     124: ('i', 'drop_specific_bonus'),
                      125: ('', None),
                      126: ('i', 'set_remaining_lives'),
                      127: ('i', None),
--- a/pytouhou/vm/eclrunner.py
+++ b/pytouhou/vm/eclrunner.py
@@ -245,6 +245,12 @@ class ECLRunner(object):
         self._setval(variable_id, self._getval(a) / self._getval(b))
 
 
+    @instruction(25)
+    def get_direction(self, variable_id, x1, y1, x2, y2):
+        #TODO: takes only floats.
+        self._setval(variable_id, math.atan2(self._getval(y2) - self._getval(y1), self._getval(x2) - self._getval(x1)))
+
+
     @instruction(27)
     @instruction(28)
     def compare(self, a, b):