diff options
author | Paweł Kołodziejski | 2004-01-19 17:37:15 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2004-01-19 17:37:15 +0000 |
commit | 409c182b4ae3fe7d1b26204b5f8329834de1c9d9 (patch) | |
tree | 766974ffed1d99ac1a8331a8b8e900fb646b7272 /scumm | |
parent | cd045460cc221e5918a0e650948b41cb1e1d7162 (diff) | |
download | scummvm-rg350-409c182b4ae3fe7d1b26204b5f8329834de1c9d9.tar.gz scummvm-rg350-409c182b4ae3fe7d1b26204b5f8329834de1c9d9.tar.bz2 scummvm-rg350-409c182b4ae3fe7d1b26204b5f8329834de1c9d9.zip |
added continue play state song after sequence song finished
svn-id: r12508
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/imuse_digi/dimuse.cpp | 31 | ||||
-rw-r--r-- | scumm/imuse_digi/dimuse.h | 25 | ||||
-rw-r--r-- | scumm/imuse_digi/dimuse_music.cpp | 95 |
3 files changed, 87 insertions, 64 deletions
diff --git a/scumm/imuse_digi/dimuse.cpp b/scumm/imuse_digi/dimuse.cpp index e14a76dda1..3d488a89de 100644 --- a/scumm/imuse_digi/dimuse.cpp +++ b/scumm/imuse_digi/dimuse.cpp @@ -73,6 +73,12 @@ void IMuseDigital::callback() { for (l = 0; l < MAX_DIGITAL_TRACKS;l ++) { if (_track[l].used) { + if (_track[l].waitForEndSeq) { + if ((_curMusicState != 0) && (_curMusicSeq == 0)) + _track[l].waitForEndSeq = false; + else + continue; + } if (_track[l].stream2) { if (!_track[l].handle.isActive() && _track[l].started) { debug(5, "IMuseDigital::callback(): stoped sound: %d", _track[l].soundId); @@ -236,7 +242,7 @@ void IMuseDigital::switchToNextRegion(int track) { _track[track].regionOffset = 0; } -void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, int soundGroup, AudioStream *input, bool sequence, int hookId, int volume) { +void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, int soundGroup, AudioStream *input, bool sequence, int hookId, int volume, bool wait) { Common::StackLock lock(_mutex); debug(5, "IMuseDigital::startSound(%d)", soundId); int l; @@ -260,6 +266,7 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, _track[l].mod = 0; _track[l].toBeRemoved = false; _track[l].sequence = sequence; + _track[l].waitForEndSeq = wait; int bits = 0, freq = 0, channels = 0, mixerFlags = 0; @@ -389,7 +396,7 @@ void IMuseDigital::fadeOutMusic(int fadeDelay) { Common::StackLock lock(_mutex); debug(5, "IMuseDigital::fadeOutMusic"); for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) { - if ((_track[l].used) && (_track[l].soundGroup == IMUSE_MUSIC) && (!_track[l].volFadeUsed)) { + if ((_track[l].used) && (!_track[l].waitForEndSeq) && (_track[l].soundGroup == IMUSE_MUSIC) && (!_track[l].volFadeUsed)) { _track[l].volFadeDelay = fadeDelay; _track[l].volFadeDest = 0; _track[l].volFadeStep = (_track[l].volFadeDest - _track[l].vol) * 60 * 40 / (1000 * fadeDelay); @@ -459,29 +466,29 @@ void IMuseDigital::parseScriptCmds(int a, int b, int c, int d, int e, int f, int if ((_vm->_gameId == GID_DIG) && (_vm->_features & GF_DEMO)) { if (b == 1) { fadeOutMusic(120); - startMusic(1, false, 127); + startMusic(1, false, 127, false); } else { if (getSoundStatus(2) == 0) { fadeOutMusic(120); - startMusic(2, false, 127); + startMusic(2, false, 127, false); } } } else if ((_vm->_gameId == GID_CMI) && (_vm->_features & GF_DEMO)) { if (b == 2) { fadeOutMusic(120); - startMusic("in1.imx", 2002, false, 0, 127); + startMusic("in1.imx", 2002, false, 0, 127, false); } else if (b == 4) { fadeOutMusic(120); - startMusic("in2.imx", 2004, false, 0, 127); + startMusic("in2.imx", 2004, false, 0, 127, false); } else if (b == 8) { fadeOutMusic(120); - startMusic("out1.imx", 2008, false, 0, 127); + startMusic("out1.imx", 2008, false, 0, 127, false); } else if (b == 9) { fadeOutMusic(120); - startMusic("out2.imx", 2009, false, 0, 127); + startMusic("out2.imx", 2009, false, 0, 127, false); } else if (b == 16) { fadeOutMusic(120); - startMusic("gun.imx", 2016, false, 0, 127); + startMusic("gun.imx", 2016, false, 0, 127, false); } else { warning("imuse digital: set state unknown for cmi demo: %d, room: %d", b, this->_vm->_currentRoom); } @@ -592,7 +599,7 @@ int32 IMuseDigital::getCurMusicPosInMs() { int soundId = -1; for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) { - if ((_track[l].used) && (_track[l].soundGroup == IMUSE_MUSIC) && (!_track[l].volFadeUsed)) { + if ((_track[l].used) && (!_track[l].waitForEndSeq) && (_track[l].soundGroup == IMUSE_MUSIC) && (!_track[l].volFadeUsed)) { soundId = _track[l].soundId; } } @@ -627,7 +634,7 @@ int32 IMuseDigital::getCurMusicLipSyncWidth(int syncId) { int soundId = -1; for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) { - if ((_track[l].used) && (_track[l].soundGroup == IMUSE_MUSIC) && (!_track[l].volFadeUsed)) { + if ((_track[l].used) && (!_track[l].waitForEndSeq) && (_track[l].soundGroup == IMUSE_MUSIC) && (!_track[l].volFadeUsed)) { soundId = _track[l].soundId; } } @@ -645,7 +652,7 @@ int32 IMuseDigital::getCurMusicLipSyncHeight(int syncId) { int soundId = -1; for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) { - if ((_track[l].used) && (_track[l].soundGroup == IMUSE_MUSIC) && (!_track[l].volFadeUsed)) { + if ((_track[l].used) && (!_track[l].waitForEndSeq) && (_track[l].soundGroup == IMUSE_MUSIC) && (!_track[l].volFadeUsed)) { soundId = _track[l].soundId; } } diff --git a/scumm/imuse_digi/dimuse.h b/scumm/imuse_digi/dimuse.h index 50ee626921..d479d3a932 100644 --- a/scumm/imuse_digi/dimuse.h +++ b/scumm/imuse_digi/dimuse.h @@ -53,6 +53,7 @@ private: bool used; bool toBeRemoved; bool started; + bool waitForEndSeq; int32 regionOffset; int32 trackOffset; int32 dataOffset; @@ -90,7 +91,7 @@ private: static void timer_handler(void *refConf); void callback(); void switchToNextRegion(int track); - void startSound(int soundId, const char *soundName, int soundType, int soundGroup, AudioStream *input, bool sequence, int hookId, int volume); + void startSound(int soundId, const char *soundName, int soundType, int soundGroup, AudioStream *input, bool sequence, int hookId, int volume, bool wait); int32 getPosInMs(int soundId); void getLipSync(int soundId, int syncId, int32 msPos, int32 &width, int32 &height); @@ -101,30 +102,30 @@ private: void setFtMusicState(int stateId); void setFtMusicSequence(int seqId); void setFtMusicCuePoint(int cueId); - void playFtMusic(const char *songName, int opcode, int volume, bool sequence); + void playFtMusic(const char *songName, int opcode, int volume, bool sequence, bool wait); void setComiMusicState(int stateId); void setComiMusicSequence(int seqId); - void playComiMusic(const char *songName, const imuseComiTable *table, int atribPos, bool sequence); + void playComiMusic(const char *songName, const imuseComiTable *table, int atribPos, bool sequence, bool wait); void setDigMusicState(int stateId); void setDigMusicSequence(int seqId); - void playDigMusic(const char *songName, const imuseDigTable *table, int atribPos, bool sequence); + void playDigMusic(const char *songName, const imuseDigTable *table, int atribPos, bool sequence, bool wait); public: IMuseDigital(ScummEngine *scumm); virtual ~IMuseDigital(); void startVoice(int soundId, AudioStream *input) - { debug(5, "startVoiceStream(%d)", soundId); startSound(soundId, NULL, 0, IMUSE_VOICE, input, false, 0, 127); } + { debug(5, "startVoiceStream(%d)", soundId); startSound(soundId, NULL, 0, IMUSE_VOICE, input, false, 0, 127, false); } void startVoice(int soundId, const char *soundName) - { debug(5, "startVoiceBundle(%s)", soundName); startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_VOICE, NULL, false, 0, 127); } - void startMusic(int soundId, bool sequence, int volume) - { debug(5, "startMusicResource(%d)", soundId); startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_MUSIC, NULL, sequence, 0, volume); } - void startMusic(const char *soundName, int soundId, bool sequence, int hookId, int volume) - { debug(5, "startMusicBundle(%s)", soundName); startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_MUSIC, NULL, sequence, hookId, volume); } + { debug(5, "startVoiceBundle(%s)", soundName); startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_VOICE, NULL, false, 0, 127, false); } + void startMusic(int soundId, bool sequence, int volume, bool wait) + { debug(5, "startMusicResource(%d)", soundId); startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_MUSIC, NULL, sequence, 0, volume, wait); } + void startMusic(const char *soundName, int soundId, bool sequence, int hookId, int volume, bool wait) + { debug(5, "startMusicBundle(%s)", soundName); startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_MUSIC, NULL, sequence, hookId, volume, wait); } void startSfx(int soundId) - { debug(5, "startSfx(%d)", soundId); startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_SFX, NULL, false, 0, 127); } + { debug(5, "startSfx(%d)", soundId); startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_SFX, NULL, false, 0, 127, false); } void startSound(int soundId) { error("MusicEngine::startSound() Should be never called"); } @@ -212,4 +213,4 @@ extern const imuseFtNames _ftSeqNames[]; } // End of namespace Scumm -#endif +#endif
\ No newline at end of file diff --git a/scumm/imuse_digi/dimuse_music.cpp b/scumm/imuse_digi/dimuse_music.cpp index cf7033a38b..36c6cad9d4 100644 --- a/scumm/imuse_digi/dimuse_music.cpp +++ b/scumm/imuse_digi/dimuse_music.cpp @@ -66,11 +66,17 @@ void IMuseDigital::setDigMusicState(int stateId) { if (_curMusicState == num) return; - if (_curMusicSeq == 0) { + bool wait = false; + + if (_curMusicSeq != 0) { + wait = true; + } + + if ((_curMusicSeq == 0) || (wait)) { if (num == 0) - playDigMusic(NULL, &_digStateMusicTable[num], num, false); + playDigMusic(NULL, &_digStateMusicTable[num], num, false, wait); else - playDigMusic(_digStateMusicTable[num].name, &_digStateMusicTable[num], num, false); + playDigMusic(_digStateMusicTable[num].name, &_digStateMusicTable[num], num, false, wait); } _curMusicState = num; @@ -96,7 +102,7 @@ void IMuseDigital::setDigMusicSequence(int seqId) { if (num != 0) { if (_curMusicSeq == 0) { - playDigMusic(_digSeqMusicTable[num].name, &_digSeqMusicTable[num], 0, true); + playDigMusic(_digSeqMusicTable[num].name, &_digSeqMusicTable[num], 0, true, false); _curSeqAtribPos = 0; _attributesSeq[num] = 1; } else { @@ -104,22 +110,22 @@ void IMuseDigital::setDigMusicSequence(int seqId) { _curSeqAtribPos = num; return; } else if (_digSeqMusicTable[_curMusicSeq].opcode == 6) { - playDigMusic(_digSeqMusicTable[num].name, &_digSeqMusicTable[num], 0, true); + playDigMusic(_digSeqMusicTable[num].name, &_digSeqMusicTable[num], 0, true, false); _curSeqAtribPos = 0; _attributesSeq[num] = 1; } } } else { if (_curSeqAtribPos != 0) { - playDigMusic(_digSeqMusicTable[_curSeqAtribPos].name, &_digSeqMusicTable[num], 0, true); + playDigMusic(_digSeqMusicTable[_curSeqAtribPos].name, &_digSeqMusicTable[num], 0, true, false); _attributesSeq[_curSeqAtribPos] = 1; _curSeqAtribPos = 0; num = _curSeqAtribPos; } else { if (_curMusicState != 0) - playDigMusic(_digStateMusicTable[_curMusicState].name, &_digSeqMusicTable[num], _curMusicState, false); + playDigMusic(_digStateMusicTable[_curMusicState].name, &_digSeqMusicTable[num], _curMusicState, false, false); else - playDigMusic(NULL, &_digStateMusicTable[num], _curMusicState, false); + playDigMusic(NULL, &_digStateMusicTable[num], _curMusicState, false, false); num = 0; } } @@ -127,7 +133,7 @@ void IMuseDigital::setDigMusicSequence(int seqId) { _curMusicSeq = num; } -void IMuseDigital::playDigMusic(const char *songName, const imuseDigTable *table, int atribPos, bool sequence) { +void IMuseDigital::playDigMusic(const char *songName, const imuseDigTable *table, int atribPos, bool sequence, bool wait) { int hookId = 0; if (songName != NULL) { @@ -168,13 +174,13 @@ void IMuseDigital::playDigMusic(const char *songName, const imuseDigTable *table case 3: if ((!sequence) && (table->param != 0)) { if (table->param == _digStateMusicTable[_curMusicState].param) { - startMusic(table->filename, table->soundId, sequence, 0, 127); + startMusic(table->filename, table->soundId, sequence, 0, 127, wait); } } else { - startMusic(table->filename, table->soundId, sequence, hookId, 127); + startMusic(table->filename, table->soundId, sequence, hookId, 127, wait); } case 4: - startMusic(table->filename, table->soundId, sequence, 0, 127); + startMusic(table->filename, table->soundId, sequence, 0, 127, wait); break; } } @@ -197,11 +203,17 @@ void IMuseDigital::setComiMusicState(int stateId) { if (_curMusicState == num) return; - if (_curMusicSeq == 0) { + bool wait = false; + + if (_curMusicSeq != 0) { + wait = true; + } + + if ((_curMusicSeq == 0) || (wait)) { if (num == 0) - playComiMusic(NULL, &_comiStateMusicTable[num], num, false); + playComiMusic(NULL, &_comiStateMusicTable[num], num, false, wait); else - playComiMusic(_comiStateMusicTable[num].name, &_comiStateMusicTable[num], num, false); + playComiMusic(_comiStateMusicTable[num].name, &_comiStateMusicTable[num], num, false, wait); } _curMusicState = num; @@ -227,7 +239,7 @@ void IMuseDigital::setComiMusicSequence(int seqId) { if (num != 0) { if (_curMusicSeq == 0) { - playComiMusic(_comiSeqMusicTable[num].name, &_comiSeqMusicTable[num], 0, true); + playComiMusic(_comiSeqMusicTable[num].name, &_comiSeqMusicTable[num], 0, true, false); _curSeqAtribPos = 0; _attributesSeq[num] = 1; } else { @@ -235,22 +247,22 @@ void IMuseDigital::setComiMusicSequence(int seqId) { _curSeqAtribPos = num; return; } else if (_comiSeqMusicTable[_curMusicSeq].opcode == 6) { - playComiMusic(_comiSeqMusicTable[num].name, &_comiSeqMusicTable[num], 0, true); + playComiMusic(_comiSeqMusicTable[num].name, &_comiSeqMusicTable[num], 0, true, false); _curSeqAtribPos = 0; _attributesSeq[num] = 1; } } } else { if (_curSeqAtribPos != 0) { - playComiMusic(_comiSeqMusicTable[_curSeqAtribPos].name, &_comiSeqMusicTable[num], 0, true); + playComiMusic(_comiSeqMusicTable[_curSeqAtribPos].name, &_comiSeqMusicTable[num], 0, true, false); _attributesSeq[_curSeqAtribPos] = 1; _curSeqAtribPos = 0; num = _curSeqAtribPos; } else { if (_curMusicState != 0) - playComiMusic(_comiStateMusicTable[_curMusicState].name, &_comiSeqMusicTable[num], _curMusicState, false); + playComiMusic(_comiStateMusicTable[_curMusicState].name, &_comiSeqMusicTable[num], _curMusicState, false, false); else - playComiMusic(NULL, &_comiStateMusicTable[num], _curMusicState, false); + playComiMusic(NULL, &_comiStateMusicTable[num], _curMusicState, false, false); num = 0; } } @@ -258,7 +270,7 @@ void IMuseDigital::setComiMusicSequence(int seqId) { _curMusicSeq = num; } -void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *table, int atribPos, bool sequence) { +void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *table, int atribPos, bool sequence, bool wait) { int hookId = 0; if ((songName != NULL) && (atribPos != 0)) { @@ -287,30 +299,30 @@ void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *tab break; case 1: fadeOutMusic(120); - startMusic(table->filename, table->soundId, sequence, 0, 1); + startMusic(table->filename, table->soundId, sequence, 0, 1, wait); setFade(table->soundId, 127, 120); break; case 2: fadeOutMusic(table->fadeDelay); - startMusic(table->filename, table->soundId, sequence, table->hookId, 127); + startMusic(table->filename, table->soundId, sequence, table->hookId, 127, wait); break; case 3: if ((!sequence) && (table->param != 0)) { if (table->param == _comiStateMusicTable[_curMusicState].param) { fadeOutMusic(table->fadeDelay); - startMusic(table->filename, table->soundId, sequence, 0, 127); + startMusic(table->filename, table->soundId, sequence, 0, 127, wait); } } else { fadeOutMusic(table->fadeDelay); - startMusic(table->filename, table->soundId, sequence, table->hookId, 127); + startMusic(table->filename, table->soundId, sequence, table->hookId, 127, wait); } case 4: fadeOutMusic(120); - startMusic(table->filename, table->soundId, sequence, 0, 127); + startMusic(table->filename, table->soundId, sequence, 0, 127, wait); break; case 12: fadeOutMusic(table->fadeDelay); - startMusic(table->filename, table->soundId, sequence, table->hookId, 127); + startMusic(table->filename, table->soundId, sequence, table->hookId, 127, wait); break; } } @@ -324,15 +336,18 @@ void IMuseDigital::setFtMusicState(int stateId) { if (_curMusicState == stateId) return; + bool wait = false; + if (_curMusicSeq != 0) { - _curMusicState = stateId; - return; + wait = true; } - if (stateId == 0) - playFtMusic(NULL, 0, 0, false); - else - playFtMusic(_ftStateMusicTable[stateId].audioName, _ftStateMusicTable[stateId].opcode, _ftStateMusicTable[stateId].volume, false); + if ((_curMusicSeq == 0) || (wait)) { + if (stateId == 0) + playFtMusic(NULL, 0, 0, false, wait); + else + playFtMusic(_ftStateMusicTable[stateId].audioName, _ftStateMusicTable[stateId].opcode, _ftStateMusicTable[stateId].volume, false, wait); + } _curMusicState = stateId; } @@ -348,12 +363,12 @@ void IMuseDigital::setFtMusicSequence(int seqId) { if (seqId == 0) { if (_curMusicState == 0) - playFtMusic(NULL, 0, 0, true); + playFtMusic(NULL, 0, 0, true, false); else - playFtMusic(_ftStateMusicTable[seqId].audioName, _ftStateMusicTable[seqId].opcode, _ftStateMusicTable[seqId].volume, true); + playFtMusic(_ftStateMusicTable[seqId].audioName, _ftStateMusicTable[seqId].opcode, _ftStateMusicTable[seqId].volume, true, false); } else { int seq = (seqId - 1) * 4; - playFtMusic(_ftSeqMusicTable[seq].audioName, _ftSeqMusicTable[seq].opcode, _ftSeqMusicTable[seq].volume, true); + playFtMusic(_ftSeqMusicTable[seq].audioName, _ftSeqMusicTable[seq].opcode, _ftSeqMusicTable[seq].volume, false, false); } _curMusicSeq = seqId; @@ -373,10 +388,10 @@ void IMuseDigital::setFtMusicCuePoint(int cueId) { return; if (cueId == 0) - playFtMusic(NULL, 0, 0, true); + playFtMusic(NULL, 0, 0, true, false); else { int seq = ((_curMusicSeq - 1) + cueId) * 4; - playFtMusic(_ftSeqMusicTable[seq].audioName, _ftSeqMusicTable[seq].opcode, _ftSeqMusicTable[seq].volume, true); + playFtMusic(_ftSeqMusicTable[seq].audioName, _ftSeqMusicTable[seq].opcode, _ftSeqMusicTable[seq].volume, true, false); } _curMusicCue = cueId; @@ -394,7 +409,7 @@ int IMuseDigital::getSoundIdByName(const char *soundName) { return -1; } -void IMuseDigital::playFtMusic(const char *songName, int opcode, int volume, bool sequence) { +void IMuseDigital::playFtMusic(const char *songName, int opcode, int volume, bool sequence, bool wait) { fadeOutMusic(200); switch(opcode) { @@ -407,7 +422,7 @@ void IMuseDigital::playFtMusic(const char *songName, int opcode, int volume, boo { int soundId = getSoundIdByName(songName); if (soundId != -1) - startMusic(soundId, sequence, volume); + startMusic(soundId, sequence, volume, wait); } break; } |