static void explosions_update(void) { LIST *head = list_first(asteroids.explosions); while(head) { ANIMATION *explosion = (ANIMATION *) head->data; if(explosion->current_frame < explosion->n_frames) { animation_update(explosion); } else { remove_explosion(explosion); head = list_first(asteroids.explosions); continue; } head = head->next; } }
void draw_explosions() { Uint16 i; EXPLOSION *p; for( i = 0; i < num_explosions; i++ ) { p = get_explosion( i ); /* Check for animation over. */ if( p->sprite->cur_frame < p->last_frame ) { remove_explosion( p ); } else { /* Draw the explosion. */ p->last_frame = p->sprite->cur_frame; draw_sprite( p->sprite ); } } }