[Scummvm-cvs-logs] SF.net SVN: scummvm:[45330] scummvm/trunk/engines/draci
spalek at users.sourceforge.net
spalek at users.sourceforge.net
Thu Oct 22 09:34:44 CEST 2009
Revision: 45330
http://scummvm.svn.sourceforge.net/scummvm/?rev=45330&view=rev
Author: spalek
Date: 2009-10-22 07:34:43 +0000 (Thu, 22 Oct 2009)
Log Message:
-----------
Implemented GPL2 commands for music.
Debugged everything.
Modified Paths:
--------------
scummvm/trunk/engines/draci/game.cpp
scummvm/trunk/engines/draci/game.h
scummvm/trunk/engines/draci/music.cpp
scummvm/trunk/engines/draci/script.cpp
scummvm/trunk/engines/draci/script.h
Modified: scummvm/trunk/engines/draci/game.cpp
===================================================================
--- scummvm/trunk/engines/draci/game.cpp 2009-10-22 07:18:37 UTC (rev 45329)
+++ scummvm/trunk/engines/draci/game.cpp 2009-10-22 07:34:43 UTC (rev 45330)
@@ -1009,7 +1009,8 @@
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 @@
_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 @@
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 @@
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;
}
Modified: scummvm/trunk/engines/draci/game.h
===================================================================
--- scummvm/trunk/engines/draci/game.h 2009-10-22 07:18:37 UTC (rev 45329)
+++ scummvm/trunk/engines/draci/game.h 2009-10-22 07:34:43 UTC (rev 45330)
@@ -301,6 +301,8 @@
double getPers0() const;
double getPersStep() const;
+ int getMusicTrack() const;
+ void setMusicTrack(int num);
int getItemStatus(int itemID) const;
void setItemStatus(int itemID, int status);
Modified: scummvm/trunk/engines/draci/music.cpp
===================================================================
--- scummvm/trunk/engines/draci/music.cpp 2009-10-22 07:18:37 UTC (rev 45329)
+++ scummvm/trunk/engines/draci/music.cpp 2009-10-22 07:34:43 UTC (rev 45330)
@@ -43,6 +43,10 @@
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 @@
int volume = ConfMan.getInt("music_volume");
debugC(2, kDraciSoundDebugLevel, "Syncing music volume to %d", volume);
setVolume(volume);
+
+ // 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.
}
-// TODO:
-// + volume support
-// - bindings to GPL2 scripting
-// - load cmf.ins
-// - enable Adlib
-// + resuming after configuration
-// + error handling
-
} // End of namespace Draci
Modified: scummvm/trunk/engines/draci/script.cpp
===================================================================
--- scummvm/trunk/engines/draci/script.cpp 2009-10-22 07:18:37 UTC (rev 45329)
+++ scummvm/trunk/engines/draci/script.cpp 2009-10-22 07:34:43 UTC (rev 45330)
@@ -73,9 +73,9 @@
{ 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 @@
_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());
}
Modified: scummvm/trunk/engines/draci/script.h
===================================================================
--- scummvm/trunk/engines/draci/script.h 2009-10-22 07:18:37 UTC (rev 45329)
+++ scummvm/trunk/engines/draci/script.h 2009-10-22 07:34:43 UTC (rev 45330)
@@ -109,6 +109,9 @@
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);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list