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"
33 #include "display_manager.h"
38 /** The World class holds a level and all the game objects (badguys,
39 bouncy distros, etc) that are needed to run a game. */
43 typedef std::list<BadGuy*> BadGuys;
44 BadGuys bad_guys_to_add;
45 typedef std::list<Trampoline*> Trampolines;
46 Trampolines trampolines;
47 typedef std::list<FlyingPlatform*> FlyingPlatforms;
48 FlyingPlatforms flying_platforms;
53 bool counting_distros;
56 static World* current_;
58 Background* background;
61 std::vector<Upgrade*> upgrades;
62 std::vector<Bullet*> bullets;
63 std::vector<GameObject*> gameobjects;
66 DisplayManager displaymanager;
69 static World* current()
71 static void set_current(World* w)
74 World(const std::string& filename, int level_nr = -1);
82 void add_object(GameObject* object);
87 void action(float elapsed_time);
89 void play_music(int musictype);
92 /** Checks for all possible collisions. And calls the
93 collision_handlers, which the collision_objects provide for this
95 void collision_handler();
97 void parse_objects(lisp_object_t* cur);
99 void activate_particle_systems();
101 void add_score(const Vector& pos, int s);
102 void add_bouncy_distro(const Vector& pos);
103 void add_broken_brick(const Vector& pos, Tile* tile);
104 void add_broken_brick_piece(const Vector& pos,
105 const Vector& movement, Tile* tile);
106 void add_bouncy_brick(const Vector& pos);
108 BadGuy* add_bad_guy(float x, float y, BadGuyKind kind);
110 void add_upgrade(const Vector& pos, Direction dir, UpgradeKind kind);
111 bool add_bullet(const Vector& pos, float xm, Direction dir);
113 /** Try to grab the coin at the given coordinates */
114 void trygrabdistro(float x, float y, int bounciness);
116 /** Try to break the brick at the given coordinates */
117 bool trybreakbrick(float x, float y, bool small);
119 /** Try to get the content out of a bonus box, thus emptying it */
120 void tryemptybox(float x, float y, Direction col_side);
122 /** Try to bumb a badguy that might we walking above Tux, thus shaking
123 the tile which the badguy is walking on an killing him this way */
124 void trybumpbadguy(float x, float y);
126 /** Apply bonuses active in the player status, used to reactivate
127 bonuses from former levels */
128 void apply_bonuses();
131 /** FIMXE: Workaround for the leveleditor mainly */
132 extern World global_world;
134 #endif /*SUPERTUX_WORLD_H*/
136 /* Local Variables: */