comparison 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
comparison
equal deleted inserted replaced
244:2b7f69ad9ccd 245:d3ba32a9096e
49 if new_ip is None: 49 if new_ip is None:
50 return False 50 return False
51 self.instruction_pointer = new_ip 51 self.instruction_pointer = new_ip
52 self.frame, opcode, args = self.script[self.instruction_pointer] 52 self.frame, opcode, args = self.script[self.instruction_pointer]
53 self.waiting = False 53 self.waiting = False
54 self._sprite.visible = True
54 return True 55 return True
55 56
56 57
57 def run_frame(self): 58 def run_frame(self):
58 if not self._running: 59 if not self._running:
229 self._sprite.corner_relative_placement = True #TODO 230 self._sprite.corner_relative_placement = True #TODO
230 231
231 232
232 @instruction(24) 233 @instruction(24)
233 def wait_ex(self): 234 def wait_ex(self):
234 """Hide/delete the sprite and wait for an interrupt. 235 """Hide the sprite and wait for an interrupt.
235 """ 236 """
236 #TODO: Hide/delete the sprite and figure what happens exactly 237 self._sprite.visible = False
237 self.waiting = True 238 self.waiting = True
238 239
239 240
240 @instruction(25) 241 @instruction(25)
241 def set_allow_dest_offset(self, value): 242 def set_allow_dest_offset(self, value):
259 def shift_texture_y(self, dy): 260 def shift_texture_y(self, dy):
260 tox, toy = self._sprite.texoffsets 261 tox, toy = self._sprite.texoffsets
261 self._sprite.texoffsets = tox, toy + dy 262 self._sprite.texoffsets = tox, toy + dy
262 263
263 264
265 @instruction(29)
266 def set_visible(self, visible):
267 self._sprite.visible = bool(visible & 1)
268
269
264 @instruction(30) 270 @instruction(30)
265 def scale_in(self, sx, sy, duration): 271 def scale_in(self, sx, sy, duration):
266 self._sprite.scale_in(duration, sx, sy, lambda x: x) #TODO: formula 272 self._sprite.scale_in(duration, sx, sy, lambda x: x) #TODO: formula
267 273