mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-24 05:01:43 +00:00
Implemented GPL2 commands for music.
Debugged everything. svn-id: r45330
This commit is contained in:
parent
93517e7649
commit
819449d099
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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: 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
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user