diff pytouhou/vm/anmrunner.py @ 71:a03d7a94b997

Add support for a few ANM instructions
author Thibaut Girka <thib@sitedethib.com>
date Sat, 27 Aug 2011 20:42:16 +0200
parents a142e57218a0
children 6a08f44fa01b
line wrap: on
line diff
--- a/pytouhou/vm/anmrunner.py
+++ b/pytouhou/vm/anmrunner.py
@@ -118,17 +118,36 @@ class ANMRunner(object):
         self._sprite.scale_speed = ssx, ssy
 
 
+    @instruction(12)
+    def fade(self, new_alpha, duration):
+        self._sprite.fade(duration, new_alpha, lambda x: x) #TODO: formula
+
+    @instruction(15)
+    @instruction(21) #TODO
+    def keep_still(self):
+        self._running = False
+
     @instruction(16)
     def load_random_sprite(self, min_idx, amp):
         #TODO: use the game's PRNG?
         self.load_sprite(min_idx + randrange(amp))
 
 
+    @instruction(19)
+    def move_in(self, x, y, z, duration):
+        self._sprite.move_in(duration, x, y, z, lambda x: x) #TODO: formula
+
+
     @instruction(23)
     def set_corner_relative_placement(self):
         self._sprite.corner_relative_placement = True #TODO
 
 
+    @instruction(25)
+    def set_allow_dest_offset(self, value):
+        self._sprite.allow_dest_offset = bool(value)
+
+
     @instruction(27)
     def shift_texture_x(self, dx):
         tox, toy = self._sprite.texoffsets
@@ -141,8 +160,7 @@ class ANMRunner(object):
         self._sprite.texoffsets = tox, toy + dy
 
 
-    @instruction(15)
-    @instruction(21) #TODO
-    def keep_still(self):
-        self._running = False
+    @instruction(30)
+    def scale_in(self, sx, sy, duration):
+        self._sprite.scale_in(duration, sx, sy, lambda x: x) #TODO: formula