From 2fbe225570e2b556fdf4207fc7d3e8595e896841 Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 29 May 2016 11:48:11 +0100 Subject: [PATCH] Don't loop title screen music. --- src/challenges/challengeHome.c | 2 +- src/challenges/challengeHome.h | 2 +- src/galaxy/galacticMap.c | 2 +- src/galaxy/galacticMap.h | 2 +- src/galaxy/mission.c | 2 +- src/galaxy/mission.h | 2 +- src/game/title.c | 2 +- src/game/title.h | 2 +- src/system/sound.c | 4 ++-- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/challenges/challengeHome.c b/src/challenges/challengeHome.c index 67f06b9..81a9e70 100644 --- a/src/challenges/challengeHome.c +++ b/src/challenges/challengeHome.c @@ -130,7 +130,7 @@ void initChallengeHome(void) endSectionTransition(); - playMusic("music/main/covert_operations.mp3"); + playMusic("music/main/covert_operations.mp3", 1); } static void nextPage(void) diff --git a/src/challenges/challengeHome.h b/src/challenges/challengeHome.h index 741e619..51a9f88 100644 --- a/src/challenges/challengeHome.h +++ b/src/challenges/challengeHome.h @@ -56,7 +56,7 @@ extern char *getTranslatedString(char *string); extern void blit(SDL_Texture *t, int x, int y, int centered); extern char *getBackgroundTextureName(int n); extern char *getPlanetTextureName(int n); -extern void playMusic(char *filename); +extern void playMusic(char *filename, int loop); extern char *timeToString(long millis, int showHours); extern char *getChallengeDescription(Challenge *c); extern void clearInput(void); diff --git a/src/galaxy/galacticMap.c b/src/galaxy/galacticMap.c index 88469b3..f9a4923 100644 --- a/src/galaxy/galacticMap.c +++ b/src/galaxy/galacticMap.c @@ -122,7 +122,7 @@ void initGalacticMap(void) endSectionTransition(); - playMusic("music/main/Pressure.ogg"); + playMusic("music/main/Pressure.ogg", 1); } static void updatePandoranAdvance(void) diff --git a/src/galaxy/galacticMap.h b/src/galaxy/galacticMap.h index f4a9079..4ffd23c 100644 --- a/src/galaxy/galacticMap.h +++ b/src/galaxy/galacticMap.h @@ -36,7 +36,7 @@ extern void endSectionTransition(void); extern void blit(SDL_Texture *t, int x, int y, int centered); extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2); extern void drawCircle(int cx, int cy, int radius, int r, int g, int b, int a); -extern void playMusic(char *filename); +extern void playMusic(char *filename, int loop); extern void stopMusic(void); extern void doStars(float dx, float dy); extern void drawStars(void); diff --git a/src/galaxy/mission.c b/src/galaxy/mission.c index b39bab8..8c3b610 100644 --- a/src/galaxy/mission.c +++ b/src/galaxy/mission.c @@ -200,7 +200,7 @@ void loadMission(char *filename) addAllToQuadtree(); - playMusic(music); + playMusic(music, 1); } static char *getAutoBackground(char *filename) diff --git a/src/galaxy/mission.h b/src/galaxy/mission.h index 2329592..7ad7b32 100644 --- a/src/galaxy/mission.h +++ b/src/galaxy/mission.h @@ -28,7 +28,7 @@ extern char *readFile(char *filename); extern SDL_Texture *getTexture(char *filename); extern void startSectionTransition(void); extern void endSectionTransition(void); -extern void playMusic(char *filename); +extern void playMusic(char *filename, int loop); extern void stopMusic(void); extern void initPlayer(void); extern long flagsToLong(char *flags, int *add); diff --git a/src/game/title.c b/src/game/title.c index 31078c6..085c44b 100644 --- a/src/game/title.c +++ b/src/game/title.c @@ -91,7 +91,7 @@ void initTitle(void) endSectionTransition(); - playMusic("music/main/Rise of spirit.ogg"); + playMusic("music/main/Rise of spirit.ogg", 0); } static void initFighters(void) diff --git a/src/game/title.h b/src/game/title.h index 0a1df9e..f57d351 100644 --- a/src/game/title.h +++ b/src/game/title.h @@ -48,7 +48,7 @@ extern void initGalacticMap(void); extern void initOptions(void (*returnFromOptions)(void)); extern void drawOptions(void); extern void initStatsDisplay(void); -extern void playMusic(char *filename); +extern void playMusic(char *filename, int loop); extern void destroyBattle(void); extern void playSound(int id); extern void initEffects(void); diff --git a/src/system/sound.c b/src/system/sound.c index 13e0cfd..1b3f568 100644 --- a/src/system/sound.c +++ b/src/system/sound.c @@ -37,7 +37,7 @@ void initSounds(void) loadSounds(); } -void playMusic(char *filename) +void playMusic(char *filename, int loop) { if (music != NULL) { @@ -48,7 +48,7 @@ void playMusic(char *filename) music = Mix_LoadMUS(getFileLocation(filename)); - Mix_PlayMusic(music, -1); + Mix_PlayMusic(music, (loop) ? -1 : 0); } void stopMusic(void)