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[0] = new Surface(datadir + "/images/shared/bigtux-right-0.png",
81 bigtux_right[1] = new Surface(datadir + "/images/shared/bigtux-right-1.png",
84 bigtux_right[2] = new Surface(datadir + "/images/shared/bigtux-right-2.png",
87 bigtux_right_jump = new Surface(datadir + "/images/shared/bigtux-right-jump.png", USE_ALPHA);
89 bigtux_left[0] = new Surface(datadir + "/images/shared/bigtux-left-0.png",
92 bigtux_left[1] = new Surface(datadir + "/images/shared/bigtux-left-1.png",
95 bigtux_left[2] = new Surface(datadir + "/images/shared/bigtux-left-2.png",
98 bigtux_left_jump = new Surface(datadir + "/images/shared/bigtux-left-jump.png", USE_ALPHA);
100 bigcape_right[0] = new Surface(datadir + "/images/shared/bigcape-right-0.png",
103 bigcape_right[1] = new Surface(datadir + "/images/shared/bigcape-right-1.png",
106 bigcape_left[0] = new Surface(datadir + "/images/shared/bigcape-left-0.png",
109 bigcape_left[1] = new Surface(datadir + "/images/shared/bigcape-left-1.png",
112 bigfiretux_right[0] = new Surface(datadir + "/images/shared/bigfiretux-right-0.png",
115 bigfiretux_right[1] = new Surface(datadir + "/images/shared/bigfiretux-right-1.png",
118 bigfiretux_right[2] = new Surface(datadir + "/images/shared/bigfiretux-right-2.png",
121 bigfiretux_right_jump = new Surface(datadir + "/images/shared/bigfiretux-right-jump.png", USE_ALPHA);
123 bigfiretux_left[0] = new Surface(datadir + "/images/shared/bigfiretux-left-0.png",
126 bigfiretux_left[1] = new Surface(datadir + "/images/shared/bigfiretux-left-1.png",
129 bigfiretux_left[2] = new Surface(datadir + "/images/shared/bigfiretux-left-2.png",
132 bigfiretux_left_jump = new Surface(datadir + "/images/shared/bigfiretux-left-jump.png", USE_ALPHA);
134 bigcape_right[0] = new Surface(datadir + "/images/shared/bigcape-right-0.png",
137 bigcape_right[1] = new Surface(datadir + "/images/shared/bigcape-right-1.png",
140 bigcape_left[0] = new Surface(datadir + "/images/shared/bigcape-left-0.png",
143 bigcape_left[1] = new Surface(datadir + "/images/shared/bigcape-left-1.png",
147 ducktux_right = new Surface(datadir +
148 "/images/shared/ducktux-right.png",
151 ducktux_left = new Surface(datadir +
152 "/images/shared/ducktux-left.png",
155 skidtux_right = new Surface(datadir +
156 "/images/shared/skidtux-right.png",
159 skidtux_left = new Surface(datadir +
160 "/images/shared/skidtux-left.png",
163 duckfiretux_right = new Surface(datadir +
164 "/images/shared/duckfiretux-right.png",
167 duckfiretux_left = new Surface(datadir +
168 "/images/shared/duckfiretux-left.png",
171 skidfiretux_right = new Surface(datadir +
172 "/images/shared/skidfiretux-right.png",
175 skidfiretux_left = new Surface(datadir +
176 "/images/shared/skidfiretux-left.png",
182 img_box_full = new Surface(datadir + "/images/shared/box-full.png",
184 img_box_empty = new Surface(datadir + "/images/shared/box-empty.png",
191 img_water = new Surface(datadir + "/images/shared/water.png", IGNORE_ALPHA);
193 img_waves[0] = new Surface(datadir + "/images/shared/waves-0.png",
196 img_waves[1] = new Surface(datadir + "/images/shared/waves-1.png",
199 img_waves[2] = new Surface(datadir + "/images/shared/waves-2.png",
205 img_pole = new Surface(datadir + "/images/shared/pole.png", USE_ALPHA);
206 img_poletop = new Surface(datadir + "/images/shared/poletop.png",
212 img_flag[0] = new Surface(datadir + "/images/shared/flag-0.png",
214 img_flag[1] = new Surface(datadir + "/images/shared/flag-1.png",
220 img_cloud[0][0] = new Surface(datadir + "/images/shared/cloud-00.png",
223 img_cloud[0][1] = new Surface(datadir + "/images/shared/cloud-01.png",
226 img_cloud[0][2] = new Surface(datadir + "/images/shared/cloud-02.png",
229 img_cloud[0][3] = new Surface(datadir + "/images/shared/cloud-03.png",
233 img_cloud[1][0] = new Surface(datadir + "/images/shared/cloud-10.png",
236 img_cloud[1][1] = new Surface(datadir + "/images/shared/cloud-11.png",
239 img_cloud[1][2] = new Surface(datadir + "/images/shared/cloud-12.png",
242 img_cloud[1][3] = new Surface(datadir + "/images/shared/cloud-13.png",
253 img_red_glow = new Surface(datadir + "/images/shared/red-glow.png",
257 img_distro[0] = new Surface(datadir + "/images/shared/distro-0.png",
260 img_distro[1] = new Surface(datadir + "/images/shared/distro-1.png",
263 img_distro[2] = new Surface(datadir + "/images/shared/distro-2.png",
266 img_distro[3] = new Surface(datadir + "/images/shared/distro-3.png",
272 tux_life = new Surface(datadir + "/images/shared/tux-life.png",
277 /* if (use_sound) // this will introduce SERIOUS bugs here ! because "load_sound"
278 // initialize sounds[i] with the correct pointer's value:
279 // NULL or something else. And it will be dangerous to
280 // play with not-initialized pointers.
281 // This is also true with if (use_music)
282 Send a mail to me: neoneurone@users.sf.net, if you have another opinion. :)
284 for (i = 0; i < NUM_SOUNDS; i++)
285 sounds[i] = load_sound(datadir + soundfilenames[i]);
288 herring_song = load_song(datadir + "/music/SALCON.MOD");
292 /* Free shared data: */
293 void unloadshared(void)
295 delete sprite_manager;
301 for (i = 0; i < 3; i++)
305 delete bigtux_right[i];
306 delete bigtux_left[i];
309 delete bigtux_right_jump;
310 delete bigtux_left_jump;
312 for (i = 0; i < 2; i++)
314 delete cape_right[i];
316 delete bigcape_right[i];
317 delete bigcape_left[i];
321 delete ducktux_right;
324 delete skidtux_right;
329 delete img_box_empty;
332 for (i = 0; i < 3; i++)
338 for (i = 0; i < 2; i++)
341 for (i = 0; i < 4; i++)
343 delete img_distro[i];
344 delete img_cloud[0][i];
345 delete img_cloud[1][i];
348 for (i = 0; i < NUM_SOUNDS; i++)
349 free_chunk(sounds[i]);
351 /* free the herring song */
352 free_music( herring_song );