7 // Author: Tobias Glaesser <tobi.web@gmx.de>, (C) 2003
9 // Copyright: See COPYING file that comes with this distribution
13 #ifndef SUPERTUX_WORLD_H
14 #define SUPERTUX_WORLD_H
21 #include "particlesystem.h"
23 /* Bounciness of distros: */
28 struct bouncy_distro_type
33 extern texture_type img_distro[4];
35 void bouncy_distro_init(bouncy_distro_type* pbouncy_distro, float x, float y);
36 void bouncy_distro_action(bouncy_distro_type* pbouncy_distro);
37 void bouncy_distro_draw(bouncy_distro_type* pbouncy_distro);
38 void bouncy_distro_collision(bouncy_distro_type* pbouncy_distro, int c_object);
40 #define BOUNCY_BRICK_MAX_OFFSET 8
41 #define BOUNCY_BRICK_SPEED 0.9
43 struct broken_brick_type
50 void broken_brick_init(broken_brick_type* pbroken_brick, Tile* tile,
51 float x, float y, float xm, float ym);
52 void broken_brick_action(broken_brick_type* pbroken_brick);
53 void broken_brick_draw(broken_brick_type* pbroken_brick);
55 struct bouncy_brick_type
63 void bouncy_brick_init(bouncy_brick_type* pbouncy_brick, float x, float y);
64 void bouncy_brick_action(bouncy_brick_type* pbouncy_brick);
65 void bouncy_brick_draw(bouncy_brick_type* pbouncy_brick);
67 struct floating_score_type
74 void floating_score_init(floating_score_type* pfloating_score, float x, float y, int s);
75 void floating_score_action(floating_score_type* pfloating_score);
76 void floating_score_draw(floating_score_type* pfloating_score);
78 /** Try to grab the coin at the given coordinates */
79 void trygrabdistro(float x, float y, int bounciness);
81 /** Try to break the brick at the given coordinates */
82 void trybreakbrick(float x, float y, bool small);
84 /** Try to get the content out of a bonus box, thus emptying it */
85 void tryemptybox(float x, float y, int col_side);
87 /** Try to bumb a badguy that might we walking above Tux, thus shaking
88 the tile which the badguy is walking on an killing him this way */
89 void trybumpbadguy(float x, float y);
92 /** The World class holds a level and all the game objects (badguys,
93 bouncy distros, etc) that are needed to run a game. */
99 std::vector<bouncy_distro_type> bouncy_distros;
100 std::vector<broken_brick_type> broken_bricks;
101 std::vector<bouncy_brick_type> bouncy_bricks;
102 std::vector<BadGuy> bad_guys;
103 std::vector<floating_score_type> floating_scores;
104 std::vector<upgrade_type> upgrades;
105 std::vector<bullet_type> bullets;
106 std::vector<ParticleSystem*> particle_systems;
112 Level* get_level() { return level; }
118 /** Load data for this level:
119 Returns -1, if the loading of the level failed. */
120 int load(const char* subset, int level);
122 /** Load data for this level:
123 Returns -1, if the loading of the level failed. */
124 int load(const std::string& filename);
126 void activate_particle_systems();
128 void add_score(float x, float y, int s);
129 void add_bouncy_distro(float x, float y);
130 void add_broken_brick(Tile* tile, float x, float y);
131 void add_broken_brick_piece(Tile* tile, float x, float y, float xm, float ym);
132 void add_bouncy_brick(float x, float y);
133 void add_bad_guy(float x, float y, BadGuyKind kind);
134 void add_upgrade(float x, float y, int dir, int kind);
135 void add_bullet(float x, float y, float xm, int dir);
140 #endif /*SUPERTUX_WORLD_H*/