summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-04-03 19:55:32 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-04-03 19:55:32 +0000
commitf181b3373ffd460d241d73ca68d884ee1d11d8ca (patch)
tree4c17758417f7660fac44ad2d583ef9b073d5769b /src
parent3824dd81d198821a78d611c4223a13040ee8f121 (diff)
downloadmana-f181b3373ffd460d241d73ca68d884ee1d11d8ca.tar.gz
mana-f181b3373ffd460d241d73ca68d884ee1d11d8ca.tar.bz2
mana-f181b3373ffd460d241d73ca68d884ee1d11d8ca.tar.xz
mana-f181b3373ffd460d241d73ca68d884ee1d11d8ca.zip
Added playing hardcoded background song during login, stops when game starts.
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp1
-rw-r--r--src/sound.cpp7
-rw-r--r--src/sound.h2
3 files changed, 8 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index b7518ac5..51e39335 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -339,6 +339,7 @@ int main(int argc, char *argv[])
switch (state) {
case LOGIN:
logger.log("State: LOGIN");
+ sound.startBgm("data/music/Ivano(de)Jeanette.ogg");
login();
break;
case CHAR_SERVER:
diff --git a/src/sound.cpp b/src/sound.cpp
index 8de4077e..0013cb21 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -85,7 +85,12 @@ void Sound::startBgm(char *in, int loop)
logger.log("Sound::startBgm() playing \"%s\" %d times", in, loop);
bgm = Mix_LoadMUS(in);
- Mix_PlayMusic(bgm, loop);
+ if (bgm) {
+ Mix_PlayMusic(bgm, loop);
+ }
+ else {
+ logger.log("Sound::startBgm() warning: error loading file.");
+ }
}
void Sound::stopBgm()
diff --git a/src/sound.h b/src/sound.h
index c4a53b44..44499618 100644
--- a/src/sound.h
+++ b/src/sound.h
@@ -68,7 +68,7 @@ class Sound {
* \param in Full path to file
* \param loop The number of times the song is played (-1 = infinite)
*/
- void startBgm(char *in, int loop);
+ void startBgm(char *in, int loop = -1);
/**
* \brief Stop all currently running background music tracks