[Scummvm-git-logs] scummvm master -> 2bc8dcc8132162b90f38de56acd10aefe1709c51
AndywinXp
noreply at scummvm.org
Wed Apr 6 19:31:11 UTC 2022
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
4e86347f93 SCUMM: DiMUSE: Improve readability of Trigger function calls
fbc989d60f SCUMM: DIG/DiMUSE: Implement mouth sync times retrieval and handling
2bc8dcc813 SCUMM: DiMUSE: Remove unused code
Commit: 4e86347f93a7678279d1f0cb27a7b17c61f2d1a9
https://github.com/scummvm/scummvm/commit/4e86347f93a7678279d1f0cb27a7b17c61f2d1a9
Author: Andrea Boscarino (andywinxp at gmail.com)
Date: 2022-04-06T21:31:05+02:00
Commit Message:
SCUMM: DiMUSE: Improve readability of Trigger function calls
Changed paths:
engines/scumm/imuse_digi/dimuse_engine.h
engines/scumm/imuse_digi/dimuse_scripts.cpp
diff --git a/engines/scumm/imuse_digi/dimuse_engine.h b/engines/scumm/imuse_digi/dimuse_engine.h
index 3d6d2930e55..89451d161e2 100644
--- a/engines/scumm/imuse_digi/dimuse_engine.h
+++ b/engines/scumm/imuse_digi/dimuse_engine.h
@@ -354,7 +354,12 @@ public:
int diMUSEGetParam(int soundId, int paramId);
int diMUSEFadeParam(int soundId, int opcode, int destValue, int fadeLength);
int diMUSESetHook(int soundId, int hookId);
- int diMUSESetTrigger(int soundId, int marker, int opcode, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n);
+
+ int diMUSESetTrigger(int soundId, int marker, int opcode,
+ int d = -1, int e = -1, int f = -1, int g = -1,
+ int h = -1, int i = -1, int j = -1, int k = -1,
+ int l = -1, int m = -1, int n = -1);
+
int diMUSEStartStream(int soundId, int priority, int groupId);
int diMUSESwitchStream(int oldSoundId, int newSoundId, int fadeDelay, int fadeSyncFlag2, int fadeSyncFlag1);
int diMUSESwitchStream(int oldSoundId, int newSoundId, uint8 *crossfadeBuffer, int crossfadeBufferSize, int vocLoopFlag);
diff --git a/engines/scumm/imuse_digi/dimuse_scripts.cpp b/engines/scumm/imuse_digi/dimuse_scripts.cpp
index f209642849f..1174fa462c7 100644
--- a/engines/scumm/imuse_digi/dimuse_scripts.cpp
+++ b/engines/scumm/imuse_digi/dimuse_scripts.cpp
@@ -599,7 +599,7 @@ void IMuseDigital::playDigMusic(const char *songName, const imuseDigTable *table
if (table->transitionType == 4) {
_stopSequenceFlag = 0;
- diMUSESetTrigger(table->soundId, MKTAG('_', 'e', 'n', 'd'), 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
+ diMUSESetTrigger(table->soundId, MKTAG('_', 'e', 'n', 'd'), 0);
}
if (oldSoundId) {
@@ -645,7 +645,7 @@ void IMuseDigital::playDigMusic(const char *songName, const imuseDigTable *table
break;
case 6:
_stopSequenceFlag = 0;
- diMUSESetTrigger(DIMUSE_SMUSH_SOUNDID + DIMUSE_BUFFER_MUSIC, MKTAG('_', 'e', 'n', 'd'), 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
+ diMUSESetTrigger(DIMUSE_SMUSH_SOUNDID + DIMUSE_BUFFER_MUSIC, MKTAG('_', 'e', 'n', 'd'), 0);
break;
case 7:
if (oldSoundId)
@@ -821,7 +821,7 @@ void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *tab
if (table->transitionType == 4) {
_stopSequenceFlag = 0;
- diMUSESetTrigger(table->soundId, MKTAG('_', 'e', 'n', 'd'), 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
+ diMUSESetTrigger(table->soundId, MKTAG('_', 'e', 'n', 'd'), 0);
}
if (oldSoundId) {
@@ -852,10 +852,10 @@ void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *tab
switch (table->transitionType) {
case 12:
diMUSESetHook(oldSoundId, table->hookId);
- diMUSESetTrigger(oldSoundId, MKTAG('e', 'x', 'i', 't'), 26, oldSoundId, table->soundId, fadeDelay, 1, 0, -1, -1, -1, -1, -1, -1);
- diMUSESetTrigger(oldSoundId, MKTAG('e', 'x', 'i', 't'), 12, table->soundId, DIMUSE_P_VOLUME, 127, -1, -1, -1, -1, -1, -1, -1, -1);
- diMUSESetTrigger(oldSoundId, MKTAG('e', 'x', 'i', 't'), 12, table->soundId, DIMUSE_P_GROUP, 4, -1, -1, -1, -1, -1, -1, -1, -1);
- diMUSESetTrigger(oldSoundId, MKTAG('e', 'x', 'i', 't'), 15, table->soundId, hookId, -1, -1, -1, -1, -1, -1, -1, -1, -1);
+ diMUSESetTrigger(oldSoundId, MKTAG('e', 'x', 'i', 't'), 26, oldSoundId, table->soundId, fadeDelay, 1, 0);
+ diMUSESetTrigger(oldSoundId, MKTAG('e', 'x', 'i', 't'), 12, table->soundId, DIMUSE_P_VOLUME, 127);
+ diMUSESetTrigger(oldSoundId, MKTAG('e', 'x', 'i', 't'), 12, table->soundId, DIMUSE_P_GROUP, 4);
+ diMUSESetTrigger(oldSoundId, MKTAG('e', 'x', 'i', 't'), 15, table->soundId, hookId);
diMUSEProcessStreams();
break;
default:
@@ -883,7 +883,7 @@ void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *tab
break;
case 6:
_stopSequenceFlag = 0;
- diMUSESetTrigger(DIMUSE_SMUSH_SOUNDID + DIMUSE_BUFFER_MUSIC, MKTAG('_', 'e', 'n', 'd'), 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
+ diMUSESetTrigger(DIMUSE_SMUSH_SOUNDID + DIMUSE_BUFFER_MUSIC, MKTAG('_', 'e', 'n', 'd'), 0);
break;
case 7:
if (oldSoundId)
@@ -897,7 +897,7 @@ void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *tab
if (oldSoundId)
diMUSESetHook(oldSoundId, table->hookId);
_stopSequenceFlag = 0;
- diMUSESetTrigger(oldSoundId, MKTAG('_', 'e', 'n', 'd'), 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
+ diMUSESetTrigger(oldSoundId, MKTAG('_', 'e', 'n', 'd'), 0);
break;
default:
debug(5, "IMuseDigital::playComiMusic(): bogus transition type, ignored");
Commit: fbc989d60fa8392ec6fd4c5e4039b0b65e235081
https://github.com/scummvm/scummvm/commit/fbc989d60fa8392ec6fd4c5e4039b0b65e235081
Author: Andrea Boscarino (andywinxp at gmail.com)
Date: 2022-04-06T21:31:05+02:00
Commit Message:
SCUMM: DIG/DiMUSE: Implement mouth sync times retrieval and handling
Changed paths:
engines/scumm/imuse_digi/dimuse_cmds.cpp
engines/scumm/imuse_digi/dimuse_engine.cpp
engines/scumm/imuse_digi/dimuse_engine.h
engines/scumm/imuse_digi/dimuse_triggers.cpp
engines/scumm/sound.cpp
engines/scumm/sound.h
diff --git a/engines/scumm/imuse_digi/dimuse_cmds.cpp b/engines/scumm/imuse_digi/dimuse_cmds.cpp
index 926818436b2..8da2bd45219 100644
--- a/engines/scumm/imuse_digi/dimuse_cmds.cpp
+++ b/engines/scumm/imuse_digi/dimuse_cmds.cpp
@@ -81,6 +81,9 @@ int IMuseDigital::cmdsHandleCmd(int cmd, uint8 *ptr, int a, int b, int c, int d,
return _triggersHandler->clearTrigger(a, marker, c);
case 20:
return _triggersHandler->deferCommand(a, b, c, d, e, f, g, h, i, j, k, l, m, n);
+ case 21:
+ _vm->_sound->extractSyncsFromDiMUSEMarker((char *)ptr);
+ break;
case 25:
return waveStartStream(a, b, c);
case 26:
diff --git a/engines/scumm/imuse_digi/dimuse_engine.cpp b/engines/scumm/imuse_digi/dimuse_engine.cpp
index d41d2348cda..7bfeedf94a0 100644
--- a/engines/scumm/imuse_digi/dimuse_engine.cpp
+++ b/engines/scumm/imuse_digi/dimuse_engine.cpp
@@ -180,6 +180,12 @@ int IMuseDigital::startVoice(int soundId, const char *soundName, byte speakingAc
diMUSEStopSound(DIMUSE_SMUSH_SOUNDID + DIMUSE_BUFFER_SPEECH);
}
+ // Set up a trigger for extracting mouth sync times;
+ // see Sound::extractSyncsFromDiMUSEMarker() for details.
+ // Setting up a trigger with an empty marker is a shortcut for
+ // activating the trigger for any marker.
+ diMUSESetTrigger(kTalkSoundID, 0, 21);
+
diMUSEStartStream(kTalkSoundID, 127, DIMUSE_BUFFER_SPEECH);
diMUSESetParam(kTalkSoundID, DIMUSE_P_GROUP, DIMUSE_GROUP_SPEECH);
if (speakingActorId == _vm->VAR(_vm->VAR_EGO)) {
@@ -765,6 +771,10 @@ int IMuseDigital::diMUSESetTrigger(int soundId, int marker, int opcode, int d, i
return cmdsHandleCmd(17, nullptr, soundId, marker, opcode, d, e, f, g, h, i, j, k, l, m, n);
}
+int IMuseDigital::diMUSEExtractMouthSyncTimes(char *marker) {
+ return cmdsHandleCmd(21, (uint8 *)marker);
+}
+
int IMuseDigital::diMUSEStartStream(int soundId, int priority, int bufferId) {
return cmdsHandleCmd(25, nullptr, soundId, priority, bufferId);
}
diff --git a/engines/scumm/imuse_digi/dimuse_engine.h b/engines/scumm/imuse_digi/dimuse_engine.h
index 89451d161e2..b3312f03a5d 100644
--- a/engines/scumm/imuse_digi/dimuse_engine.h
+++ b/engines/scumm/imuse_digi/dimuse_engine.h
@@ -360,6 +360,7 @@ public:
int h = -1, int i = -1, int j = -1, int k = -1,
int l = -1, int m = -1, int n = -1);
+ int diMUSEExtractMouthSyncTimes(char *marker);
int diMUSEStartStream(int soundId, int priority, int groupId);
int diMUSESwitchStream(int oldSoundId, int newSoundId, int fadeDelay, int fadeSyncFlag2, int fadeSyncFlag1);
int diMUSESwitchStream(int oldSoundId, int newSoundId, uint8 *crossfadeBuffer, int crossfadeBufferSize, int vocLoopFlag);
diff --git a/engines/scumm/imuse_digi/dimuse_triggers.cpp b/engines/scumm/imuse_digi/dimuse_triggers.cpp
index 10224bd1246..c2e4a1f2c7b 100644
--- a/engines/scumm/imuse_digi/dimuse_triggers.cpp
+++ b/engines/scumm/imuse_digi/dimuse_triggers.cpp
@@ -192,7 +192,7 @@ void IMuseDigiTriggersHandler::processTriggers(int soundId, char *marker) {
} else {
if (_trigs[l].opcode < 30) {
// Execute a command
- _engine->cmdsHandleCmd(_trigs[l].opcode, nullptr,
+ _engine->cmdsHandleCmd(_trigs[l].opcode, (uint8 *)textBuffer,
_trigs[l].a, _trigs[l].b,
_trigs[l].c, _trigs[l].d,
_trigs[l].e, _trigs[l].f,
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index f2c4a567920..fcbb6e744a3 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -659,6 +659,10 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle
if (_vm->_game.id == GID_CMI || (_vm->_game.id == GID_DIG && !(_vm->_game.features & GF_DEMO))) {
// COMI (full & demo), DIG (full)
_sfxMode |= mode;
+
+ if (_vm->_game.id == GID_DIG)
+ _curSoundPos = 0;
+
return;
} else if (_vm->_game.id == GID_DIG && (_vm->_game.features & GF_DEMO)) {
_sfxMode |= mode;
@@ -927,6 +931,11 @@ bool Sound::isMouthSyncOff(uint pos) {
bool val = true;
uint16 *ms = _mouthSyncTimes;
+ if (_vm->_game.id == GID_DIG && !(_vm->_game.features & GF_DEMO)) {
+ pos = 1000 * pos / 60;
+ val = false;
+ }
+
_endOfMouthSync = false;
do {
val = !val;
@@ -1177,6 +1186,27 @@ ScummFile *Sound::restoreDiMUSESpeechFile(const char *fileName) {
return file.release();
}
+/* The approach used by the full version of The Dig for obtaining mouth syncs is a bit weird:
+ * they are stored in a text marker found inside the DiMUSE map for each speech file, and when
+ * said engine reaches said marker, the function below is triggered.
+ *
+ * A good reason why this is the way it's done, is that in The Dig the whole speech file,
+ * including its map (and consequently, the text marker), is compressed with the same codec as
+ * sound data; this prevents us from getting the mouth syncs before the file has started playing.
+ * Also, although I can't confirm this, there might be more than one sync marker in a single
+ * speech file, so let's just be safe and follow what the original does.
+ */
+void Sound::extractSyncsFromDiMUSEMarker(const char *marker) {
+ int syncIdx = 0;
+
+ while (marker[syncIdx * 8]) {
+ _mouthSyncTimes[syncIdx] = (uint16)atoi(&marker[syncIdx * 8]);
+ syncIdx++;
+ }
+
+ _mouthSyncTimes[syncIdx] = 0xFFFF;
+}
+
void Sound::setupSfxFile() {
struct SoundFileExtensions {
const char *ext;
diff --git a/engines/scumm/sound.h b/engines/scumm/sound.h
index fabbd1bb9ce..21e00e8e3bb 100644
--- a/engines/scumm/sound.h
+++ b/engines/scumm/sound.h
@@ -137,6 +137,7 @@ public:
bool isSfxFileCompressed();
bool hasSfxFile() const;
ScummFile *restoreDiMUSESpeechFile(const char *fileName);
+ void extractSyncsFromDiMUSEMarker(const char *marker);
void startCDTimer();
void stopCDTimer();
Commit: 2bc8dcc8132162b90f38de56acd10aefe1709c51
https://github.com/scummvm/scummvm/commit/2bc8dcc8132162b90f38de56acd10aefe1709c51
Author: Andrea Boscarino (andywinxp at gmail.com)
Date: 2022-04-06T21:31:05+02:00
Commit Message:
SCUMM: DiMUSE: Remove unused code
Changed paths:
engines/scumm/imuse_digi/dimuse_engine.cpp
engines/scumm/imuse_digi/dimuse_engine.h
diff --git a/engines/scumm/imuse_digi/dimuse_engine.cpp b/engines/scumm/imuse_digi/dimuse_engine.cpp
index 7bfeedf94a0..055be9a8e96 100644
--- a/engines/scumm/imuse_digi/dimuse_engine.cpp
+++ b/engines/scumm/imuse_digi/dimuse_engine.cpp
@@ -771,10 +771,6 @@ int IMuseDigital::diMUSESetTrigger(int soundId, int marker, int opcode, int d, i
return cmdsHandleCmd(17, nullptr, soundId, marker, opcode, d, e, f, g, h, i, j, k, l, m, n);
}
-int IMuseDigital::diMUSEExtractMouthSyncTimes(char *marker) {
- return cmdsHandleCmd(21, (uint8 *)marker);
-}
-
int IMuseDigital::diMUSEStartStream(int soundId, int priority, int bufferId) {
return cmdsHandleCmd(25, nullptr, soundId, priority, bufferId);
}
diff --git a/engines/scumm/imuse_digi/dimuse_engine.h b/engines/scumm/imuse_digi/dimuse_engine.h
index b3312f03a5d..89451d161e2 100644
--- a/engines/scumm/imuse_digi/dimuse_engine.h
+++ b/engines/scumm/imuse_digi/dimuse_engine.h
@@ -360,7 +360,6 @@ public:
int h = -1, int i = -1, int j = -1, int k = -1,
int l = -1, int m = -1, int n = -1);
- int diMUSEExtractMouthSyncTimes(char *marker);
int diMUSEStartStream(int soundId, int priority, int groupId);
int diMUSESwitchStream(int oldSoundId, int newSoundId, int fadeDelay, int fadeSyncFlag2, int fadeSyncFlag1);
int diMUSESwitchStream(int oldSoundId, int newSoundId, uint8 *crossfadeBuffer, int crossfadeBufferSize, int vocLoopFlag);
More information about the Scummvm-git-logs
mailing list