comparison 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
comparison
equal deleted inserted replaced
70:7c1f20407b3e 71:a03d7a94b997
116 @instruction(11) 116 @instruction(11)
117 def set_scale_speed(self, ssx, ssy): 117 def set_scale_speed(self, ssx, ssy):
118 self._sprite.scale_speed = ssx, ssy 118 self._sprite.scale_speed = ssx, ssy
119 119
120 120
121 @instruction(12)
122 def fade(self, new_alpha, duration):
123 self._sprite.fade(duration, new_alpha, lambda x: x) #TODO: formula
124
125 @instruction(15)
126 @instruction(21) #TODO
127 def keep_still(self):
128 self._running = False
129
121 @instruction(16) 130 @instruction(16)
122 def load_random_sprite(self, min_idx, amp): 131 def load_random_sprite(self, min_idx, amp):
123 #TODO: use the game's PRNG? 132 #TODO: use the game's PRNG?
124 self.load_sprite(min_idx + randrange(amp)) 133 self.load_sprite(min_idx + randrange(amp))
125 134
126 135
136 @instruction(19)
137 def move_in(self, x, y, z, duration):
138 self._sprite.move_in(duration, x, y, z, lambda x: x) #TODO: formula
139
140
127 @instruction(23) 141 @instruction(23)
128 def set_corner_relative_placement(self): 142 def set_corner_relative_placement(self):
129 self._sprite.corner_relative_placement = True #TODO 143 self._sprite.corner_relative_placement = True #TODO
144
145
146 @instruction(25)
147 def set_allow_dest_offset(self, value):
148 self._sprite.allow_dest_offset = bool(value)
130 149
131 150
132 @instruction(27) 151 @instruction(27)
133 def shift_texture_x(self, dx): 152 def shift_texture_x(self, dx):
134 tox, toy = self._sprite.texoffsets 153 tox, toy = self._sprite.texoffsets
139 def shift_texture_y(self, dy): 158 def shift_texture_y(self, dy):
140 tox, toy = self._sprite.texoffsets 159 tox, toy = self._sprite.texoffsets
141 self._sprite.texoffsets = tox, toy + dy 160 self._sprite.texoffsets = tox, toy + dy
142 161
143 162
144 @instruction(15) 163 @instruction(30)
145 @instruction(21) #TODO 164 def scale_in(self, sx, sy, duration):
146 def keep_still(self): 165 self._sprite.scale_in(duration, sx, sy, lambda x: x) #TODO: formula
147 self._running = False
148 166