diff options
author | Matthew Hoops | 2011-01-18 21:10:58 +0000 |
---|---|---|
committer | Matthew Hoops | 2011-01-18 21:10:58 +0000 |
commit | 2aca6d383846583de2d7639dcee0e9ad4aab602f (patch) | |
tree | 15046a45ba6854ba1ffc6f32dfe5f02018080101 | |
parent | 99f62728a3c2ded09421f7ee3f17d4b46da2bfc9 (diff) | |
download | scummvm-rg350-2aca6d383846583de2d7639dcee0e9ad4aab602f.tar.gz scummvm-rg350-2aca6d383846583de2d7639dcee0e9ad4aab602f.tar.bz2 scummvm-rg350-2aca6d383846583de2d7639dcee0e9ad4aab602f.zip |
MOHAWK: Rename some Myst-specific sound functions; cleanup
svn-id: r55314
-rw-r--r-- | engines/mohawk/console.cpp | 2 | ||||
-rw-r--r-- | engines/mohawk/myst.cpp | 8 | ||||
-rw-r--r-- | engines/mohawk/myst_areas.cpp | 2 | ||||
-rw-r--r-- | engines/mohawk/myst_scripts.cpp | 20 | ||||
-rw-r--r-- | engines/mohawk/myst_stacks/channelwood.cpp | 10 | ||||
-rw-r--r-- | engines/mohawk/myst_stacks/myst.cpp | 222 | ||||
-rw-r--r-- | engines/mohawk/myst_stacks/preview.cpp | 2 | ||||
-rw-r--r-- | engines/mohawk/myst_stacks/selenitic.cpp | 42 | ||||
-rw-r--r-- | engines/mohawk/myst_stacks/stoneship.cpp | 4 | ||||
-rw-r--r-- | engines/mohawk/sound.cpp | 73 | ||||
-rw-r--r-- | engines/mohawk/sound.h | 19 |
11 files changed, 196 insertions, 208 deletions
diff --git a/engines/mohawk/console.cpp b/engines/mohawk/console.cpp index 1f06663541..67bc77fb9d 100644 --- a/engines/mohawk/console.cpp +++ b/engines/mohawk/console.cpp @@ -216,7 +216,7 @@ bool MystConsole::Cmd_PlaySound(int argc, const char **argv) { return true; } - _vm->_sound->replaceSound((uint16)atoi(argv[1])); + _vm->_sound->replaceSoundMyst((uint16)atoi(argv[1])); return false; } diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp index af0d621572..c7fa89e16a 100644 --- a/engines/mohawk/myst.cpp +++ b/engines/mohawk/myst.cpp @@ -410,7 +410,7 @@ void MohawkEngine_Myst::changeToStack(uint16 stack, uint16 card, uint16 linkSrcS _curStack = stack; _sound->stopSound(); - _sound->stopBackground(); + _sound->stopBackgroundMyst(); if (linkSrcSound) _sound->playSoundBlocking(linkSrcSound); @@ -610,13 +610,13 @@ void MohawkEngine_Myst::changeToCard(uint16 card, bool updateScreen) { debug(2, "Continuing with current sound"); else if (soundAction == kMystSoundActionChangeVolume) { debug(2, "Continuing with current sound, changing volume"); - _sound->changeBackgroundVolume(soundActionVolume); + _sound->changeBackgroundVolumeMyst(soundActionVolume); } else if (soundAction == kMystSoundActionStop) { debug(2, "Stopping sound"); - _sound->stopBackground(); + _sound->stopBackgroundMyst(); } else if (soundAction > 0) { debug(2, "Playing new sound %d", soundAction); - _sound->replaceBackground(soundAction, soundActionVolume); + _sound->replaceBackgroundMyst(soundAction, soundActionVolume); } else { error("Unknown sound action %d", soundAction); } diff --git a/engines/mohawk/myst_areas.cpp b/engines/mohawk/myst_areas.cpp index 2388478ba3..a571a4905f 100644 --- a/engines/mohawk/myst_areas.cpp +++ b/engines/mohawk/myst_areas.cpp @@ -623,7 +623,7 @@ void MystResourceType10::updatePosition(const Common::Point &mouse) { } if (positionChanged && _dragSound) - _vm->_sound->replaceSound(_dragSound); + _vm->_sound->replaceSoundMyst(_dragSound); } MystResourceType11::MystResourceType11(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystResource *parent) : MystResourceType8(vm, rlstStream, parent) { diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp index 9861054fa5..42037690c0 100644 --- a/engines/mohawk/myst_scripts.cpp +++ b/engines/mohawk/myst_scripts.cpp @@ -124,7 +124,7 @@ void MystScriptParser::setupCommonOpcodes() { OPCODE(22, o_goToDest); OPCODE(23, o_toggleAreasActivation); OPCODE(24, o_playSound); - // Opcode 25 is unused; original calls replaceSound + // Opcode 25 is unused; original calls replaceSoundMyst OPCODE(26, o_stopSoundBackground); OPCODE(27, o_playSoundBlocking); OPCODE(28, o_copyBackBufferToScreen); @@ -556,14 +556,14 @@ void MystScriptParser::o_playSound(uint16 op, uint16 var, uint16 argc, uint16 *a debugC(kDebugScript, "Opcode %d: playSound", op); debugC(kDebugScript, "\tsoundId: %d", soundId); - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); } else unknown(op, var, argc, argv); } void MystScriptParser::o_stopSoundBackground(uint16 op, uint16 var, uint16 argc, uint16 *argv) { debugC(kDebugScript, "Opcode %d: stopSoundBackground", op); - _vm->_sound->stopBackground(); + _vm->_sound->stopBackgroundMyst(); } void MystScriptParser::o_playSoundBlocking(uint16 op, uint16 var, uint16 argc, uint16 *argv) { @@ -685,15 +685,15 @@ void MystScriptParser::o_changeBackgroundSound(uint16 op, uint16 var, uint16 arg else if (soundAction == kMystSoundActionChangeVolume) { debugC(kDebugScript, "Continue current sound, change volume"); debugC(kDebugScript, "\tVolume: %d", soundVolume); - _vm->_sound->changeBackgroundVolume(soundVolume); + _vm->_sound->changeBackgroundVolumeMyst(soundVolume); } else if (soundAction == kMystSoundActionStop) { debugC(kDebugScript, "Stop sound"); - _vm->_sound->stopBackground(); + _vm->_sound->stopBackgroundMyst(); } else if (soundAction > 0) { debugC(kDebugScript, "Play new Sound, change volume"); debugC(kDebugScript, "\tSound: %d", soundAction); debugC(kDebugScript, "\tVolume: %d", soundVolume); - _vm->_sound->replaceBackground(soundAction, soundVolume); + _vm->_sound->replaceBackgroundMyst(soundAction, soundVolume); } else { debugC(kDebugScript, "Unknown"); warning("Unknown sound control value in opcode %d", op); @@ -718,13 +718,13 @@ void MystScriptParser::o_soundPlaySwitch(uint16 op, uint16 var, uint16 argc, uin debugC(kDebugScript, "\tsoundId: %d", soundId); if (soundId) - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); } } void MystScriptParser::o_soundResumeBackground(uint16 op, uint16 var, uint16 argc, uint16 *argv) { debugC(kDebugScript, "Opcode %d: soundResumeBackground", op); - _vm->_sound->resumeBackground(); + _vm->_sound->resumeBackgroundMyst(); } void MystScriptParser::o_copyImageToScreen(uint16 op, uint16 var, uint16 argc, uint16 *argv) { @@ -864,7 +864,7 @@ void MystScriptParser::o_changeCardPlaySoundDirectional(uint16 op, uint16 var, u debugC(kDebugScript, "\tanimated update data size: %d", dataSize); if (soundId) - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); _vm->changeToCard(cardId, false); @@ -883,7 +883,7 @@ void MystScriptParser::o_directionalUpdatePlaySound(uint16 op, uint16 var, uint1 debugC(kDebugScript, "\tanimated update data size: %d", dataSize); if (soundId) - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); animatedUpdate(dataSize, &argv[3], delayBetweenSteps); } diff --git a/engines/mohawk/myst_stacks/channelwood.cpp b/engines/mohawk/myst_stacks/channelwood.cpp index df9e4b71e4..af729a31a7 100644 --- a/engines/mohawk/myst_stacks/channelwood.cpp +++ b/engines/mohawk/myst_stacks/channelwood.cpp @@ -229,7 +229,7 @@ void MystScriptParser_Channelwood::opcode_101(uint16 op, uint16 var, uint16 argc uint16 soundId = argv[0]; debugC(kDebugScript, "\tsoundId: %d", soundId); - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); // TODO: Get Movie Location from Invoking Resource Rect, rather than // hardcoded 267, 170 ? @@ -306,7 +306,7 @@ void MystScriptParser_Channelwood::o_valveHandleMoveStart1(uint16 op, uint16 var MystResourceType12 *handle = static_cast<MystResourceType12 *>(_invokingResource); uint16 soundId = handle->getList1(0); if (soundId) - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); _vm->_cursor->setCursor(700); o_valveHandleMove1(op, var, argc, argv); @@ -326,7 +326,7 @@ void MystScriptParser_Channelwood::o_valveHandleMoveStop(uint16 op, uint16 var, // Play release sound uint16 soundId = handle->getList3(0); if (soundId) - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); // Redraw valve _vm->redrawArea(_valveVar); @@ -355,7 +355,7 @@ void MystScriptParser_Channelwood::o_valveHandleMoveStart2(uint16 op, uint16 var MystResourceType12 *handle = static_cast<MystResourceType12 *>(_invokingResource); uint16 soundId = handle->getList1(0); if (soundId) - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); _vm->_cursor->setCursor(700); o_valveHandleMove2(op, var, argc, argv); @@ -381,7 +381,7 @@ void MystScriptParser_Channelwood::o_valveHandleMoveStart3(uint16 op, uint16 var MystResourceType12 *handle = static_cast<MystResourceType12 *>(_invokingResource); uint16 soundId = handle->getList1(0); if (soundId) - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); _vm->_cursor->setCursor(700); o_valveHandleMove3(op, var, argc, argv); diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp index 8682477a6b..9f813c5106 100644 --- a/engines/mohawk/myst_stacks/myst.cpp +++ b/engines/mohawk/myst_stacks/myst.cpp @@ -818,9 +818,9 @@ void MystScriptParser_Myst::o_libraryBookPageTurnLeft(uint16 op, uint16 var, uin _vm->_gfx->copyImageToScreen(_libraryBookBaseImage + _libraryBookPage, rect); if (_vm->_rnd->getRandomBit()) - _vm->_sound->replaceSound(_libraryBookSound1); + _vm->_sound->replaceSoundMyst(_libraryBookSound1); else - _vm->_sound->replaceSound(_libraryBookSound2); + _vm->_sound->replaceSoundMyst(_libraryBookSound2); _vm->_system->updateScreen(); } @@ -836,9 +836,9 @@ void MystScriptParser_Myst::o_libraryBookPageTurnRight(uint16 op, uint16 var, ui _vm->_gfx->copyImageToScreen(_libraryBookBaseImage + _libraryBookPage, rect); if (_vm->_rnd->getRandomBit()) - _vm->_sound->replaceSound(_libraryBookSound1); + _vm->_sound->replaceSoundMyst(_libraryBookSound1); else - _vm->_sound->replaceSound(_libraryBookSound2); + _vm->_sound->replaceSoundMyst(_libraryBookSound2); _vm->_system->updateScreen(); } @@ -917,7 +917,7 @@ void MystScriptParser_Myst::o_towerRotationStart(uint16 op, uint16 var, uint16 a towerRotationMapComputeAngle(); towerRotationMapDrawLine(center, end); - _vm->_sound->replaceSound(5378, Audio::Mixer::kMaxChannelVolume, true); + _vm->_sound->replaceSoundMyst(5378, Audio::Mixer::kMaxChannelVolume, true); } void MystScriptParser_Myst::o_towerRotationEnd(uint16 op, uint16 var, uint16 argc, uint16 *argv) { @@ -942,7 +942,7 @@ void MystScriptParser_Myst::o_towerRotationEnd(uint16 op, uint16 var, uint16 arg _state.towerRotationAngle = 152; } - _vm->_sound->replaceSound(6378); + _vm->_sound->replaceSoundMyst(6378); _towerRotationBlinkLabel = true; _towerRotationBlinkLabelCount = 0; @@ -997,7 +997,7 @@ void MystScriptParser_Myst::o_dockVaultOpen(uint16 op, uint16 var, uint16 argc, else _dockVaultState = 1; - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); _vm->redrawArea(41, false); animatedUpdate(directionalUpdateDataSize, &argv[3], delay); } @@ -1024,7 +1024,7 @@ void MystScriptParser_Myst::o_dockVaultClose(uint16 op, uint16 var, uint16 argc, if (_dockVaultState == 1 || _dockVaultState == 2) _dockVaultState = 0; - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); _vm->redrawArea(41, false); animatedUpdate(directionalUpdateDataSize, &argv[3], delay); } @@ -1128,7 +1128,7 @@ void MystScriptParser_Myst::o_clockWheelsExecute(uint16 op, uint16 var, uint16 a && _state.clockTowerMinutePosition == 40; if (!_state.clockTowerBridgeOpen && correctTime) { - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); _vm->_system->delayMillis(500); // Gears rise up @@ -1140,7 +1140,7 @@ void MystScriptParser_Myst::o_clockWheelsExecute(uint16 op, uint16 var, uint16 a _state.clockTowerBridgeOpen = 1; _vm->redrawArea(12); } else if (_state.clockTowerBridgeOpen && !correctTime) { - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); _vm->_system->delayMillis(500); // Gears sink down @@ -1159,7 +1159,7 @@ void MystScriptParser_Myst::o_imagerPlayButton(uint16 op, uint16 var, uint16 arg uint16 video = getVar(51); // Press button - _vm->_sound->replaceSound(4698); + _vm->_sound->replaceSoundMyst(4698); Common::Rect src = Common::Rect(0, 0, 32, 75); Common::Rect dest = Common::Rect(261, 257, 293, 332); @@ -1176,7 +1176,7 @@ void MystScriptParser_Myst::o_imagerPlayButton(uint16 op, uint16 var, uint16 arg // Play selected video if (!_state.imagerActive && video != 3) - _vm->_sound->replaceSound(argv[0]); + _vm->_sound->replaceSoundMyst(argv[0]); switch (video) { case 0: // Nothing @@ -1205,7 +1205,7 @@ void MystScriptParser_Myst::o_imagerPlayButton(uint16 op, uint16 var, uint16 arg _imagerMovie->setBlocking(false); if (_state.imagerActive) { - _vm->_sound->replaceSound(argv[1]); + _vm->_sound->replaceSoundMyst(argv[1]); // Water disappearing VideoHandle water = _imagerMovie->playMovie(); @@ -1286,11 +1286,11 @@ void MystScriptParser_Myst::imagerValidation_run() { _imagerRedButton->drawConditionalDataToScreen(1); if (_imagerValidationStep < 6) - _vm->_sound->replaceSound(_imagerSound[0]); + _vm->_sound->replaceSoundMyst(_imagerSound[0]); else if (_imagerValidationStep < 10) - _vm->_sound->replaceSound(_imagerSound[1]); + _vm->_sound->replaceSoundMyst(_imagerSound[1]); else if (_imagerValidationStep == 10) - _vm->_sound->replaceSound(_imagerSound[2]); + _vm->_sound->replaceSoundMyst(_imagerSound[2]); _imagerValidationStep++; @@ -1314,7 +1314,7 @@ void MystScriptParser_Myst::o_towerElevatorAnimation(uint16 op, uint16 var, uint _vm->_cursor->hideCursor(); _vm->_sound->stopSound(); - _vm->_sound->pauseBackground(); + _vm->_sound->pauseBackgroundMyst(); switch (argv[0]) { case 0: @@ -1327,7 +1327,7 @@ void MystScriptParser_Myst::o_towerElevatorAnimation(uint16 op, uint16 var, uint break; } - _vm->_sound->resumeBackground(); + _vm->_sound->resumeBackgroundMyst(); _vm->_cursor->showCursor(); _treeStopped = false; } @@ -1351,15 +1351,15 @@ void MystScriptParser_Myst::o_generatorButtonPressed(uint16 op, uint16 var, uint _state.generatorVoltage -= value; if (_state.generatorVoltage) - _vm->_sound->replaceSound(8297); + _vm->_sound->replaceSoundMyst(8297); else - _vm->_sound->replaceSound(9297); + _vm->_sound->replaceSoundMyst(9297); } else { if (_generatorVoltage) - _vm->_sound->replaceSound(6297); + _vm->_sound->replaceSoundMyst(6297); else { - _vm->_sound->replaceSound(7297); //TODO: Replace with play sound and replace background 4297 - _vm->_sound->replaceBackground(4297); + _vm->_sound->replaceSoundMyst(7297); // TODO: Replace with play sound and replace background 4297 + _vm->_sound->replaceBackgroundMyst(4297); } _state.generatorButtons |= mask; @@ -1473,13 +1473,13 @@ void MystScriptParser_Myst::o_cabinSafeHandleMove(uint16 op, uint16 var, uint16 if (_tempVar == 0) { uint16 soundId = handle->getList2(0); if (soundId) - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); } // Combination is right if (_state.cabinSafeCombination == 724) { uint16 soundId = handle->getList2(1); if (soundId) - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); _vm->changeToCard(4103, false); @@ -1504,7 +1504,7 @@ void MystScriptParser_Myst::o_cabinSafeHandleEndMove(uint16 op, uint16 var, uint void MystScriptParser_Myst::o_observatoryMonthChangeStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { debugC(kDebugScript, "Opcode %d: Observatory month change start", op); - _vm->_sound->pauseBackground(); + _vm->_sound->pauseBackgroundMyst(); if (op == 129 || op == 131) { // Increase @@ -1552,7 +1552,7 @@ void MystScriptParser_Myst::observatoryIncrementMonth(int16 increment) { _state.observatoryMonthSlider = _observatoryMonthSlider->_pos.y; } - _vm->_sound->replaceSound(8500); + _vm->_sound->replaceSoundMyst(8500); } void MystScriptParser_Myst::observatoryMonthChange_run() { @@ -1563,7 +1563,7 @@ void MystScriptParser_Myst::observatoryMonthChange_run() { void MystScriptParser_Myst::o_observatoryDayChangeStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { debugC(kDebugScript, "Opcode %d: Observatory day change start", op); - _vm->_sound->pauseBackground(); + _vm->_sound->pauseBackgroundMyst(); if (op == 129 || op == 131) { // Increase @@ -1612,7 +1612,7 @@ void MystScriptParser_Myst::observatoryIncrementDay(int16 increment) { _state.observatoryDaySlider = _observatoryDaySlider->_pos.y; } - _vm->_sound->replaceSound(8500); + _vm->_sound->replaceSoundMyst(8500); } void MystScriptParser_Myst::observatoryDayChange_run() { @@ -1623,7 +1623,7 @@ void MystScriptParser_Myst::observatoryDayChange_run() { void MystScriptParser_Myst::o_observatoryYearChangeStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { debugC(kDebugScript, "Opcode %d: Observatory year change start", op); - _vm->_sound->pauseBackground(); + _vm->_sound->pauseBackgroundMyst(); if (op == 196) { // Increase @@ -1666,7 +1666,7 @@ void MystScriptParser_Myst::observatoryIncrementYear(int16 increment) { _state.observatoryYearSlider = _observatoryYearSlider->_pos.y; } - _vm->_sound->replaceSound(8500); + _vm->_sound->replaceSoundMyst(8500); } void MystScriptParser_Myst::observatoryYearChange_run() { @@ -1677,7 +1677,7 @@ void MystScriptParser_Myst::observatoryYearChange_run() { void MystScriptParser_Myst::o_observatoryTimeChangeStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { debugC(kDebugScript, "Opcode %d: Observatory time change start", op); - _vm->_sound->pauseBackground(); + _vm->_sound->pauseBackgroundMyst(); if (op == 192) { // Increase @@ -1725,7 +1725,7 @@ void MystScriptParser_Myst::observatoryIncrementTime(int16 increment) { _state.observatoryTimeSlider = _observatoryTimeSlider->_pos.y; } - _vm->_sound->replaceSound(8500); + _vm->_sound->replaceSoundMyst(8500); } void MystScriptParser_Myst::observatoryTimeChange_run() { @@ -1742,7 +1742,7 @@ void MystScriptParser_Myst::o_observatoryGoButton(uint16 op, uint16 var, uint16 || _state.observatoryYearTarget != _state.observatoryYearSetting || _state.observatoryTimeTarget != _state.observatoryTimeSetting) { uint16 soundId = argv[0]; - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); int16 distance = _state.observatoryYearTarget - _state.observatoryYearSetting; uint32 end = _vm->_system->getMillis() + 32 * ABS(distance) / 50 + 800; @@ -1755,7 +1755,7 @@ void MystScriptParser_Myst::o_observatoryGoButton(uint16 op, uint16 var, uint16 _vm->redrawResource(_observatoryVisualizer); } - _vm->_sound->resumeBackground(); + _vm->_sound->resumeBackgroundMyst(); // Redraw visualizer observatorySetTargetToSetting(); @@ -1822,11 +1822,11 @@ void MystScriptParser_Myst::o_circuitBreakerMove(uint16 op, uint16 var, uint16 a if (_state.generatorVoltage > 59 || _state.generatorBreakers != 1) { uint16 soundId = breaker->getList2(1); if (soundId) - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); } else { uint16 soundId = breaker->getList2(0); if (soundId) - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); // Reset breaker state _state.generatorBreakers = 0; @@ -1836,11 +1836,11 @@ void MystScriptParser_Myst::o_circuitBreakerMove(uint16 op, uint16 var, uint16 a if (_state.generatorVoltage > 59 || _state.generatorBreakers != 2) { uint16 soundId = breaker->getList2(1); if (soundId) - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); } else { uint16 soundId = breaker->getList2(0); if (soundId) - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); // Reset breaker state _state.generatorBreakers = 0; @@ -1863,7 +1863,7 @@ void MystScriptParser_Myst::o_boilerIncreasePressureStart(uint16 op, uint16 var, _treeStopped = true; if (_state.cabinValvePosition < 25) - _vm->_sound->stopBackground(); + _vm->_sound->stopBackgroundMyst(); _boilerPressureIncreasing = true; } @@ -1880,7 +1880,7 @@ void MystScriptParser_Myst::o_boilerLightPilot(uint16 op, uint16 var, uint16 arg _matchGoOutTime = _vm->_system->getMillis(); if (_state.cabinValvePosition > 0) - _vm->_sound->replaceBackground(8098, 49152); + _vm->_sound->replaceBackgroundMyst(8098, 49152); if (_state.cabinValvePosition > 12) _state.treeLastMoveTime = _vm->_system->getMillis(); @@ -1898,11 +1898,11 @@ void MystScriptParser_Myst::o_boilerIncreasePressureStop(uint16 op, uint16 var, if (_state.cabinPilotLightLit == 1) { if (_state.cabinValvePosition > 0) - _vm->_sound->replaceBackground(8098, 49152); + _vm->_sound->replaceBackgroundMyst(8098, 49152); // TODO: Play movies } else if (_state.cabinValvePosition > 0) - _vm->_sound->replaceBackground(4098, _state.cabinValvePosition << 10); + _vm->_sound->replaceBackgroundMyst(4098, _state.cabinValvePosition << 10); } void MystScriptParser_Myst::boilerPressureIncrease_run() { @@ -1916,13 +1916,13 @@ void MystScriptParser_Myst::boilerPressureIncrease_run() { _vm->redrawArea(305); } else if (_state.cabinValvePosition == 25) { if (_state.cabinPilotLightLit == 1) - _vm->_sound->replaceBackground(8098, 49152); + _vm->_sound->replaceBackgroundMyst(8098, 49152); else - _vm->_sound->replaceBackground(4098, 25600); + _vm->_sound->replaceBackgroundMyst(4098, 25600); } // Pressure increasing sound - _vm->_sound->replaceSound(5098); + _vm->_sound->replaceSoundMyst(5098); // Redraw wheel _vm->redrawArea(99); @@ -1941,7 +1941,7 @@ void MystScriptParser_Myst::boilerPressureDecrease_run() { } // Pressure increasing sound - _vm->_sound->replaceSound(5098); + _vm->_sound->replaceSoundMyst(5098); // Redraw wheel _vm->redrawArea(99); @@ -1952,7 +1952,7 @@ void MystScriptParser_Myst::o_boilerDecreasePressureStart(uint16 op, uint16 var, debugC(kDebugScript, "Opcode %d: Boiler decrease pressure start", op); _treeStopped = true; - _vm->_sound->stopBackground(); + _vm->_sound->stopBackgroundMyst(); _boilerPressureDecreasing = true; } @@ -1966,12 +1966,12 @@ void MystScriptParser_Myst::o_boilerDecreasePressureStop(uint16 op, uint16 var, if (_state.cabinPilotLightLit == 1) { if (_state.cabinValvePosition > 0) - _vm->_sound->replaceBackground(8098, 49152); + _vm->_sound->replaceBackgroundMyst(8098, 49152); // TODO: Play movies } else { if (_state.cabinValvePosition > 0) - _vm->_sound->replaceBackground(4098, _state.cabinValvePosition << 10); + _vm->_sound->replaceBackgroundMyst(4098, _state.cabinValvePosition << 10); } } @@ -1996,7 +1996,7 @@ void MystScriptParser_Myst::basementPressureIncrease_run() { _state.cabinValvePosition++; // Pressure increasing sound - _vm->_sound->replaceSound(4642); + _vm->_sound->replaceSoundMyst(4642); // Redraw wheel _vm->redrawArea(99); @@ -2009,7 +2009,7 @@ void MystScriptParser_Myst::basementPressureDecrease_run() { _state.cabinValvePosition--; // Pressure decreasing sound - _vm->_sound->replaceSound(4642); + _vm->_sound->replaceSoundMyst(4642); // Redraw wheel _vm->redrawArea(99); @@ -2054,18 +2054,18 @@ void MystScriptParser_Myst::tree_run() { // Tree movement if (goingDown) { _state.treePosition--; - _vm->_sound->replaceSound(2); + _vm->_sound->replaceSoundMyst(2); } else { _state.treePosition++; - _vm->_sound->replaceSound(1); + _vm->_sound->replaceSoundMyst(1); } // Stop background music if going up from book room if (_vm->getCurCard() == 4630) { if (_state.treePosition > 0) - _vm->_sound->stopBackground(); + _vm->_sound->stopBackgroundMyst(); else - _vm->_sound->replaceBackground(4630, 24576); + _vm->_sound->replaceBackgroundMyst(4630, 24576); } // Redraw tree @@ -2100,7 +2100,7 @@ void MystScriptParser_Myst::o_rocketSoundSliderStartMove(uint16 op, uint16 var, _rocketSliderSound = 0; _vm->_cursor->setCursor(700); - _vm->_sound->pauseBackground(); + _vm->_sound->pauseBackgroundMyst(); rocketSliderMove(); } @@ -2129,7 +2129,7 @@ void MystScriptParser_Myst::o_rocketSoundSliderEndMove(uint16 op, uint16 var, ui else if (_invokingResource == _rocketSlider5) _state.rocketSliderPosition[4] = _rocketSlider5->_pos.y; - _vm->_sound->resumeBackground(); + _vm->_sound->resumeBackgroundMyst(); } void MystScriptParser_Myst::rocketSliderMove() { @@ -2139,7 +2139,7 @@ void MystScriptParser_Myst::rocketSliderMove() { uint16 soundId = rocketSliderGetSound(slider->_pos.y); if (soundId != _rocketSliderSound) { _rocketSliderSound = soundId; - _vm->_sound->replaceSound(soundId, Audio::Mixer::kMaxChannelVolume, true); + _vm->_sound->replaceSoundMyst(soundId, Audio::Mixer::kMaxChannelVolume, true); } } } @@ -2155,35 +2155,35 @@ void MystScriptParser_Myst::rocketCheckSolution() { bool solved = true; soundId = rocketSliderGetSound(_rocketSlider1->_pos.y); - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); _rocketSlider1->drawConditionalDataToScreen(2); _vm->_system->delayMillis(250); if (soundId != 9558) solved = false; soundId = rocketSliderGetSound(_rocketSlider2->_pos.y); - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); _rocketSlider2->drawConditionalDataToScreen(2); _vm->_system->delayMillis(250); if (soundId != 9546) solved = false; soundId = rocketSliderGetSound(_rocketSlider3->_pos.y); - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); _rocketSlider3->drawConditionalDataToScreen(2); _vm->_system->delayMillis(250); if (soundId != 9543) solved = false; soundId = rocketSliderGetSound(_rocketSlider4->_pos.y); - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); _rocketSlider4->drawConditionalDataToScreen(2); _vm->_system->delayMillis(250); if (soundId != 9553) solved = false; soundId = rocketSliderGetSound(_rocketSlider5->_pos.y); - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); _rocketSlider5->drawConditionalDataToScreen(2); _vm->_system->delayMillis(250); if (soundId != 9560) @@ -2237,7 +2237,7 @@ void MystScriptParser_Myst::o_rocketPianoStart(uint16 op, uint16 var, uint16 arg // Play note if (_state.generatorVoltage == 59 && !_state.generatorBreakers) { uint16 soundId = key->getList1(0); - _vm->_sound->replaceSound(soundId, Audio::Mixer::kMaxChannelVolume, true); + _vm->_sound->replaceSoundMyst(soundId, Audio::Mixer::kMaxChannelVolume, true); } } @@ -2275,12 +2275,12 @@ void MystScriptParser_Myst::o_rocketPianoMove(uint16 op, uint16 var, uint16 argc // Play note if (_state.generatorVoltage == 59 && !_state.generatorBreakers) { uint16 soundId = key->getList1(0); - _vm->_sound->replaceSound(soundId, Audio::Mixer::kMaxChannelVolume, true); + _vm->_sound->replaceSoundMyst(soundId, Audio::Mixer::kMaxChannelVolume, true); } } else { // Not pressing a key anymore _vm->_sound->stopSound(); - _vm->_sound->resumeBackground(); + _vm->_sound->resumeBackgroundMyst(); } } @@ -2302,7 +2302,7 @@ void MystScriptParser_Myst::o_rocketPianoStop(uint16 op, uint16 var, uint16 argc _vm->_system->updateScreen(); _vm->_sound->stopSound(); - _vm->_sound->resumeBackground(); + _vm->_sound->resumeBackgroundMyst(); } void MystScriptParser_Myst::o_rocketLeverStartMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { @@ -2343,7 +2343,7 @@ void MystScriptParser_Myst::o_rocketLeverMove(uint16 op, uint16 var, uint16 argc uint16 soundId = lever->getList2(0); if (soundId) - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); // If rocket correctly powered if (_state.generatorVoltage == 59 && !_state.generatorBreakers) @@ -2407,7 +2407,7 @@ void MystScriptParser_Myst::o_observatoryMonthSliderStartMove(uint16 op, uint16 debugC(kDebugScript, "Opcode %d: Month slider start move", op); _vm->_cursor->setCursor(700); - _vm->_sound->pauseBackground(); + _vm->_sound->pauseBackgroundMyst(); observatoryUpdateMonth(); } @@ -2416,7 +2416,7 @@ void MystScriptParser_Myst::o_observatoryMonthSliderEndMove(uint16 op, uint16 va debugC(kDebugScript, "Opcode %d: Month slider end move", op); _vm->checkCursorHints(); - _vm->_sound->resumeBackground(); + _vm->_sound->resumeBackgroundMyst(); observatoryUpdateMonth(); } @@ -2427,7 +2427,7 @@ void MystScriptParser_Myst::observatoryUpdateMonth() { if (month != _state.observatoryMonthSetting) { _state.observatoryMonthSetting = month; _state.observatoryMonthSlider = _observatoryMonthSlider->_pos.y; - _vm->_sound->replaceSound(8500); + _vm->_sound->replaceSoundMyst(8500); // Redraw digits _vm->redrawArea(73); @@ -2438,7 +2438,7 @@ void MystScriptParser_Myst::o_observatoryDaySliderStartMove(uint16 op, uint16 va debugC(kDebugScript, "Opcode %d: Day slider start move", op); _vm->_cursor->setCursor(700); - _vm->_sound->pauseBackground(); + _vm->_sound->pauseBackgroundMyst(); observatoryUpdateDay(); } @@ -2447,7 +2447,7 @@ void MystScriptParser_Myst::o_observatoryDaySliderEndMove(uint16 op, uint16 var, debugC(kDebugScript, "Opcode %d: Day slider end move", op); _vm->checkCursorHints(); - _vm->_sound->resumeBackground(); + _vm->_sound->resumeBackgroundMyst(); observatoryUpdateDay(); } @@ -2458,7 +2458,7 @@ void MystScriptParser_Myst::observatoryUpdateDay() { if (day != _state.observatoryDaySetting) { _state.observatoryDaySetting = day; _state.observatoryDaySlider = _observatoryDaySlider->_pos.y; - _vm->_sound->replaceSound(8500); + _vm->_sound->replaceSoundMyst(8500); // Redraw digits _vm->redrawArea(75); @@ -2470,7 +2470,7 @@ void MystScriptParser_Myst::o_observatoryYearSliderStartMove(uint16 op, uint16 v debugC(kDebugScript, "Opcode %d: Year slider start move", op); _vm->_cursor->setCursor(700); - _vm->_sound->pauseBackground(); + _vm->_sound->pauseBackgroundMyst(); observatoryUpdateYear(); } @@ -2479,7 +2479,7 @@ void MystScriptParser_Myst::o_observatoryYearSliderEndMove(uint16 op, uint16 var debugC(kDebugScript, "Opcode %d: Year slider end move", op); _vm->checkCursorHints(); - _vm->_sound->resumeBackground(); + _vm->_sound->resumeBackgroundMyst(); observatoryUpdateYear(); } @@ -2490,7 +2490,7 @@ void MystScriptParser_Myst::observatoryUpdateYear() { if (year != _state.observatoryYearSetting) { _state.observatoryYearSetting = year; _state.observatoryYearSlider = _observatoryYearSlider->_pos.y; - _vm->_sound->replaceSound(8500); + _vm->_sound->replaceSoundMyst(8500); // Redraw digits _vm->redrawArea(79); @@ -2504,7 +2504,7 @@ void MystScriptParser_Myst::o_observatoryTimeSliderStartMove(uint16 op, uint16 v debugC(kDebugScript, "Opcode %d: Time slider start move", op); _vm->_cursor->setCursor(700); - _vm->_sound->pauseBackground(); + _vm->_sound->pauseBackgroundMyst(); observatoryUpdateTime(); } @@ -2513,7 +2513,7 @@ void MystScriptParser_Myst::o_observatoryTimeSliderEndMove(uint16 op, uint16 var debugC(kDebugScript, "Opcode %d: Time slider end move", op); _vm->checkCursorHints(); - _vm->_sound->resumeBackground(); + _vm->_sound->resumeBackgroundMyst(); observatoryUpdateTime(); } @@ -2524,7 +2524,7 @@ void MystScriptParser_Myst::observatoryUpdateTime() { if (time != _state.observatoryTimeSetting) { _state.observatoryTimeSetting = time; _state.observatoryTimeSlider = _observatoryTimeSlider->_pos.y; - _vm->_sound->replaceSound(8500); + _vm->_sound->replaceSoundMyst(8500); // Redraw digits _vm->redrawArea(80); @@ -2545,7 +2545,7 @@ void MystScriptParser_Myst::o_libraryCombinationBookStop(uint16 op, uint16 var, void MystScriptParser_Myst::o_cabinMatchLight(uint16 op, uint16 var, uint16 argc, uint16 *argv) { if (!_cabinMatchState) { - _vm->_sound->replaceSound(4103); + _vm->_sound->replaceSoundMyst(4103); // Match is lit _cabinMatchState = 1; @@ -2637,7 +2637,7 @@ void MystScriptParser_Myst::clockWheelStartTurn(uint16 wheel) { uint16 soundId = resource->getList1(0); if (soundId) - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); // Turn wheel one step if (wheel == 1) @@ -2698,9 +2698,9 @@ void MystScriptParser_Myst::libraryCombinationBookTurnLeft() { _vm->_gfx->copyImageToScreen(_libraryBookBaseImage + _libraryBookPage, rect); if (_vm->_rnd->getRandomBit()) - _vm->_sound->replaceSound(_libraryBookSound1); + _vm->_sound->replaceSoundMyst(_libraryBookSound1); else - _vm->_sound->replaceSound(_libraryBookSound2); + _vm->_sound->replaceSoundMyst(_libraryBookSound2); _vm->_system->updateScreen(); } @@ -2724,9 +2724,9 @@ void MystScriptParser_Myst::libraryCombinationBookTurnRight() { _vm->_gfx->copyImageToScreen(_libraryBookBaseImage + _libraryBookPage, rect); if (_vm->_rnd->getRandomBit()) - _vm->_sound->replaceSound(_libraryBookSound1); + _vm->_sound->replaceSoundMyst(_libraryBookSound1); else - _vm->_sound->replaceSound(_libraryBookSound2); + _vm->_sound->replaceSoundMyst(_libraryBookSound2); _vm->_system->updateScreen(); } @@ -2761,7 +2761,7 @@ void MystScriptParser_Myst::o_observatoryChangeSettingStop(uint16 op, uint16 var _vm->redrawResource(_observatoryCurrentSlider); _observatoryCurrentSlider = 0; } - _vm->_sound->resumeBackground(); + _vm->_sound->resumeBackgroundMyst(); } void MystScriptParser_Myst::o_dockVaultForceClose(uint16 op, uint16 var, uint16 argc, uint16 *argv) { @@ -2777,12 +2777,12 @@ void MystScriptParser_Myst::o_dockVaultForceClose(uint16 op, uint16 var, uint16 if (_dockVaultState) { // Open switch _state.dockMarkerSwitch = 1; - _vm->_sound->replaceSound(4143); + _vm->_sound->replaceSoundMyst(4143); _vm->redrawArea(4); // Close vault _dockVaultState = 0; - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); _vm->redrawArea(41, false); animatedUpdate(directionalUpdateDataSize, &argv[3], delay); } @@ -2819,7 +2819,7 @@ void MystScriptParser_Myst::o_clockLeverMove(uint16 op, uint16 var, uint16 argc, if (step == maxStep) { // Start videos for first step if (_clockWeightPosition < 2214) { - _vm->_sound->replaceSound(5113); + _vm->_sound->replaceSoundMyst(5113); clockGearForwardOneStep(1); // Left lever @@ -2867,7 +2867,7 @@ void MystScriptParser_Myst::clockWeightDownOneStep() { void MystScriptParser_Myst::clockGears_run() { if (!_vm->_video->isVideoPlaying() && _clockWeightPosition < 2214) { _clockMiddleGearMovedAlone = true; - _vm->_sound->replaceSound(5113); + _vm->_sound->replaceSoundMyst(5113); clockGearForwardOneStep(1); clockWeightDownOneStep(); } @@ -2888,7 +2888,7 @@ void MystScriptParser_Myst::o_clockLeverEndMove(uint16 op, uint16 var, uint16 ar } if (_clockMiddleGearMovedAlone) - _vm->_sound->replaceSound(8113); + _vm->_sound->replaceSoundMyst(8113); // Get current lever frame MystResourceType12 *lever = static_cast<MystResourceType12 *>(_invokingResource); @@ -2916,7 +2916,7 @@ void MystScriptParser_Myst::clockGearsCheckSolution() { && !_state.gearsOpen) { // Make weight go down - _vm->_sound->replaceSound(9113); + _vm->_sound->replaceSoundMyst(9113); _clockWeightVideo = _vm->_video->playMovie(_vm->wrapMovieFilename("cl1wlfch", kMystStack) , 124, 0); _vm->_video->setVideoBounds(_clockWeightVideo, Graphics::VideoTimestamp(_clockWeightPosition, 600), @@ -2924,16 +2924,16 @@ void MystScriptParser_Myst::clockGearsCheckSolution() { _vm->_video->waitUntilMovieEnds(_clockWeightVideo); _clockWeightPosition = 2214; - _vm->_sound->replaceSound(6113); + _vm->_sound->replaceSoundMyst(6113); _vm->_system->delayMillis(1000); - _vm->_sound->replaceSound(7113); + _vm->_sound->replaceSoundMyst(7113); // Gear opening video _vm->_video->playMovieBlocking(_vm->wrapMovieFilename("cl1wggat", kMystStack) , 195, 225); _state.gearsOpen = 1; _vm->redrawArea(40); - _vm->_sound->replaceBackground(4113, 16384); + _vm->_sound->replaceBackgroundMyst(4113, 16384); } } @@ -2967,8 +2967,8 @@ void MystScriptParser_Myst::clockReset() { _vm->_cursor->hideCursor(); - _vm->_sound->stopBackground(); - _vm->_sound->replaceSound(5113); + _vm->_sound->stopBackgroundMyst(); + _vm->_sound->replaceSoundMyst(5113); // Play reset videos clockResetWeight(); @@ -2983,13 +2983,13 @@ void MystScriptParser_Myst::clockReset() { _vm->_video->delayUntilMovieEnds(handle); } - _vm->_sound->replaceSound(10113); + _vm->_sound->replaceSoundMyst(10113); // Close gear if (_state.gearsOpen) { - _vm->_sound->replaceSound(6113); + _vm->_sound->replaceSoundMyst(6113); _vm->_system->delayMillis(1000); - _vm->_sound->replaceSound(7113); + _vm->_sound->replaceSoundMyst(7113); // TODO: Play cl1wggat backwards // Redraw gear @@ -3071,7 +3071,7 @@ void MystScriptParser_Myst::o_courtyardBox_init(uint16 op, uint16 var, uint16 ar void MystScriptParser_Myst::towerRotationMap_run() { if (!_towerRotationMapInitialized) { _towerRotationMapInitialized = true; - _vm->_sound->replaceSound(4378); + _vm->_sound->replaceSoundMyst(4378); towerRotationDrawBuildings(); @@ -3268,7 +3268,7 @@ void MystScriptParser_Myst::libraryBookcaseTransform_run(void) { _libraryBookcaseMoving = false; // Play transform sound and video - _vm->_sound->replaceSound(_libraryBookcaseSoundId); + _vm->_sound->replaceSoundMyst(_libraryBookcaseSoundId); _libraryBookcaseMovie->playMovie(); } } @@ -3434,33 +3434,33 @@ void MystScriptParser_Myst::observatory_run() { // Make sliders "initialize" if (observatoryIsDDMMYYYY2400()) { - _vm->_sound->replaceSound(8500); + _vm->_sound->replaceSoundMyst(8500); _observatoryDaySlider->drawConditionalDataToScreen(2); _vm->_system->delayMillis(200); _vm->redrawResource(_observatoryDaySlider); - _vm->_sound->replaceSound(8500); + _vm->_sound->replaceSoundMyst(8500); _observatoryMonthSlider->drawConditionalDataToScreen(2); _vm->_system->delayMillis(200); _vm->redrawResource(_observatoryMonthSlider); } else { - _vm->_sound->replaceSound(8500); + _vm->_sound->replaceSoundMyst(8500); _observatoryMonthSlider->drawConditionalDataToScreen(2); _vm->_system->delayMillis(200); _vm->redrawResource(_observatoryMonthSlider); - _vm->_sound->replaceSound(8500); + _vm->_sound->replaceSoundMyst(8500); _observatoryDaySlider->drawConditionalDataToScreen(2); _vm->_system->delayMillis(200); _vm->redrawResource(_observatoryDaySlider); } - _vm->_sound->replaceSound(8500); + _vm->_sound->replaceSoundMyst(8500); _observatoryYearSlider->drawConditionalDataToScreen(2); _vm->_system->delayMillis(200); _vm->redrawResource(_observatoryYearSlider); - _vm->_sound->replaceSound(8500); + _vm->_sound->replaceSoundMyst(8500); _observatoryTimeSlider->drawConditionalDataToScreen(2); _vm->_system->delayMillis(200); _vm->redrawResource(_observatoryTimeSlider); @@ -3592,7 +3592,7 @@ void MystScriptParser_Myst::greenBook_run() { if (_tempVar == 1) { _vm->_sound->stopSound(); - _vm->_sound->pauseBackground(); + _vm->_sound->pauseBackgroundMyst(); if (_globals.ending != 4) { _tempVar = 2; diff --git a/engines/mohawk/myst_stacks/preview.cpp b/engines/mohawk/myst_stacks/preview.cpp index 6afb14b981..bbf324714b 100644 --- a/engines/mohawk/myst_stacks/preview.cpp +++ b/engines/mohawk/myst_stacks/preview.cpp @@ -108,7 +108,7 @@ void MystScriptParser_Preview::opcode_298(uint16 op, uint16 var, uint16 argc, ui // Used for Card 3000 (Closed Myst Book) // TODO: Fill in logic. // Start Voice Over... which controls book opening - _vm->_sound->replaceSound(3001); + _vm->_sound->replaceSoundMyst(3001); // then link to Myst - Trigger of Hotspot? then opcode 199/196/197 for voice over continue? // TODO: Sync Voice and Actions to Original diff --git a/engines/mohawk/myst_stacks/selenitic.cpp b/engines/mohawk/myst_stacks/selenitic.cpp index ab932a87a7..85654050a7 100644 --- a/engines/mohawk/myst_stacks/selenitic.cpp +++ b/engines/mohawk/myst_stacks/selenitic.cpp @@ -559,7 +559,7 @@ void MystScriptParser_Selenitic::mazeRunnerPlaySoundHelp() { soundId = 2191; if (soundId) - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); _mazeRunnerLight->drawConditionalDataToScreen(0); } @@ -601,17 +601,17 @@ void MystScriptParser_Selenitic::o_soundReceiverSigma(uint16 op, uint16 var, uin } _soundReceiverPosition = &_state.soundReceiverPositions[source]; - _vm->_sound->stopBackground(); - _vm->_sound->replaceSound(2287); + _vm->_sound->stopBackgroundMyst(); + _vm->_sound->replaceSoundMyst(2287); soundReceiverDrawView(); uint16 soundId = soundReceiverCurrentSound(source, *_soundReceiverPosition); - _vm->_sound->replaceBackground(soundId); + _vm->_sound->replaceBackgroundMyst(soundId); _vm->_system->delayMillis(1000); } _soundReceiverPosition = oldPosition; _soundReceiverSigmaPressed = true; - _vm->_sound->stopBackground(); + _vm->_sound->stopBackgroundMyst(); _soundReceiverSources[_state.soundReceiverCurrentSource]->drawConditionalDataToScreen(1); @@ -712,8 +712,8 @@ void MystScriptParser_Selenitic::o_soundReceiverSource(uint16 op, uint16 var, ui _vm->_sound->stopSound(); uint16 soundId = argv[0]; - _vm->_sound->stopBackground(); - _vm->_sound->replaceSound(soundId); + _vm->_sound->stopBackgroundMyst(); + _vm->_sound->replaceSoundMyst(soundId); _soundReceiverCurrentSource->drawConditionalDataToScreen(1); @@ -730,11 +730,11 @@ void MystScriptParser_Selenitic::o_mazeRunnerDoorButton(uint16 op, uint16 var, u if (_mazeRunnerPosition == 288) { _vm->changeToCard(cardIdEntry, false); - _vm->_sound->replaceSound(cardIdEntry); + _vm->_sound->replaceSoundMyst(cardIdEntry); animatedUpdate(argv[2], &argv[3], 10); } else if (_mazeRunnerPosition == 289) { _vm->changeToCard(cardIdExit, false); - _vm->_sound->replaceSound(cardIdExit); + _vm->_sound->replaceSoundMyst(cardIdExit); animatedUpdate(argv[2], &argv[3], 10); } } @@ -795,7 +795,7 @@ void MystScriptParser_Selenitic::o_soundLockMove(uint16 op, uint16 var, uint16 a uint16 soundId = soundLockCurrentSound(slider->_pos.y, true); if (_soundLockSoundId != soundId) { _soundLockSoundId = soundId; - _vm->_sound->replaceSound(soundId, Audio::Mixer::kMaxChannelVolume, true); + _vm->_sound->replaceSoundMyst(soundId, Audio::Mixer::kMaxChannelVolume, true); } } @@ -805,10 +805,10 @@ void MystScriptParser_Selenitic::o_soundLockStartMove(uint16 op, uint16 var, uin MystResourceType10 *slider = soundLockSliderFromVar(var); _vm->_cursor->setCursor(700); - _vm->_sound->pauseBackground(); + _vm->_sound->pauseBackgroundMyst(); _soundLockSoundId = soundLockCurrentSound(slider->_pos.y, true); - _vm->_sound->replaceSound(_soundLockSoundId, Audio::Mixer::kMaxChannelVolume, true); + _vm->_sound->replaceSoundMyst(_soundLockSoundId, Audio::Mixer::kMaxChannelVolume, true); } void MystScriptParser_Selenitic::o_soundLockEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { @@ -850,14 +850,14 @@ void MystScriptParser_Selenitic::o_soundLockEndMove(uint16 op, uint16 var, uint1 uint16 soundId = slider->getList3(0); if (soundId) - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); - _vm->_sound->resumeBackground(); + _vm->_sound->resumeBackgroundMyst(); } void MystScriptParser_Selenitic::soundLockCheckSolution(MystResourceType10 *slider, uint16 value, uint16 solution, bool &solved) { slider->drawConditionalDataToScreen(2); - _vm->_sound->replaceSound(soundLockCurrentSound(value / 12, false)); + _vm->_sound->replaceSoundMyst(soundLockCurrentSound(value / 12, false)); _vm->_system->delayMillis(1500); if (value / 12 != solution) @@ -872,8 +872,8 @@ void MystScriptParser_Selenitic::o_soundLockButton(uint16 op, uint16 var, uint16 bool solved = true; - _vm->_sound->pauseBackground(); - _vm->_sound->replaceSound(1147); + _vm->_sound->pauseBackgroundMyst(); + _vm->_sound->replaceSoundMyst(1147); _soundLockButton->drawConditionalDataToScreen(1); _vm->_cursor->hideCursor(); @@ -883,8 +883,8 @@ void MystScriptParser_Selenitic::o_soundLockButton(uint16 op, uint16 var, uint16 soundLockCheckSolution(_soundLockSlider4, _state.soundLockSliderPositions[3], 6, solved); soundLockCheckSolution(_soundLockSlider5, _state.soundLockSliderPositions[4], 7, solved); - _vm->_sound->replaceSound(1148); - _vm->_sound->resumeBackground(); + _vm->_sound->replaceSoundMyst(1148); + _vm->_sound->resumeBackgroundMyst(); if (solved) { _soundLockButton->drawConditionalDataToScreen(2); @@ -895,7 +895,7 @@ void MystScriptParser_Selenitic::o_soundLockButton(uint16 op, uint16 var, uint16 _vm->changeToCard(cardIdClosed, true); _vm->changeToCard(cardIdOpen, false); - _vm->_sound->replaceSound(argv[2]); + _vm->_sound->replaceSoundMyst(argv[2]); animatedUpdate(argv[4], &argv[5], argv[3]); } else { @@ -968,7 +968,7 @@ void MystScriptParser_Selenitic::soundReceiverIncreaseSpeed() { void MystScriptParser_Selenitic::soundReceiverUpdateSound() { uint16 soundId = soundReceiverCurrentSound(_state.soundReceiverCurrentSource, *_soundReceiverPosition); - _vm->_sound->replaceSound(soundId); + _vm->_sound->replaceSoundMyst(soundId); } uint16 MystScriptParser_Selenitic::soundReceiverCurrentSound(uint16 source, uint16 position) { diff --git a/engines/mohawk/myst_stacks/stoneship.cpp b/engines/mohawk/myst_stacks/stoneship.cpp index c20b13960d..78b9fe3858 100644 --- a/engines/mohawk/myst_stacks/stoneship.cpp +++ b/engines/mohawk/myst_stacks/stoneship.cpp @@ -632,8 +632,8 @@ void MystScriptParser_Stoneship::opcode_210(uint16 op, uint16 var, uint16 argc, // TODO: Work Out Function i.e. control Var etc. if (false) { - _vm->_sound->replaceSound(soundId); - _vm->_sound->replaceSound(soundIdStopping); + _vm->_sound->replaceSoundMyst(soundId); + _vm->_sound->replaceSoundMyst(soundIdStopping); } } else unknown(op, var, argc, argv); diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp index a398dc4556..14f85fd9ba 100644 --- a/engines/mohawk/sound.cpp +++ b/engines/mohawk/sound.cpp @@ -79,20 +79,9 @@ Audio::AudioStream *Sound::makeAudioStream(uint16 id) { switch (_vm->getGameType()) { case GType_MYST: - if (_vm->getFeatures() & GF_ME) { - // Myst ME is a bit more efficient with sound storage than Myst - // Myst has lots of sounds repeated. To overcome this, Myst ME - // has MJMP resources which provide a link to the actual MSND - // resource we're looking for. This saves a lot of space from - // repeated data. - if (_vm->hasResource(ID_MJMP, id)) { - Common::SeekableReadStream *mjmpStream = _vm->getResource(ID_MJMP, id); - id = mjmpStream->readUint16LE(); - delete mjmpStream; - } - - audStream = Audio::makeWAVStream(_vm->getResource(ID_MSND, id), DisposeAfterUse::YES); - } else + if (_vm->getFeatures() & GF_ME) + audStream = Audio::makeWAVStream(_vm->getResource(ID_MSND, convertMystID(id)), DisposeAfterUse::YES); + else audStream = makeMohawkWaveStream(_vm->getResource(ID_MSND, id)); break; case GType_ZOOMBINI: @@ -129,18 +118,18 @@ Audio::SoundHandle *Sound::playSound(uint16 id, byte volume, bool loop) { return NULL; } -Audio::SoundHandle *Sound::replaceSound(uint16 id, byte volume, bool loop) { +Audio::SoundHandle *Sound::replaceSoundMyst(uint16 id, byte volume, bool loop) { debug (0, "Replacing sound %d", id); - //TODO: The original engine does fading + // TODO: The original engine does fading - Common::String name = getName(id); + Common::String name = _vm->getResourceName(ID_MSND, convertMystID(id)); // Check if sound is already playing for (uint32 i = 0; i < _handles.size(); i++) if (_handles[i].type == kUsedHandle && _vm->_mixer->isSoundHandleActive(_handles[i].handle) - && name.equals(getName(_handles[i].id))) + && name.equals(_vm->getResourceName(ID_MSND, convertMystID(_handles[i].id)))) return &_handles[i].handle; stopSound(); @@ -560,22 +549,37 @@ bool Sound::isPlaying(uint16 id) { return false; } -Audio::SoundHandle *Sound::replaceBackground(uint16 id, uint16 volume) { +uint16 Sound::convertMystID(uint16 id) { + // Myst ME is a bit more efficient with sound storage than Myst + // Myst has lots of sounds repeated. To overcome this, Myst ME + // has MJMP resources which provide a link to the actual MSND + // resource we're looking for. This saves a lot of space from + // repeated data. + if (_vm->hasResource(ID_MJMP, id)) { + Common::SeekableReadStream *mjmpStream = _vm->getResource(ID_MJMP, id); + id = mjmpStream->readUint16LE(); + delete mjmpStream; + } + + return id; +} + +Audio::SoundHandle *Sound::replaceBackgroundMyst(uint16 id, uint16 volume) { debug (0, "Replacing background %d", id); // TODO: The original engine does fading - Common::String name = getName(id); + Common::String name = _vm->getResourceName(ID_MSND, convertMystID(id)); // Check if sound is already playing for (uint32 i = 0; i < _handles.size(); i++) if (_handles[i].type == kBackgroundHandle && _vm->_mixer->isSoundHandleActive(_handles[i].handle) - && name.equals(getName(_handles[i].id))) + && name.equals(_vm->getResourceName(ID_MSND, convertMystID(_handles[i].id)))) return &_handles[i].handle; // Stop old background sound - stopBackground(); + stopBackgroundMyst(); // Play new sound Audio::AudioStream *audStream = makeAudioStream(id); @@ -595,7 +599,7 @@ Audio::SoundHandle *Sound::replaceBackground(uint16 id, uint16 volume) { return NULL; } -void Sound::stopBackground() { +void Sound::stopBackgroundMyst() { for (uint32 i = 0; i < _handles.size(); i++) if (_handles[i].type == kBackgroundHandle) { _vm->_mixer->stopHandle(_handles[i].handle); @@ -604,39 +608,22 @@ void Sound::stopBackground() { } } -void Sound::pauseBackground() { +void Sound::pauseBackgroundMyst() { for (uint32 i = 0; i < _handles.size(); i++) if (_handles[i].type == kBackgroundHandle) _vm->_mixer->pauseHandle(_handles[i].handle, true); } -void Sound::resumeBackground() { +void Sound::resumeBackgroundMyst() { for (uint32 i = 0; i < _handles.size(); i++) if (_handles[i].type == kBackgroundHandle) _vm->_mixer->pauseHandle(_handles[i].handle, false); } -void Sound::changeBackgroundVolume(uint16 vol) { +void Sound::changeBackgroundVolumeMyst(uint16 vol) { for (uint32 i = 0; i < _handles.size(); i++) if (_handles[i].type == kBackgroundHandle) _vm->_mixer->setChannelVolume(_handles[i].handle, vol >> 8); } -Common::String Sound::getName(uint16 id) { - if (_vm->getFeatures() & GF_ME) { - // Myst ME is a bit more efficient with sound storage than Myst - // Myst has lots of sounds repeated. To overcome this, Myst ME - // has MJMP resources which provide a link to the actual MSND - // resource we're looking for. This saves a lot of space from - // repeated data. - if (_vm->hasResource(ID_MJMP, id)) { - Common::SeekableReadStream *mjmpStream = _vm->getResource(ID_MJMP, id); - id = mjmpStream->readUint16LE(); - delete mjmpStream; - } - } - - return _vm->getResourceName(ID_MSND, id); -} - } // End of namespace Mohawk diff --git a/engines/mohawk/sound.h b/engines/mohawk/sound.h index 48d9c2a634..867be37652 100644 --- a/engines/mohawk/sound.h +++ b/engines/mohawk/sound.h @@ -119,8 +119,8 @@ public: Sound(MohawkEngine *vm); ~Sound(); + // Generic sound functions Audio::SoundHandle *playSound(uint16 id, byte volume = Audio::Mixer::kMaxChannelVolume, bool loop = false); - Audio::SoundHandle *replaceSound(uint16 id, byte volume = Audio::Mixer::kMaxChannelVolume, bool loop = false); void playSoundBlocking(uint16 id, byte volume = Audio::Mixer::kMaxChannelVolume); void playMidi(uint16 id); void stopMidi(); @@ -130,14 +130,15 @@ public: void resumeSound(); bool isPlaying(uint16 id); - // Myst background sound functions - Audio::SoundHandle *replaceBackground(uint16 id, uint16 volume = 0xFFFF); - void pauseBackground(); - void resumeBackground(); - void stopBackground(); - void changeBackgroundVolume(uint16 vol); + // Myst-specific sound functions + Audio::SoundHandle *replaceSoundMyst(uint16 id, byte volume = Audio::Mixer::kMaxChannelVolume, bool loop = false); + Audio::SoundHandle *replaceBackgroundMyst(uint16 id, uint16 volume = 0xFFFF); + void pauseBackgroundMyst(); + void resumeBackgroundMyst(); + void stopBackgroundMyst(); + void changeBackgroundVolumeMyst(uint16 vol); - // Riven-specific + // Riven-specific sound functions void playSLST(uint16 index, uint16 card); void playSLST(SLSTRecord slstRecord); void pauseSLST(); @@ -158,7 +159,7 @@ private: Common::Array<SndHandle> _handles; SndHandle *getHandle(); Audio::AudioStream *makeAudioStream(uint16 id); - Common::String getName(uint16 id); + uint16 convertMystID(uint16 id); // Riven-specific void playSLSTSound(uint16 index, bool fade, bool loop, uint16 volume, int16 balance); |