- for (unsigned int i = 0; i < broken_bricks.size(); ++i)
- broken_bricks[i]->draw();
-
- /* Draw foreground: */
- for (y = 0; y < 15; ++y)
- {
- for (x = 0; x < 21; ++x)
- {
- Tile::draw(32*x - fmodf(scroll_x, 32), y * 32,
- level->fg_tiles[(int)y + (int)(scroll_y / 32)][(int)x + (int)(scroll_x / 32)]);
- }
- }
-
- /* Draw particle systems (foreground) */
- for(p = particle_systems.begin(); p != particle_systems.end(); ++p)
- {
- (*p)->draw(scroll_x, 0, 1);
- }
-}
-
-void
-World::action(double frame_ratio)
-{
- tux.action(frame_ratio);
- tux.check_bounds(level->back_scrolling, (bool)level->hor_autoscroll_speed);
- scrolling(frame_ratio);
-
- /* Handle bouncy distros: */
- for (unsigned int i = 0; i < bouncy_distros.size(); i++)
- bouncy_distros[i]->action(frame_ratio);
-
- /* Handle broken bricks: */
- for (unsigned int i = 0; i < broken_bricks.size(); i++)
- broken_bricks[i]->action(frame_ratio);
-
- // Handle all kinds of game objects
- for (unsigned int i = 0; i < bouncy_bricks.size(); i++)
- bouncy_bricks[i]->action(frame_ratio);
-
- for (unsigned int i = 0; i < floating_scores.size(); i++)
- floating_scores[i]->action(frame_ratio);
-
- for (unsigned int i = 0; i < bullets.size(); ++i)
- bullets[i].action(frame_ratio);
-
- for (unsigned int i = 0; i < upgrades.size(); i++)
- upgrades[i].action(frame_ratio);
-
- for (BadGuys::iterator i = bad_guys.begin(); i != bad_guys.end(); ++i)
- (*i)->action(frame_ratio);
-
- /* update particle systems */
- std::vector<ParticleSystem*>::iterator p;
- for(p = particle_systems.begin(); p != particle_systems.end(); ++p)
- {
- (*p)->simulate(frame_ratio);
- }
-
- /* Handle all possible collisions. */
- collision_handler();
-
- // Cleanup marked badguys
- for (BadGuys::iterator i = bad_guys.begin(); i != bad_guys.end();
- /* ++i handled at end of the loop */) {
- if ((*i)->is_removable()) {
- delete *i;
- i = bad_guys.erase(i);
- } else {
- ++i;
- }
- }
-}
-
-// the space that it takes for the screen to start scrolling, regarding
-// screen bounds (in pixels)
-#define X_SPACE (400-16)
-// the time it takes to move the camera (in ms)
-#define CHANGE_DIR_SCROLL_SPEED 2000
-
-/* This functions takes cares of the scrolling */
-void World::scrolling(double frame_ratio)
-{
- if(level->hor_autoscroll_speed)
- {
- scroll_x += level->hor_autoscroll_speed * frame_ratio;