summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2005-06-20 13:15:07 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2005-06-20 13:15:07 +0000
commitc204288633cd8f07720a1288a10f3c111de1599c (patch)
tree2ac4b2516c8c46bca21e6b7cc07e475e06e50b6c /src
parent4334dceb03156255961360ab5fb7f2e672da3cba (diff)
downloadmana-c204288633cd8f07720a1288a10f3c111de1599c.tar.gz
mana-c204288633cd8f07720a1288a10f3c111de1599c.tar.bz2
mana-c204288633cd8f07720a1288a10f3c111de1599c.tar.xz
mana-c204288633cd8f07720a1288a10f3c111de1599c.zip
This way BGM should be enabled
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp21
-rw-r--r--src/map.h4
2 files changed, 21 insertions, 4 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 9595ec74..820f7dc6 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -173,7 +173,7 @@ void do_init()
// Try .tmx.gz map file
pathDir.insert(pathDir.size(), ".tmx.gz");
Map *tiledMap = MapReader::readMap(pathDir);
-
+
if (!tiledMap)
{
logger->error("Could not find map file!");
@@ -181,11 +181,15 @@ void do_init()
else
{
engine->setCurrentMap(tiledMap);
+ // Start playing background music
+ std::string musicFile = tiledMap->getProperty("music");
+
+ if(musicFile!="") {
+ musicFile = std::string(TMW_DATADIR) + "data/music/" + musicFile;
+ sound.playMusic(musicFile.c_str(), -1);
+ }
}
- // Start playing background music
- //sound.startBgm("./data/sound/Mods/somemp.xm", -1);
-
// Initialize timers
tick_time = 0;
SDL_AddTimer(10, nextTick, NULL); // Logic counter
@@ -1031,6 +1035,7 @@ void do_parse()
strncat(map_path, RFIFOP(2), 497 - strlen(map_path));
logger->log("Warping to %s (%d, %d)",
map_path, RFIFOW(18), RFIFOW(20));
+ sound.stopMusic();
strcpy(strrchr(map_path, '.') + 1, "tmx.gz");
if (tiledMap) delete tiledMap;
@@ -1059,6 +1064,14 @@ void do_parse()
WFIFOSET(2);
while (out_size > 0) flush();
engine->setCurrentMap(tiledMap);
+
+ std::string musicFile = tiledMap->getProperty("music");
+
+ if(musicFile!="") {
+ musicFile = std::string(TMW_DATADIR) + "data/music/"
+ + musicFile;
+ sound.playMusic(musicFile.c_str(), -1);
+ }
}
else {
logger->error("Could not find map file");
diff --git a/src/map.h b/src/map.h
index 02bea4a2..19489257 100644
--- a/src/map.h
+++ b/src/map.h
@@ -176,6 +176,10 @@ class Map
* Set a map property.
*/
void setProperty(const std::string &name, const std::string &value);
+
+ /**
+ *
+ */
private:
int width, height;