diff options
author | Robert Špalek | 2009-10-22 07:34:43 +0000 |
---|---|---|
committer | Robert Špalek | 2009-10-22 07:34:43 +0000 |
commit | 819449d09907f97c09048268eb52e54b9d9b33c0 (patch) | |
tree | 2771cbcd5dbab1d93be7e33b4fd4520ae24613bf /engines | |
parent | 93517e7649da286cd5b86efb3ee2e5cf7e7be436 (diff) | |
download | scummvm-rg350-819449d09907f97c09048268eb52e54b9d9b33c0.tar.gz scummvm-rg350-819449d09907f97c09048268eb52e54b9d9b33c0.tar.bz2 scummvm-rg350-819449d09907f97c09048268eb52e54b9d9b33c0.zip |
Implemented GPL2 commands for music.
Debugged everything.
svn-id: r45330
Diffstat (limited to 'engines')
-rw-r--r-- | engines/draci/game.cpp | 19 | ||||
-rw-r--r-- | engines/draci/game.h | 2 | ||||
-rw-r--r-- | engines/draci/music.cpp | 18 | ||||
-rw-r--r-- | engines/draci/script.cpp | 21 | ||||
-rw-r--r-- | engines/draci/script.h | 3 |
5 files changed, 44 insertions, 19 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index 773f97ce64..da94c261d3 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -1009,7 +1009,8 @@ void Game::loadRoom(int roomNum) { roomReader.readUint16LE(); // Program length, not used roomReader.readUint32LE(); // Pointer to room title, not used - _currentRoom._music = roomReader.readByte(); + // Music will be played by the GPL2 command startMusic when needed. + setMusicTrack(roomReader.readByte()); int mapID = roomReader.readByte() - 1; loadWalkingMap(mapID); @@ -1044,7 +1045,7 @@ void Game::loadRoom(int roomNum) { _currentRoom._escRoom = roomReader.readByte() - 1; _currentRoom._numGates = roomReader.readByte(); - debugC(4, kDraciLogicDebugLevel, "Music: %d", _currentRoom._music); + debugC(4, kDraciLogicDebugLevel, "Music: %d", getMusicTrack()); debugC(4, kDraciLogicDebugLevel, "Map: %d", mapID); debugC(4, kDraciLogicDebugLevel, "Palette: %d", _currentRoom._palette); debugC(4, kDraciLogicDebugLevel, "Overlays: %d", _currentRoom._numOverlays); @@ -1123,12 +1124,6 @@ void Game::loadRoom(int roomNum) { Animation *map = _vm->_anims->addAnimation(kWalkingMapOverlay, 255, false); map->addFrame(ov, NULL); - - if (_currentRoom._music) { - _vm->_music->playSMF(_currentRoom._music, true); - } else { - _vm->_music->stop(); - } } int Game::loadAnimation(uint animNum, uint z) { @@ -1430,6 +1425,14 @@ double Game::getPersStep() const { return _currentRoom._persStep; } +int Game::getMusicTrack() const { + return _currentRoom._music; +} + +void Game::setMusicTrack(int num) { + _currentRoom._music = num; +} + int Game::getRoomNum() const { return _currentRoom._roomNum; } diff --git a/engines/draci/game.h b/engines/draci/game.h index aa7ab27ae1..af0ed6d502 100644 --- a/engines/draci/game.h +++ b/engines/draci/game.h @@ -301,6 +301,8 @@ public: double getPers0() const; double getPersStep() const; + int getMusicTrack() const; + void setMusicTrack(int num); int getItemStatus(int itemID) const; void setItemStatus(int itemID, int status); diff --git a/engines/draci/music.cpp b/engines/draci/music.cpp index b13fac0673..ec6d85c66c 100644 --- a/engines/draci/music.cpp +++ b/engines/draci/music.cpp @@ -43,6 +43,10 @@ MusicPlayer::MusicPlayer(MidiDriver *driver, const char *pathMask) : _parser(0), this->open(); _smfParser = MidiParser::createParser_SMF(); _midiMusicData = NULL; + + // TODO: Load cmf.ins with the instrument table. It seems that an + // interface for such an operation is supported for Adlib. Maybe for + // this card, setting instruments is necessary. } MusicPlayer::~MusicPlayer() { @@ -224,14 +228,12 @@ void MusicPlayer::syncVolume() { int volume = ConfMan.getInt("music_volume"); debugC(2, kDraciSoundDebugLevel, "Syncing music volume to %d", volume); setVolume(volume); -} -// TODO: -// + volume support -// - bindings to GPL2 scripting -// - load cmf.ins -// - enable Adlib -// + resuming after configuration -// + error handling + // TODO: doesn't work in the beginning when no music is playing yet. + // It goes through all active channels (= none) and stops. Only after + // actual instruments have played in the channels, this has an effect. + // As a consequence, music is very loud in the beginning until Ctrl-F5 + // is pressed for the first time. +} } // End of namespace Draci diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp index 5f4edf07b5..1809695d5b 100644 --- a/engines/draci/script.cpp +++ b/engines/draci/script.cpp @@ -73,9 +73,9 @@ void Script::setupCommandList() { { 16, 1, "RepaintInventory", 0, { 0 }, NULL }, // not used in the original game files { 16, 2, "ExitInventory", 0, { 0 }, NULL }, // not used in the original game files { 17, 1, "ExitMap", 0, { 0 }, NULL }, // not used in the original game files - { 18, 1, "LoadMusic", 1, { 2 }, NULL }, - { 18, 2, "StartMusic", 0, { 0 }, NULL }, - { 18, 3, "StopMusic", 0, { 0 }, NULL }, + { 18, 1, "LoadMusic", 1, { 2 }, &Script::loadMusic }, + { 18, 2, "StartMusic", 0, { 0 }, &Script::startMusic }, + { 18, 3, "StopMusic", 0, { 0 }, &Script::stopMusic }, { 18, 4, "FadeOutMusic", 1, { 1 }, NULL }, { 18, 5, "FadeInMusic", 1, { 1 }, NULL }, { 19, 1, "Mark", 0, { 0 }, &Script::mark }, @@ -521,6 +521,21 @@ void Script::c_Let(Common::Queue<int> ¶ms) { _vm->_game->setVariable(var, value); } +void Script::loadMusic(Common::Queue<int> ¶ms) { + int track = params.pop(); + _vm->_game->setMusicTrack(track); +} + +void Script::startMusic(Common::Queue<int> ¶ms) { + // If already playing this track, nothing happens. + _vm->_music->playSMF(_vm->_game->getMusicTrack(), true); +} + +void Script::stopMusic(Common::Queue<int> ¶ms) { + _vm->_music->stop(); + _vm->_game->setMusicTrack(0); +} + void Script::mark(Common::Queue<int> ¶ms) { _vm->_game->setMarkedAnimationIndex(_vm->_anims->getLastIndex()); } diff --git a/engines/draci/script.h b/engines/draci/script.h index eaede35ff4..3476dd1116 100644 --- a/engines/draci/script.h +++ b/engines/draci/script.h @@ -109,6 +109,9 @@ private: void c_Let(Common::Queue<int> ¶ms); void load(Common::Queue<int> ¶ms); void start(Common::Queue<int> ¶ms); + void loadMusic(Common::Queue<int> ¶ms); + void startMusic(Common::Queue<int> ¶ms); + void stopMusic(Common::Queue<int> ¶ms); void mark(Common::Queue<int> ¶ms); void release(Common::Queue<int> ¶ms); void icoStat(Common::Queue<int> ¶ms); |