2 // C Implementation: scene
7 // Author: Tobias Glaesser <tobi.web@gmx.de>, (C) 2004
9 // Copyright: See COPYING file that comes with this distribution
24 bool counting_distros;
26 timer_type super_bkgd_timer;
28 int global_frame_counter;
29 std::vector<bouncy_distro_type> bouncy_distros;
30 std::vector<broken_brick_type> broken_bricks;
31 std::vector<bouncy_brick_type> bouncy_bricks;
32 std::vector<BadGuy> bad_guys;
33 std::vector<floating_score_type> floating_scores;
34 std::vector<upgrade_type> upgrades;
35 std::vector<bullet_type> bullets;
37 texture_type img_box_full, img_box_empty, img_mints, img_coffee, img_super_bkgd, img_red_glow;
41 /* Initialize all 'dynamic' arrays */
42 void arrays_init(void)
46 /* Free memory of 'dynamic' arrays */
47 void arrays_free(void)
50 bouncy_distros.clear();
51 broken_bricks.clear();
52 bouncy_bricks.clear();
53 floating_scores.clear();
58 void set_defaults(void)
65 timer_init(&super_bkgd_timer, true);
67 counting_distros = false;
72 /* set current song/music */
73 set_current_music(LEVEL_MUSIC);
78 void add_score(float x, float y, int s)
84 floating_score_type new_floating_score;
85 floating_score_init(&new_floating_score,x,y,s);
86 floating_scores.push_back(new_floating_score);
89 /* Add a bouncy distro: */
91 void add_bouncy_distro(float x, float y)
94 bouncy_distro_type new_bouncy_distro;
95 bouncy_distro_init(&new_bouncy_distro,x,y);
96 bouncy_distros.push_back(new_bouncy_distro);
100 /* Add broken brick pieces: */
102 void add_broken_brick(float x, float y)
104 add_broken_brick_piece(x, y, -1, -4);
105 add_broken_brick_piece(x, y + 16, -1.5, -3);
107 add_broken_brick_piece(x + 16, y, 1, -4);
108 add_broken_brick_piece(x + 16, y + 16, 1.5, -3);
112 /* Add a broken brick piece: */
114 void add_broken_brick_piece(float x, float y, float xm, float ym)
116 broken_brick_type new_broken_brick;
117 broken_brick_init(&new_broken_brick,x,y,xm,ym);
118 broken_bricks.push_back(new_broken_brick);
122 /* Add a bouncy brick piece: */
124 void add_bouncy_brick(float x, float y)
126 bouncy_brick_type new_bouncy_brick;
127 bouncy_brick_init(&new_bouncy_brick,x,y);
128 bouncy_bricks.push_back(new_bouncy_brick);
134 void add_bad_guy(float x, float y, BadGuyKind kind)
137 new_bad_guy.init(x,y,kind);
138 bad_guys.push_back(new_bad_guy);
141 /* Add an upgrade: */
143 void add_upgrade(float x, float y, int dir, int kind)
145 upgrade_type new_upgrade;
146 upgrade_init(&new_upgrade,x,y,dir,kind);
147 upgrades.push_back(new_upgrade);
152 void add_bullet(float x, float y, float xm, int dir)
154 bullet_type new_bullet;
155 bullet_init(&new_bullet,x,y,xm,dir);
156 bullets.push_back(new_bullet);
158 play_sound(sounds[SND_SHOOT], SOUND_CENTER_SPEAKER);