Load and play music during mission.

This commit is contained in:
Steve 2018-02-08 07:34:35 +00:00
parent bf0f64caf8
commit 14f4ef57ad
3 changed files with 14 additions and 3 deletions

View File

@ -34,7 +34,7 @@ void initSounds(void)
loadSounds();
}
void playMusic(char *filename, int loop)
void loadMusic(char *filename)
{
if (music != NULL)
{
@ -44,7 +44,10 @@ void playMusic(char *filename, int loop)
}
music = Mix_LoadMUS(getFileLocation(filename));
}
void playMusic(int loop)
{
Mix_PlayMusic(music, (loop) ? -1 : 0);
}
@ -75,7 +78,7 @@ void playSound(int snd, int ch)
int isPlayingMusic(void)
{
return 0;
return Mix_PlayingMusic();
}
static Mix_Chunk *loadSound(char *filename)

View File

@ -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)
{

View File

@ -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;