mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-03 23:31:57 +00:00
JANITORIAL: SCUMM: Remove magic numbers from DiMUSE engine
Also improve readability on some bits
This commit is contained in:
parent
ea0580506e
commit
ca36141f9b
engines/scumm/imuse_digi
@ -124,6 +124,9 @@ namespace Scumm {
|
||||
#define DIMUSE_C_PROCESS_STREAMS 27
|
||||
#define DIMUSE_C_FEED_STREAM 29
|
||||
|
||||
// Trigger callback command ID
|
||||
#define DIMUSE_C_SCRIPT_CALLBACK 0
|
||||
|
||||
// Block IDs for the Creative Voice File format
|
||||
// used within Full Throttle and The Dig (demo)
|
||||
#define VOC_DIGI_DATA_BLOCK 1
|
||||
|
@ -226,7 +226,7 @@ int IMuseDigital::startVoice(int soundId, const char *soundName, byte speakingAc
|
||||
// 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);
|
||||
diMUSESetTrigger(kTalkSoundID, 0, DIMUSE_C_GET_MARKER_SYNCS);
|
||||
|
||||
diMUSEStartStream(kTalkSoundID, 127, DIMUSE_BUFFER_SPEECH);
|
||||
diMUSESetParam(kTalkSoundID, DIMUSE_P_GROUP, DIMUSE_GROUP_SPEECH);
|
||||
|
@ -610,7 +610,7 @@ void IMuseDigital::playDigMusic(const char *songName, const imuseDigTable *table
|
||||
|
||||
if (table->transitionType == 4) {
|
||||
_stopSequenceFlag = 0;
|
||||
diMUSESetTrigger(table->soundId, MKTAG('_', 'e', 'n', 'd'), 0);
|
||||
diMUSESetTrigger(table->soundId, MKTAG('_', 'e', 'n', 'd'), DIMUSE_C_SCRIPT_CALLBACK);
|
||||
}
|
||||
|
||||
if (oldSoundId) {
|
||||
@ -656,7 +656,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);
|
||||
diMUSESetTrigger(DIMUSE_SMUSH_SOUNDID + DIMUSE_BUFFER_MUSIC, MKTAG('_', 'e', 'n', 'd'), DIMUSE_C_SCRIPT_CALLBACK);
|
||||
break;
|
||||
case 7:
|
||||
if (oldSoundId)
|
||||
@ -749,7 +749,7 @@ void IMuseDigital::playComiDemoMusic(const char *songName, const imuseComiTable
|
||||
diMUSESetParam(table->soundId, DIMUSE_P_GROUP, DIMUSE_GROUP_MUSICEFF); // Repeated intentionally
|
||||
break;
|
||||
default:
|
||||
debug(5, "IMuseDigital::playDigMusic(): bogus or unused transition type, ignored");
|
||||
debug(5, "IMuseDigital::playComiDemoMusic(): bogus or unused transition type, ignored");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -838,7 +838,7 @@ void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *tab
|
||||
|
||||
if (table->transitionType == 4) {
|
||||
_stopSequenceFlag = 0;
|
||||
diMUSESetTrigger(table->soundId, MKTAG('_', 'e', 'n', 'd'), 0);
|
||||
diMUSESetTrigger(table->soundId, MKTAG('_', 'e', 'n', 'd'), DIMUSE_C_SCRIPT_CALLBACK);
|
||||
}
|
||||
|
||||
if (oldSoundId) {
|
||||
@ -869,10 +869,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);
|
||||
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);
|
||||
diMUSESetTrigger(oldSoundId, MKTAG('e', 'x', 'i', 't'), DIMUSE_C_SWITCH_STREAM, oldSoundId, table->soundId, fadeDelay, 1, 0);
|
||||
diMUSESetTrigger(oldSoundId, MKTAG('e', 'x', 'i', 't'), DIMUSE_C_SET_PARAM, table->soundId, DIMUSE_P_VOLUME, 127);
|
||||
diMUSESetTrigger(oldSoundId, MKTAG('e', 'x', 'i', 't'), DIMUSE_C_SET_PARAM, table->soundId, DIMUSE_P_GROUP, DIMUSE_GROUP_MUSICEFF);
|
||||
diMUSESetTrigger(oldSoundId, MKTAG('e', 'x', 'i', 't'), DIMUSE_C_SET_HOOK, table->soundId, hookId);
|
||||
diMUSEProcessStreams();
|
||||
break;
|
||||
default:
|
||||
@ -900,7 +900,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);
|
||||
diMUSESetTrigger(DIMUSE_SMUSH_SOUNDID + DIMUSE_BUFFER_MUSIC, MKTAG('_', 'e', 'n', 'd'), DIMUSE_C_SCRIPT_CALLBACK);
|
||||
break;
|
||||
case 7:
|
||||
if (oldSoundId)
|
||||
@ -914,7 +914,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);
|
||||
diMUSESetTrigger(oldSoundId, MKTAG('_', 'e', 'n', 'd'), DIMUSE_C_SCRIPT_CALLBACK);
|
||||
break;
|
||||
default:
|
||||
debug(5, "IMuseDigital::playComiMusic(): bogus transition type, ignored");
|
||||
|
@ -186,7 +186,7 @@ void IMuseDigiTriggersHandler::processTriggers(int soundId, char *marker) {
|
||||
_trigs[l].sound = 0;
|
||||
|
||||
debug(5, "IMuseDigiTriggersHandler::processTriggers(): executing trigger for soundId %d and marker '%s'", soundId, marker);
|
||||
if (_trigs[l].opcode == 0) {
|
||||
if (_trigs[l].opcode == DIMUSE_C_SCRIPT_CALLBACK) {
|
||||
// Call the script callback (a function which sets _stoppingSequence to 1)
|
||||
_engine->scriptTriggerCallback(_textBuffer);
|
||||
} else {
|
||||
@ -259,7 +259,9 @@ void IMuseDigiTriggersHandler::loop() {
|
||||
_defers[l].counter--;
|
||||
|
||||
if (_defers[l].counter == 1) {
|
||||
if (_defers[l].opcode != 0) {
|
||||
if (_defers[l].opcode == DIMUSE_C_SCRIPT_CALLBACK) {
|
||||
_engine->scriptTriggerCallback(_trigs[l].text);
|
||||
} else {
|
||||
if (_defers[l].opcode < 30) {
|
||||
_engine->cmdsHandleCmd(_trigs[l].opcode, nullptr,
|
||||
_trigs[l].a, _trigs[l].b,
|
||||
@ -268,8 +270,6 @@ void IMuseDigiTriggersHandler::loop() {
|
||||
_trigs[l].g, _trigs[l].h,
|
||||
_trigs[l].i, _trigs[l].j);
|
||||
}
|
||||
} else {
|
||||
_engine->scriptTriggerCallback(_trigs[l].text);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +282,8 @@ int IMuseDigiTriggersHandler::countPendingSounds(int soundId) {
|
||||
continue;
|
||||
|
||||
int opcode = _trigs[l].opcode;
|
||||
if ((opcode == 8 && _trigs[l].a == soundId) || (opcode == 26 && _trigs[l].b == soundId)) {
|
||||
if ((opcode == DIMUSE_C_START_SND && _trigs[l].a == soundId) ||
|
||||
(opcode == DIMUSE_C_SWITCH_STREAM && _trigs[l].b == soundId)) {
|
||||
r++;
|
||||
}
|
||||
}
|
||||
@ -292,7 +293,8 @@ int IMuseDigiTriggersHandler::countPendingSounds(int soundId) {
|
||||
continue;
|
||||
|
||||
int opcode = _defers[l].opcode;
|
||||
if ((opcode == 8 && _defers[l].a == soundId) || (opcode == 26 && _defers[l].b == soundId)) {
|
||||
if ((opcode == DIMUSE_C_START_SND && _defers[l].a == soundId) ||
|
||||
(opcode == DIMUSE_C_SWITCH_STREAM && _defers[l].b == soundId)) {
|
||||
r++;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user