2 // C Implementation: scene
7 // Author: Tobias Glaesser <tobi.web@gmx.de>, (C) 2004
9 // Copyright: See COPYING file that comes with this distribution
16 int score, distros, level, next_level, game_pause, quit, score_multiplier, endpos, counting_distros, distro_counter;
17 timer_type super_bkgd_timer;
20 std::vector<bouncy_distro_type> bouncy_distros;
21 std::vector<broken_brick_type> broken_bricks;
22 std::vector<bouncy_brick_type> bouncy_bricks;
23 std::vector<bad_guy_type> bad_guys;
24 std::vector<floating_score_type> floating_scores;
25 std::vector<upgrade_type> upgrades;
26 std::vector<bullet_type> bullets;
28 texture_type img_box_full, img_box_empty, img_mints, img_coffee, img_super_bkgd, img_red_glow;
32 /* Initialize all 'dynamic' arrays */
33 void arrays_init(void)
37 /* Free memory of 'dynamic' arrays */
38 void arrays_free(void)
41 bouncy_distros.clear();
42 broken_bricks.clear();
43 bouncy_bricks.clear();
44 floating_scores.clear();
49 void set_defaults(void)
56 timer_init(&super_bkgd_timer, YES);
58 counting_distros = NO;
63 /* set current song/music */
64 set_current_music(LEVEL_MUSIC);
69 void add_score(float x, float y, int s)
75 floating_score_type new_floating_score;
76 floating_score_init(&new_floating_score,x,y,s);
77 floating_scores.push_back(new_floating_score);
80 /* Add a bouncy distro: */
82 void add_bouncy_distro(float x, float y)
85 bouncy_distro_type new_bouncy_distro;
86 bouncy_distro_init(&new_bouncy_distro,x,y);
87 bouncy_distros.push_back(new_bouncy_distro);
91 /* Add broken brick pieces: */
93 void add_broken_brick(float x, float y)
95 add_broken_brick_piece(x, y, -1, -4);
96 add_broken_brick_piece(x, y + 16, -1.5, -3);
98 add_broken_brick_piece(x + 16, y, 1, -4);
99 add_broken_brick_piece(x + 16, y + 16, 1.5, -3);
103 /* Add a broken brick piece: */
105 void add_broken_brick_piece(float x, float y, float xm, float ym)
107 broken_brick_type new_broken_brick;
108 broken_brick_init(&new_broken_brick,x,y,xm,ym);
109 broken_bricks.push_back(new_broken_brick);
113 /* Add a bouncy brick piece: */
115 void add_bouncy_brick(float x, float y)
117 bouncy_brick_type new_bouncy_brick;
118 bouncy_brick_init(&new_bouncy_brick,x,y);
119 bouncy_bricks.push_back(new_bouncy_brick);
125 void add_bad_guy(float x, float y, int kind)
127 bad_guy_type new_bad_guy;
128 badguy_init(&new_bad_guy,x,y,kind);
129 bad_guys.push_back(new_bad_guy);
132 /* Add an upgrade: */
134 void add_upgrade(float x, float y, int dir, int kind)
136 upgrade_type new_upgrade;
137 upgrade_init(&new_upgrade,x,y,dir,kind);
138 upgrades.push_back(new_upgrade);
143 void add_bullet(float x, float y, float xm, int dir)
145 bullet_type new_bullet;
146 bullet_init(&new_bullet,x,y,xm,dir);
147 bullets.push_back(new_bullet);
149 play_sound(sounds[SND_SHOOT], SOUND_CENTER_SPEAKER);