4 // Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
5 // Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
6 // Copyright (C) 2004 Ingo Ruhnke <grumbel@gmx.de>
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License
10 // as published by the Free Software Foundation; either version 2
11 // of the License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #ifndef SUPERTUX_WORLD_H
23 #define SUPERTUX_WORLD_H
31 #include "particlesystem.h"
36 /** The World class holds a level and all the game objects (badguys,
37 bouncy distros, etc) that are needed to run a game. */
45 std::vector<BouncyDistro> bouncy_distros;
46 std::vector<BrokenBrick> broken_bricks;
47 std::vector<BouncyBrick> bouncy_bricks;
48 std::vector<FloatingScore> floating_scores;
50 std::vector<BadGuy> bad_guys;
51 std::vector<Upgrade> upgrades;
52 std::vector<Bullet> bullets;
53 std::vector<ParticleSystem*> particle_systems;
56 bool counting_distros;
58 static World* current_;
60 static World* current() { return current_; }
61 static void set_current(World* w) { current_ = w; }
63 World(const std::string& filename);
64 World(const std::string& subset, int level_nr);
68 Level* get_level() { return level; }
69 Player* get_tux() { return &tux; }
74 void action(double frame_ratio);
76 /** Checks for all possible collisions. And calls the
77 collision_handlers, which the collision_objects provide for this
79 void collision_handler();
81 void activate_particle_systems();
82 void activate_bad_guys();
84 void add_score(float x, float y, int s);
85 void add_bouncy_distro(float x, float y);
86 void add_broken_brick(Tile* tile, float x, float y);
87 void add_broken_brick_piece(Tile* tile, float x, float y, float xm, float ym);
88 void add_bouncy_brick(float x, float y);
89 void add_bad_guy(float x, float y, BadGuyKind kind);
90 void add_upgrade(float x, float y, int dir, UpgradeKind kind);
91 void add_bullet(float x, float y, float xm, int dir);
93 /** Try to grab the coin at the given coordinates */
94 void trygrabdistro(float x, float y, int bounciness);
96 /** Try to break the brick at the given coordinates */
97 void trybreakbrick(float x, float y, bool small);
99 /** Try to get the content out of a bonus box, thus emptying it */
100 void tryemptybox(float x, float y, int col_side);
102 /** Try to bumb a badguy that might we walking above Tux, thus shaking
103 the tile which the badguy is walking on an killing him this way */
104 void trybumpbadguy(float x, float y);
107 /** FIMXE: Workaround for the leveleditor mainly */
108 extern World global_world;
110 #endif /*SUPERTUX_WORLD_H*/
112 /* Local Variables: */