changeset 489:59bd29568753

Remove identity lambda for interpolators, improves performances slightly.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 04 Oct 2013 11:19:04 +0200
parents 791faab05445
children 1b532e7dd521
files pytouhou/vm/anmrunner.py pytouhou/vm/eclrunner.py
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/vm/anmrunner.py
+++ b/pytouhou/vm/anmrunner.py
@@ -28,15 +28,15 @@ class ANMRunner(object):
                  'variables', 'version', 'timeout')
 
     #TODO: check!
-    formulae = {0: lambda x: x,
+    formulae = {0: None,
                 1: lambda x: x ** 2,
                 2: lambda x: x ** 3,
                 3: lambda x: x ** 4,
                 4: lambda x: 2 * x - x ** 2,
                 5: lambda x: 2 * x - x ** 3,
                 6: lambda x: 2 * x - x ** 4,
-                7: lambda x: x,
-                255: lambda x: x} #XXX
+                7: None,
+                255: None} #XXX
 
     def __init__(self, anm, script_id, sprite, sprite_index_offset=0):
         self._anm = anm
@@ -185,7 +185,7 @@ class ANMRunner(object):
     @instruction(12)
     @instruction(15, 7)
     def fade(self, new_alpha, duration):
-        self._sprite.fade(duration, new_alpha, lambda x: x) #TODO: formula
+        self._sprite.fade(duration, new_alpha)
 
 
     @instruction(13)
@@ -218,7 +218,7 @@ class ANMRunner(object):
     @instruction(18)
     @instruction(17, 7)
     def move_in_linear(self, x, y, z, duration):
-        self._sprite.move_in(duration, x, y, z, lambda x: x)
+        self._sprite.move_in(duration, x, y, z)
 
 
     @instruction(19)
@@ -300,7 +300,7 @@ class ANMRunner(object):
     @instruction(30)
     @instruction(29, 7)
     def scale_in(self, sx, sy, duration):
-        self._sprite.scale_in(duration, sx, sy, lambda x: x) #TODO: formula
+        self._sprite.scale_in(duration, sx, sy)
 
 
 # Now are the instructions new to anm2.
--- a/pytouhou/vm/eclrunner.py
+++ b/pytouhou/vm/eclrunner.py
@@ -505,7 +505,7 @@ class ECLRunner(object):
     def move_to_linear(self, duration, x, y, z):
         self._enemy.move_to(duration,
                             self._getval(x), self._getval(y), self._getval(z),
-                            lambda x: x)
+                            None)
 
 
     @instruction(57)
@@ -524,7 +524,7 @@ class ECLRunner(object):
 
     @instruction(61)
     def stop_in(self, duration):
-        self._enemy.stop_in(duration, lambda x: x)
+        self._enemy.stop_in(duration, None)
 
 
     @instruction(63)