aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2017-11-23 16:17:22 -0500
committerPaul Gilbert2017-11-23 16:17:22 -0500
commit23006ece91dbc4ccea101e65fd01ae85d4b9e898 (patch)
tree3eebe3897460c9992d9156f6f2209689083e5287 /engines
parent404657d80d9e21c31771bdeec9b58317ec3fd938 (diff)
downloadscummvm-rg350-23006ece91dbc4ccea101e65fd01ae85d4b9e898.tar.gz
scummvm-rg350-23006ece91dbc4ccea101e65fd01ae85d4b9e898.tar.bz2
scummvm-rg350-23006ece91dbc4ccea101e65fd01ae85d4b9e898.zip
XEEN: Add playback for atmospheric music during map loading
Diffstat (limited to 'engines')
-rw-r--r--engines/xeen/map.cpp46
-rw-r--r--engines/xeen/music.cpp3
-rw-r--r--engines/xeen/music.h1
3 files changed, 48 insertions, 2 deletions
diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp
index 028ca4b6c4..9916c86130 100644
--- a/engines/xeen/map.cpp
+++ b/engines/xeen/map.cpp
@@ -38,6 +38,24 @@ const int MAP_GRID_PRIOR_INDEX2[] = { 0, 0, 0, 0, 2, 3, 4, 1, 0 };
const int MAP_GRID_PRIOR_DIRECTION2[] = { 0, 1, 2, 3, 0, 1, 2, 3, 0 };
+const char *const MUSIC_FILES1[5] = {
+ "outdoors.m", "town.m", "cavern.m", "dungeon.m", "castle.m"
+};
+
+const char *const MUSIC_FILES2[6][7] = {
+ { "outday1.m", "outday2.m", "outday4.m", "outnght1.m",
+ "outnght2.m", "outnght4.m", "daydesrt.m" },
+ { "townday1.m", "twnwlk.m", "newbrigh.m", "twnnitea.m",
+ "twnniteb.m", "twnwlk.m", "townday1.m" },
+ { "cavern1.m", "cavern2.m", "cavern3a.m", "cavern1.m",
+ "cavern2.m", "cavern3a.m", "cavern1.m" },
+ { "dngon1.m", "dngon2.m", "dngon3.m", "dngon1.m",
+ "dngon2.m", "dngon3.m", "dngon1.m" },
+ { "cstl1rev.m", "cstl2rev.m", "cstl3rev.m", "cstl1rev.m",
+ "cstl2rev.m", "cstl3rev.m", "cstl1rev.m" },
+ { "sf05.m", "sf05.m", "sf05.m", "sf05.m", "sf05.m", "sf05.m", "sf05.m" }
+};
+
MonsterStruct::MonsterStruct() {
_experience = 0;
_hp = 0;
@@ -890,6 +908,7 @@ Map::Map(XeenEngine *vm) : _vm(vm), _mobData(vm) {
void Map::load(int mapId) {
Interface &intf = *_vm->_interface;
Screen &screen = *_vm->_screen;
+ Sound &sound = *_vm->_sound;
IndoorDrawList &indoorList = _vm->_interface->_indoorList;
OutdoorDrawList &outdoorList = _vm->_interface->_outdoorList;
@@ -1098,8 +1117,19 @@ void Map::load(int mapId) {
// Handle loading miscellaneous sprites for the map
if (_isOutdoors) {
- warning("TODO"); // Sound loading
+ // Start playing relevant music
+ Common::String musName;
+
+ if (_vm->_files->_isDarkCc) {
+ int randIndex = _vm->getRandomNumber(6);
+ musName = MUSIC_FILES2[_mazeData->_wallKind][randIndex];
+ } else {
+ musName = "outdoors.m";
+ }
+ if (musName != sound._currentMusic)
+ sound.playSong(musName, 207);
+ // Load sprite sets needed for scene rendering
_groundSprites.load("water.out");
_tileSprites.load("outdoor.til");
outdoorList._sky1._sprites = &_skySprites[0];
@@ -1119,8 +1149,20 @@ void Map::load(int mapId) {
_surfaceSprites[i].load(Res.SURFACE_NAMES[_mazeData[0]._surfaceTypes[i]]);
}
} else {
- warning("TODO"); // Sound loading
+ // Start playing relevant music
+ const int MUS_INDEXES[] = { 1, 2, 3, 4, 3, 5 };
+ Common::String musName;
+
+ if (_vm->_files->_isDarkCc) {
+ int randIndex = _vm->getRandomNumber(6);
+ musName = MUSIC_FILES2[MUS_INDEXES[_mazeData->_wallKind]][randIndex];
+ } else {
+ musName = MUSIC_FILES1[MUS_INDEXES[_mazeData->_wallKind]];
+ }
+ if (musName != sound._currentMusic)
+ sound.playSong(musName, 207);
+ // Load sprite sets needed for scene rendering
_skySprites[1].load(Common::String::format("%s.sky",
Res.TERRAIN_TYPES[_mazeData[0]._wallKind]));
_groundSprites.load(Common::String::format("%s.gnd",
diff --git a/engines/xeen/music.cpp b/engines/xeen/music.cpp
index aea4850f61..fbbaadb374 100644
--- a/engines/xeen/music.cpp
+++ b/engines/xeen/music.cpp
@@ -735,6 +735,9 @@ void Music::playSong(Common::SeekableReadStream &stream) {
}
void Music::playSong(const Common::String &name, int param) {
+ _priorMusic = _currentMusic;
+ _currentMusic = name;
+
File f(name);
playSong(f);
}
diff --git a/engines/xeen/music.h b/engines/xeen/music.h
index 207ec991a3..a3d0121665 100644
--- a/engines/xeen/music.h
+++ b/engines/xeen/music.h
@@ -318,6 +318,7 @@ private:
void update();
public:
bool _musicOn;
+ Common::String _currentMusic, _priorMusic;
public:
Music();
~Music();