diff pytouhou/vm/anmrunner.py @ 245:d3ba32a9096e

Implement ANM0 instruction 29 and fix 24
author Thibaut Girka <thib@sitedethib.com>
date Mon, 02 Jan 2012 18:46:55 +0100
parents 3893a6fc66f1
children 94c636f8f863
line wrap: on
line diff
--- a/pytouhou/vm/anmrunner.py
+++ b/pytouhou/vm/anmrunner.py
@@ -51,6 +51,7 @@ class ANMRunner(object):
         self.instruction_pointer = new_ip
         self.frame, opcode, args = self.script[self.instruction_pointer]
         self.waiting = False
+        self._sprite.visible = True
         return True
 
 
@@ -231,9 +232,9 @@ class ANMRunner(object):
 
     @instruction(24)
     def wait_ex(self):
-        """Hide/delete the sprite and wait for an interrupt.
+        """Hide the sprite and wait for an interrupt.
         """
-        #TODO: Hide/delete the sprite and figure what happens exactly
+        self._sprite.visible = False
         self.waiting = True
 
 
@@ -261,6 +262,11 @@ class ANMRunner(object):
         self._sprite.texoffsets = tox, toy + dy
 
 
+    @instruction(29)
+    def set_visible(self, visible):
+        self._sprite.visible = bool(visible & 1)
+
+
     @instruction(30)
     def scale_in(self, sx, sy, duration):
         self._sprite.scale_in(duration, sx, sy, lambda x: x) #TODO: formula