1 /* loading.c */
2
3 # include "loading.h"
4
loaddata(int map[][11][16])5 void loaddata (int map[][11][16]) {
6
7 uint i = 0;
8 uint j = 0;
9 uint k = 0;
10 FILE *datafile = fopen(DATADIR "/data/rounds.txt", "r");
11 char line[49];
12 char temp[3];
13 temp[2] = 0;
14
15 /* Load data an put in array */
16 fgets (line, 49, datafile);
17 for (i=0;i<58;i++) {
18 for (j=0;j<11;j++) {
19 for (k=0;k<16;k+=1) {
20 temp[0] = line[k*3];
21 temp[1] = line[k*3 + 1];
22 sscanf (temp, "%d", &map[i][j][k]);
23 }
24 fgets (line, 49, datafile);
25 }
26 fgets (line, 49, datafile);
27 }
28
29 fclose(datafile);
30
31 }
32
load_music(Mix_Music * bsogame,int round)33 void load_music(Mix_Music *bsogame, int round) {
34
35 if ((round == 0) || (round == 5) || (round == 10) || (round == 15) || (round == 20) || (round == 25) || (round == 30) || (round == 35) || (round == 40) || (round == 45) || (round == 50) || (round == 55))
36 bsogame = Mix_LoadMUS(DATADIR "/music/stage1.ogg");
37 if ((round == 1) || (round == 6) || (round == 11) || (round == 16) || (round == 21) || (round == 26) || (round == 31) || (round == 36) || (round == 41) || (round == 46) || (round == 51) || (round == 56))
38 bsogame = Mix_LoadMUS(DATADIR "/music/stage2.ogg");
39 if ((round == 2) || (round == 7) || (round == 12) || (round == 17) || (round == 22) || (round == 27) || (round == 32) || (round == 37) || (round == 42) || (round == 47) || (round == 52) || (round == 57))
40 bsogame = Mix_LoadMUS(DATADIR "/music/stage3.ogg");
41 if ((round == 3) || (round == 8) || (round == 13) || (round == 18) || (round == 23) || (round == 28) || (round == 33) || (round == 38) || (round == 43) || (round == 48) || (round == 53))
42 bsogame = Mix_LoadMUS(DATADIR "/music/stage4.ogg");
43 if ((round == 4) || (round == 9) || (round == 14) || (round == 19) || (round == 24) || (round == 29) || (round == 34) || (round == 39) || (round == 44) || (round == 49) || (round == 54))
44 bsogame = Mix_LoadMUS(DATADIR "/music/stage5.ogg");
45
46 Mix_PlayMusic(bsogame, -1);
47
48 }