comparison pytouhou/game/game.pyx @ 606:3c2f96f1d715

Fix compilation under Cython 0.22, by making the pyx and the pxd declarations’ except clause similar.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 26 Nov 2014 13:36:38 +0100
parents e15672733c93
children a6af3ff86612
comparison
equal deleted inserted replaced
605:d6ead6f0ba80 606:3c2f96f1d715
117 self.spellcard_effect = None 117 self.spellcard_effect = None
118 if 'enemy_spellcard' in self.texts: 118 if 'enemy_spellcard' in self.texts:
119 del self.texts['enemy_spellcard'] 119 del self.texts['enemy_spellcard']
120 120
121 121
122 cdef void set_player_bomb(self): 122 cdef void set_player_bomb(self) except *:
123 face = Effect((-32, -16), 1, self.msg_anm[0][0][0]) 123 face = Effect((-32, -16), 1, self.msg_anm[0][0][0])
124 face.sprite.allow_dest_offset = True 124 face.sprite.allow_dest_offset = True
125 self.effects.append(face) 125 self.effects.append(face)
126 self.texts['player_spellcard'] = self.new_native_text((24, 24), u'Player Spellcard') 126 self.texts['player_spellcard'] = self.new_native_text((24, 24), u'Player Spellcard')
127 127
128 128
129 cdef void unset_player_bomb(self): 129 cdef void unset_player_bomb(self) except *:
130 del self.texts['player_spellcard'] 130 del self.texts['player_spellcard']
131 131
132 132
133 cpdef drop_bonus(self, double x, double y, long _type, end_pos=None, player=None): 133 cpdef drop_bonus(self, double x, double y, long _type, end_pos=None, player=None):
134 if _type > 6: 134 if _type > 6:
138 item_type = self.item_types[_type] 138 item_type = self.item_types[_type]
139 self.items.append(Item((x, y), _type, item_type, self, end_pos=end_pos, 139 self.items.append(Item((x, y), _type, item_type, self, end_pos=end_pos,
140 player=player)) 140 player=player))
141 141
142 142
143 cdef void autocollect(self, Player player): 143 cdef void autocollect(self, Player player) except *:
144 cdef Item item 144 cdef Item item
145 145
146 for item in self.items: 146 for item in self.items:
147 item.autocollect(player) 147 item.autocollect(player)
148 148
149 149
150 cdef void cancel_bullets(self): 150 cdef void cancel_bullets(self) except *:
151 cdef Bullet bullet 151 cdef Bullet bullet
152 cdef Laser laser 152 cdef Laser laser
153 153
154 for bullet in self.bullets: 154 for bullet in self.bullets:
155 bullet.cancel() 155 bullet.cancel()
156 for laser in self.lasers: 156 for laser in self.lasers:
157 laser.cancel() 157 laser.cancel()
158 158
159 cdef void cancel_player_lasers(self): 159 cdef void cancel_player_lasers(self) except *:
160 cdef PlayerLaser laser 160 cdef PlayerLaser laser
161 for laser in self.players_lasers: 161 for laser in self.players_lasers:
162 if laser is not None: 162 if laser is not None:
163 laser.cancel() 163 laser.cancel()
164 164
317 self.cleanup() 317 self.cleanup()
318 318
319 self.frame += 1 319 self.frame += 1
320 320
321 321
322 cdef void update_background(self): 322 cdef void update_background(self) except *:
323 if self.time_stop: 323 if self.time_stop:
324 return 324 return
325 if self.spellcard_effect is not None: 325 if self.spellcard_effect is not None:
326 self.spellcard_effect.update() 326 self.spellcard_effect.update()
327 #TODO: update the actual background here? 327 #TODO: update the actual background here?
328 328
329 329
330 cdef void update_enemies(self): 330 cdef void update_enemies(self) except *:
331 cdef Enemy enemy 331 cdef Enemy enemy
332 332
333 for enemy in self.enemies: 333 for enemy in self.enemies:
334 enemy.update() 334 enemy.update()
335 335
336 336
337 cdef void update_msg(self, long keystate): 337 cdef void update_msg(self, long keystate) except *:
338 cdef long k 338 cdef long k
339 339
340 for k in (1, 256): 340 for k in (1, 256):
341 if keystate & k and not self.last_keystate & k: 341 if keystate & k and not self.last_keystate & k:
342 self.msg_runner.skip() 342 self.msg_runner.skip()
344 self.msg_runner.skipping = bool(keystate & 256) 344 self.msg_runner.skipping = bool(keystate & 256)
345 self.last_keystate = keystate 345 self.last_keystate = keystate
346 self.msg_runner.run_iteration() 346 self.msg_runner.run_iteration()
347 347
348 348
349 cdef void update_players(self, list keystates): 349 cdef void update_players(self, list keystates) except *:
350 cdef Bullet bullet 350 cdef Bullet bullet
351 cdef Player player 351 cdef Player player
352 cdef long keystate 352 cdef long keystate
353 353
354 if self.time_stop: 354 if self.time_stop:
371 player.lives += 1 371 player.lives += 1
372 self.modify_difficulty(+2) 372 self.modify_difficulty(+2)
373 player.play_sound('extend') 373 player.play_sound('extend')
374 374
375 375
376 cdef void update_effects(self): 376 cdef void update_effects(self) except *:
377 cdef Element effect 377 cdef Element effect
378 378
379 for effect in self.effects: 379 for effect in self.effects:
380 effect.update() 380 effect.update()
381 381
382 382
383 cdef void update_hints(self): 383 cdef void update_hints(self) except *:
384 for hint in self.hints: 384 for hint in self.hints:
385 if hint['Count'] == self.frame and hint['Base'] == 'start': 385 if hint['Count'] == self.frame and hint['Base'] == 'start':
386 self.new_hint(hint) 386 self.new_hint(hint)
387 387
388 388
389 cdef void update_faces(self): 389 cdef void update_faces(self) except *:
390 for face in self.faces: 390 for face in self.faces:
391 if face: 391 if face:
392 face.update() 392 face.update()
393 393
394 394
395 cdef void update_bullets(self): 395 cdef void update_bullets(self) except *:
396 cdef Player player 396 cdef Player player
397 cdef Bullet bullet 397 cdef Bullet bullet
398 cdef Item item 398 cdef Item item
399 cdef PlayerLaser player_laser 399 cdef PlayerLaser player_laser
400 cdef Laser laser 400 cdef Laser laser