Load and play music during mission.
This commit is contained in:
parent
bf0f64caf8
commit
14f4ef57ad
|
@ -34,7 +34,7 @@ void initSounds(void)
|
||||||
loadSounds();
|
loadSounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
void playMusic(char *filename, int loop)
|
void loadMusic(char *filename)
|
||||||
{
|
{
|
||||||
if (music != NULL)
|
if (music != NULL)
|
||||||
{
|
{
|
||||||
|
@ -44,7 +44,10 @@ void playMusic(char *filename, int loop)
|
||||||
}
|
}
|
||||||
|
|
||||||
music = Mix_LoadMUS(getFileLocation(filename));
|
music = Mix_LoadMUS(getFileLocation(filename));
|
||||||
|
}
|
||||||
|
|
||||||
|
void playMusic(int loop)
|
||||||
|
{
|
||||||
Mix_PlayMusic(music, (loop) ? -1 : 0);
|
Mix_PlayMusic(music, (loop) ? -1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +78,7 @@ void playSound(int snd, int ch)
|
||||||
|
|
||||||
int isPlayingMusic(void)
|
int isPlayingMusic(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return Mix_PlayingMusic();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Mix_Chunk *loadSound(char *filename)
|
static Mix_Chunk *loadSound(char *filename)
|
||||||
|
|
|
@ -45,6 +45,8 @@ void initWorld(void)
|
||||||
|
|
||||||
background = getTexture(world.background);
|
background = getTexture(world.background);
|
||||||
|
|
||||||
|
loadMusic(world.music);
|
||||||
|
|
||||||
initQuadtree(&world.quadtree);
|
initQuadtree(&world.quadtree);
|
||||||
|
|
||||||
initObjectives();
|
initObjectives();
|
||||||
|
@ -71,6 +73,10 @@ void initWorld(void)
|
||||||
hideAllWidgets();
|
hideAllWidgets();
|
||||||
world.betweenTimer = 0;
|
world.betweenTimer = 0;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
playMusic(1);
|
||||||
|
}
|
||||||
|
|
||||||
if (!game.isResumingMission)
|
if (!game.isResumingMission)
|
||||||
{
|
{
|
||||||
|
|
|
@ -67,6 +67,8 @@ extern void drawMissionStatus(void);
|
||||||
extern int isAcceptControl(void);
|
extern int isAcceptControl(void);
|
||||||
extern void clearControls(void);
|
extern void clearControls(void);
|
||||||
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
|
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 App app;
|
||||||
extern Colors colors;
|
extern Colors colors;
|
||||||
|
|
Loading…
Reference in New Issue