# HG changeset patch # User Emmanuel Gil Peyrot # Date 1380878344 -7200 # Node ID 59bd29568753c3ea3495e810242653ec4090bb24 # Parent 791faab054456c48fd9c5f9118ce42ddcdfbdbd1 Remove identity lambda for interpolators, improves performances slightly. diff --git a/pytouhou/vm/anmrunner.py b/pytouhou/vm/anmrunner.py --- 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. diff --git a/pytouhou/vm/eclrunner.py b/pytouhou/vm/eclrunner.py --- 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)