8 #include "sprite_manager.h"
10 Surface* img_waves[3];
15 Surface* img_cloud[2][4];
17 Surface* img_box_full;
18 Surface* img_box_empty;
19 Surface* img_red_glow;
21 SpriteManager* sprite_manager = 0;
23 /* Load graphics/sounds shared between all levels: */
28 sprite_manager = new SpriteManager(datadir + "/supertux.strf");
31 smalltux_stand_left = new Surface(datadir + "/images/shared/smalltux-left-6.png", USE_ALPHA);
32 smalltux_stand_right = new Surface(datadir + "/images/shared/smalltux-right-6.png", USE_ALPHA);
34 smalltux_jump_left = new Surface(datadir + "/images/shared/smalltux-jump-left.png", USE_ALPHA);
35 smalltux_jump_right = new Surface(datadir + "/images/shared/smalltux-jump-right.png", USE_ALPHA);
38 tux_right[0] = new Surface(datadir + "/images/shared/smalltux-right-1.png", USE_ALPHA);
39 tux_right[1] = new Surface(datadir + "/images/shared/smalltux-right-2.png", USE_ALPHA);
40 tux_right[2] = new Surface(datadir + "/images/shared/smalltux-right-3.png", USE_ALPHA);
41 tux_right[3] = new Surface(datadir + "/images/shared/smalltux-right-4.png", USE_ALPHA);
42 tux_right[4] = new Surface(datadir + "/images/shared/smalltux-right-5.png", USE_ALPHA);
43 tux_right[5] = new Surface(datadir + "/images/shared/smalltux-right-6.png", USE_ALPHA);
44 tux_right[6] = new Surface(datadir + "/images/shared/smalltux-right-7.png", USE_ALPHA);
45 tux_right[7] = new Surface(datadir + "/images/shared/smalltux-right-8.png", USE_ALPHA);
48 tux_left[0] = new Surface(datadir + "/images/shared/smalltux-left-1.png", USE_ALPHA);
49 tux_left[1] = new Surface(datadir + "/images/shared/smalltux-left-2.png", USE_ALPHA);
50 tux_left[2] = new Surface(datadir + "/images/shared/smalltux-left-3.png", USE_ALPHA);
51 tux_left[3] = new Surface(datadir + "/images/shared/smalltux-left-4.png", USE_ALPHA);
52 tux_left[4] = new Surface(datadir + "/images/shared/smalltux-left-5.png", USE_ALPHA);
53 tux_left[5] = new Surface(datadir + "/images/shared/smalltux-left-6.png", USE_ALPHA);
54 tux_left[6] = new Surface(datadir + "/images/shared/smalltux-left-7.png", USE_ALPHA);
55 tux_left[7] = new Surface(datadir + "/images/shared/smalltux-left-8.png", USE_ALPHA);
57 firetux_right[0] = new Surface(datadir + "/images/shared/firetux-right-0.png", USE_ALPHA);
58 firetux_right[1] = new Surface(datadir + "/images/shared/firetux-right-1.png", USE_ALPHA);
59 firetux_right[2] = new Surface(datadir + "/images/shared/firetux-right-2.png", USE_ALPHA);
61 firetux_left[0] = new Surface(datadir + "/images/shared/firetux-left-0.png", USE_ALPHA);
62 firetux_left[1] = new Surface(datadir + "/images/shared/firetux-left-1.png", USE_ALPHA);
63 firetux_left[2] = new Surface(datadir + "/images/shared/firetux-left-2.png", USE_ALPHA);
66 cape_right[0] = new Surface(datadir + "/images/shared/cape-right-0.png",
69 cape_right[1] = new Surface(datadir + "/images/shared/cape-right-1.png",
72 cape_left[0] = new Surface(datadir + "/images/shared/cape-left-0.png",
75 cape_left[1] = new Surface(datadir + "/images/shared/cape-left-1.png",
78 bigtux_right = sprite_manager->load("largetux-walk-right");
79 bigtux_left = sprite_manager->load("largetux-walk-left");
81 bigtux_left_jump = sprite_manager->load("largetux-jump-left");
82 bigtux_right_jump = sprite_manager->load("largetux-jump-right");
84 bigcape_right[0] = new Surface(datadir + "/images/shared/bigcape-right-0.png",
87 bigcape_right[1] = new Surface(datadir + "/images/shared/bigcape-right-1.png",
90 bigcape_left[0] = new Surface(datadir + "/images/shared/bigcape-left-0.png",
93 bigcape_left[1] = new Surface(datadir + "/images/shared/bigcape-left-1.png",
96 bigfiretux_right[0] = new Surface(datadir + "/images/shared/bigfiretux-right-0.png",
99 bigfiretux_right[1] = new Surface(datadir + "/images/shared/bigfiretux-right-1.png",
102 bigfiretux_right[2] = new Surface(datadir + "/images/shared/bigfiretux-right-2.png",
105 bigfiretux_right_jump = new Surface(datadir + "/images/shared/bigfiretux-right-jump.png", USE_ALPHA);
107 bigfiretux_left[0] = new Surface(datadir + "/images/shared/bigfiretux-left-0.png",
110 bigfiretux_left[1] = new Surface(datadir + "/images/shared/bigfiretux-left-1.png",
113 bigfiretux_left[2] = new Surface(datadir + "/images/shared/bigfiretux-left-2.png",
116 bigfiretux_left_jump = new Surface(datadir + "/images/shared/bigfiretux-left-jump.png", USE_ALPHA);
118 bigcape_right[0] = new Surface(datadir + "/images/shared/bigcape-right-0.png",
121 bigcape_right[1] = new Surface(datadir + "/images/shared/bigcape-right-1.png",
124 bigcape_left[0] = new Surface(datadir + "/images/shared/bigcape-left-0.png",
127 bigcape_left[1] = new Surface(datadir + "/images/shared/bigcape-left-1.png",
131 ducktux_left = sprite_manager->load("largetux-duck-left");
132 ducktux_right = sprite_manager->load("largetux-duck-right");
134 skidtux_right = new Surface(datadir +
135 "/images/shared/skidtux-right.png",
138 skidtux_left = new Surface(datadir +
139 "/images/shared/skidtux-left.png",
142 duckfiretux_right = new Surface(datadir +
143 "/images/shared/duckfiretux-right.png",
146 duckfiretux_left = new Surface(datadir +
147 "/images/shared/duckfiretux-left.png",
150 skidfiretux_right = new Surface(datadir +
151 "/images/shared/skidfiretux-right.png",
154 skidfiretux_left = new Surface(datadir +
155 "/images/shared/skidfiretux-left.png",
161 img_box_full = new Surface(datadir + "/images/shared/box-full.png",
163 img_box_empty = new Surface(datadir + "/images/shared/box-empty.png",
170 img_water = new Surface(datadir + "/images/shared/water.png", IGNORE_ALPHA);
172 img_waves[0] = new Surface(datadir + "/images/shared/waves-0.png",
175 img_waves[1] = new Surface(datadir + "/images/shared/waves-1.png",
178 img_waves[2] = new Surface(datadir + "/images/shared/waves-2.png",
184 img_pole = new Surface(datadir + "/images/shared/pole.png", USE_ALPHA);
185 img_poletop = new Surface(datadir + "/images/shared/poletop.png",
191 img_flag[0] = new Surface(datadir + "/images/shared/flag-0.png",
193 img_flag[1] = new Surface(datadir + "/images/shared/flag-1.png",
199 img_cloud[0][0] = new Surface(datadir + "/images/shared/cloud-00.png",
202 img_cloud[0][1] = new Surface(datadir + "/images/shared/cloud-01.png",
205 img_cloud[0][2] = new Surface(datadir + "/images/shared/cloud-02.png",
208 img_cloud[0][3] = new Surface(datadir + "/images/shared/cloud-03.png",
212 img_cloud[1][0] = new Surface(datadir + "/images/shared/cloud-10.png",
215 img_cloud[1][1] = new Surface(datadir + "/images/shared/cloud-11.png",
218 img_cloud[1][2] = new Surface(datadir + "/images/shared/cloud-12.png",
221 img_cloud[1][3] = new Surface(datadir + "/images/shared/cloud-13.png",
232 img_red_glow = new Surface(datadir + "/images/shared/red-glow.png",
236 img_distro[0] = new Surface(datadir + "/images/shared/distro-0.png",
239 img_distro[1] = new Surface(datadir + "/images/shared/distro-1.png",
242 img_distro[2] = new Surface(datadir + "/images/shared/distro-2.png",
245 img_distro[3] = new Surface(datadir + "/images/shared/distro-3.png",
251 tux_life = new Surface(datadir + "/images/shared/tux-life.png",
256 /* if (use_sound) // this will introduce SERIOUS bugs here ! because "load_sound"
257 // initialize sounds[i] with the correct pointer's value:
258 // NULL or something else. And it will be dangerous to
259 // play with not-initialized pointers.
260 // This is also true with if (use_music)
261 Send a mail to me: neoneurone@users.sf.net, if you have another opinion. :)
263 for (i = 0; i < NUM_SOUNDS; i++)
264 sounds[i] = load_sound(datadir + soundfilenames[i]);
267 herring_song = load_song(datadir + "/music/SALCON.MOD");
271 /* Free shared data: */
272 void unloadshared(void)
274 delete sprite_manager;
280 for (i = 0; i < 3; i++)
286 delete bigtux_right_jump;
287 delete bigtux_left_jump;
289 for (i = 0; i < 2; i++)
291 delete cape_right[i];
293 delete bigcape_right[i];
294 delete bigcape_left[i];
298 delete ducktux_right;
301 delete skidtux_right;
306 delete img_box_empty;
309 for (i = 0; i < 3; i++)
315 for (i = 0; i < 2; i++)
318 for (i = 0; i < 4; i++)
320 delete img_distro[i];
321 delete img_cloud[0][i];
322 delete img_cloud[1][i];
325 for (i = 0; i < NUM_SOUNDS; i++)
326 free_chunk(sounds[i]);
328 /* free the herring song */
329 free_music( herring_song );