diff --git a/src/system/sound.c b/src/system/sound.c index f4dc021..1f51670 100644 --- a/src/system/sound.c +++ b/src/system/sound.c @@ -34,7 +34,7 @@ void initSounds(void) loadSounds(); } -void playMusic(char *filename, int loop) +void loadMusic(char *filename) { if (music != NULL) { @@ -44,8 +44,11 @@ void playMusic(char *filename, int loop) } music = Mix_LoadMUS(getFileLocation(filename)); +} - Mix_PlayMusic(music, (loop) ? -1 : 0); +void playMusic(int loop) +{ + Mix_PlayMusic(music, (loop) ? -1 : 0); } void stopMusic(void) @@ -75,7 +78,7 @@ void playSound(int snd, int ch) int isPlayingMusic(void) { - return 0; + return Mix_PlayingMusic(); } static Mix_Chunk *loadSound(char *filename) diff --git a/src/world/world.c b/src/world/world.c index 7828209..5166529 100644 --- a/src/world/world.c +++ b/src/world/world.c @@ -45,6 +45,8 @@ void initWorld(void) background = getTexture(world.background); + loadMusic(world.music); + initQuadtree(&world.quadtree); initObjectives(); @@ -71,6 +73,10 @@ void initWorld(void) hideAllWidgets(); world.betweenTimer = 0; } + else + { + playMusic(1); + } if (!game.isResumingMission) { diff --git a/src/world/world.h b/src/world/world.h index 8c111fe..c93f1ba 100644 --- a/src/world/world.h +++ b/src/world/world.h @@ -67,6 +67,8 @@ extern void drawMissionStatus(void); extern int isAcceptControl(void); extern void clearControls(void); extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...); +extern void loadMusic(char *filename); +extern void playMusic(int loop); extern App app; extern Colors colors;