comparison pytouhou/game/laser.pyx @ 617:a6af3ff86612

Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 29 Mar 2015 00:08:20 +0100
parents 3c2f96f1d715
children
comparison
equal deleted inserted replaced
616:4ce3ef053a25 617:a6af3ff86612
83 self.width = width 83 self.width = width
84 84
85 self.set_anim() 85 self.set_anim()
86 86
87 87
88 cdef void set_anim(self, long sprite_idx_offset=-1) except *: 88 cdef bint set_anim(self, long sprite_idx_offset=-1) except True:
89 if sprite_idx_offset >= 0: 89 if sprite_idx_offset >= 0:
90 self.sprite_idx_offset = sprite_idx_offset 90 self.sprite_idx_offset = sprite_idx_offset
91 91
92 lt = self._laser_type 92 lt = self._laser_type
93 self.sprite = Sprite() 93 self.sprite = Sprite()
219 self.damage = damage 219 self.damage = damage
220 220
221 self.set_anim() 221 self.set_anim()
222 222
223 223
224 cdef void set_anim(self, long sprite_idx_offset=-1) except *: 224 cdef bint set_anim(self, long sprite_idx_offset=-1) except True:
225 if sprite_idx_offset >= 0: 225 if sprite_idx_offset >= 0:
226 self.sprite_idx_offset = sprite_idx_offset 226 self.sprite_idx_offset = sprite_idx_offset
227 227
228 lt = self._laser_type 228 lt = self._laser_type
229 self.sprite = Sprite() 229 self.sprite = Sprite()
230 self.anmrunner = ANMRunner(lt.anm, lt.anim_index, 230 self.anmrunner = ANMRunner(lt.anm, lt.anim_index,
231 self.sprite, self.sprite_idx_offset) 231 self.sprite, self.sprite_idx_offset)
232 #self.sprite.blendfunc = 1 #XXX 232 #self.sprite.blendfunc = 1 #XXX
233 233
234 234
235 cdef void cancel(self) except *: 235 cdef bint cancel(self) except True:
236 self.anmrunner.interrupt(1) 236 self.anmrunner.interrupt(1)
237 237
238 238
239 cdef void update(self) except *: 239 cdef bint update(self) except True:
240 if self.anmrunner is not None and not self.anmrunner.run_frame(): 240 if self.anmrunner is not None and not self.anmrunner.run_frame():
241 self.anmrunner = None 241 self.anmrunner = None
242 self.removed = True 242 self.removed = True
243 243
244 length = self.origin.y 244 length = self.origin.y