aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Bouclet2010-12-18 13:13:49 +0000
committerBastien Bouclet2010-12-18 13:13:49 +0000
commit3e31ed6d98eb62e8b3d1e473d1536100b6532f05 (patch)
tree404e23518925bed9696b3ff73f58b5909ad02e00
parentc870bf22d1f4bd154267a31b6a24eeb6e85c34d7 (diff)
downloadscummvm-rg350-3e31ed6d98eb62e8b3d1e473d1536100b6532f05.tar.gz
scummvm-rg350-3e31ed6d98eb62e8b3d1e473d1536100b6532f05.tar.bz2
scummvm-rg350-3e31ed6d98eb62e8b3d1e473d1536100b6532f05.zip
MOHAWK: Myst sound rework, part 2
svn-id: r54954
-rw-r--r--engines/mohawk/myst_stacks/channelwood.cpp2
-rw-r--r--engines/mohawk/myst_stacks/intro.cpp2
-rw-r--r--engines/mohawk/myst_stacks/myst.cpp97
-rw-r--r--engines/mohawk/myst_stacks/preview.cpp2
-rw-r--r--engines/mohawk/myst_stacks/selenitic.cpp28
-rw-r--r--engines/mohawk/myst_stacks/stoneship.cpp4
6 files changed, 69 insertions, 66 deletions
diff --git a/engines/mohawk/myst_stacks/channelwood.cpp b/engines/mohawk/myst_stacks/channelwood.cpp
index b710b426b4..4ab5491240 100644
--- a/engines/mohawk/myst_stacks/channelwood.cpp
+++ b/engines/mohawk/myst_stacks/channelwood.cpp
@@ -85,7 +85,7 @@ void MystScriptParser_Channelwood::opcode_101(uint16 op, uint16 var, uint16 argc
uint16 soundId = argv[0];
debugC(kDebugScript, "\tsoundId: %d", soundId);
- _vm->_sound->playSound(soundId);
+ _vm->_sound->replaceSound(soundId);
// TODO: Get Movie Location from Invoking Resource Rect, rather than
// hardcoded 267, 170 ?
diff --git a/engines/mohawk/myst_stacks/intro.cpp b/engines/mohawk/myst_stacks/intro.cpp
index b2f5d927cb..875eb6fce1 100644
--- a/engines/mohawk/myst_stacks/intro.cpp
+++ b/engines/mohawk/myst_stacks/intro.cpp
@@ -87,7 +87,7 @@ void MystScriptParser_Intro::o_useLinkBook(uint16 op, uint16 var, uint16 argc, u
} else {
// Play Linking Sound, blocking...
_vm->_sound->stopSound();
- Audio::SoundHandle *handle = _vm->_sound->playSound(soundIdLinkSrc);
+ Audio::SoundHandle *handle = _vm->_sound->replaceSound(soundIdLinkSrc);
while (_vm->_mixer->isSoundHandleActive(*handle))
_vm->_system->delayMillis(10);
diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index aa0b08546a..e31418f3f6 100644
--- a/engines/mohawk/myst_stacks/myst.cpp
+++ b/engines/mohawk/myst_stacks/myst.cpp
@@ -657,9 +657,9 @@ void MystScriptParser_Myst::o_libraryBookPageTurnLeft(uint16 op, uint16 var, uin
_vm->_gfx->copyImageToScreen(_libraryBookBaseImage + _libraryBookPage, rect);
if (_vm->_rnd->getRandomBit())
- _vm->_sound->playSound(_libraryBookSound1);
+ _vm->_sound->replaceSound(_libraryBookSound1);
else
- _vm->_sound->playSound(_libraryBookSound2);
+ _vm->_sound->replaceSound(_libraryBookSound2);
_vm->_system->updateScreen();
}
@@ -675,9 +675,9 @@ void MystScriptParser_Myst::o_libraryBookPageTurnRight(uint16 op, uint16 var, ui
_vm->_gfx->copyImageToScreen(_libraryBookBaseImage + _libraryBookPage, rect);
if (_vm->_rnd->getRandomBit())
- _vm->_sound->playSound(_libraryBookSound1);
+ _vm->_sound->replaceSound(_libraryBookSound1);
else
- _vm->_sound->playSound(_libraryBookSound2);
+ _vm->_sound->replaceSound(_libraryBookSound2);
_vm->_system->updateScreen();
}
@@ -742,14 +742,14 @@ void MystScriptParser_Myst::opcode_105(uint16 op, uint16 var, uint16 argc, uint1
uint16 var10 = _vm->_varStore->getVar(10);
if (boxValue == 0x32 && var10 == 0) {
- handle = _vm->_sound->playSound(soundId);
+ handle = _vm->_sound->replaceSound(soundId);
while (_vm->_mixer->isSoundHandleActive(*handle))
_vm->_system->delayMillis(10);
_vm->_varStore->setVar(10, 1);
} else if (boxValue != 0x32 && var10 == 1) {
- handle = _vm->_sound->playSound(soundId);
+ handle = _vm->_sound->replaceSound(soundId);
while (_vm->_mixer->isSoundHandleActive(*handle))
_vm->_system->delayMillis(10);
@@ -845,7 +845,7 @@ void MystScriptParser_Myst::o_dockVaultOpen(uint16 op, uint16 var, uint16 argc,
else
_dockVaultState = 1;
- _vm->_sound->playSound(soundId);
+ _vm->_sound->replaceSound(soundId);
_vm->redrawArea(41, false);
animatedUpdate(directionalUpdateDataSize, &argv[3], delay);
}
@@ -873,7 +873,7 @@ void MystScriptParser_Myst::o_dockVaultClose(uint16 op, uint16 var, uint16 argc,
if (_dockVaultState == 1 || _dockVaultState == 2)
_dockVaultState = 0;
- _vm->_sound->playSound(soundId);
+ _vm->_sound->replaceSound(soundId);
_vm->redrawArea(41, false);
animatedUpdate(directionalUpdateDataSize, &argv[3], delay);
}
@@ -980,7 +980,7 @@ void MystScriptParser_Myst::o_clockWheelsExecute(uint16 op, uint16 var, uint16 a
&& myst.clockTowerMinutePosition == 40;
if (!myst.clockTowerBridgeOpen && correctTime) {
- _vm->_sound->playSound(soundId);
+ _vm->_sound->replaceSound(soundId);
_vm->_system->delayMillis(500);
// TODO: Play only 1st half of movie i.e. gears rise up, from 0 to 650
@@ -989,7 +989,7 @@ void MystScriptParser_Myst::o_clockWheelsExecute(uint16 op, uint16 var, uint16 a
myst.clockTowerBridgeOpen = 1;
_vm->redrawArea(12);
} else if (myst.clockTowerBridgeOpen && !correctTime) {
- _vm->_sound->playSound(soundId);
+ _vm->_sound->replaceSound(soundId);
_vm->_system->delayMillis(500);
// TODO: Play only 2nd half of movie i.e. gears sink down, from 700 to 1300
@@ -1006,9 +1006,9 @@ void MystScriptParser_Myst::opcode_117(uint16 op, uint16 var, uint16 argc, uint1
uint16 varValue = _vm->_varStore->getVar(var);
if (varValue)
- _vm->_sound->playSound(argv[1]);
+ _vm->_sound->replaceSound(argv[1]);
else
- _vm->_sound->playSound(argv[0]);
+ _vm->_sound->replaceSound(argv[0]);
_vm->_varStore->setVar(var, !varValue);
// TODO: Change Var 45 "Dock Forechamber Imager Water Effect Enabled" here?
@@ -1036,7 +1036,7 @@ void MystScriptParser_Myst::opcode_118(uint16 op, uint16 var, uint16 argc, uint1
debugC(kDebugScript, "\tsoundIdBeepTune: %d", soundIdBeepTune);
debugC(kDebugScript, "\tsoundIdPanelSlam: %d", soundIdPanelSlam);
- _vm->_sound->playSound(soundIdBeepLo);
+ _vm->_sound->replaceSound(soundIdBeepLo);
// TODO: Complete Logic...
} else
@@ -1082,14 +1082,16 @@ void MystScriptParser_Myst::o_generatorButtonPressed(uint16 op, uint16 var, uint
myst.generatorVoltage -= value;
if (myst.generatorVoltage)
- _vm->_sound->playSound(8297);
+ _vm->_sound->replaceSound(8297);
else
- _vm->_sound->playSound(9297);
+ _vm->_sound->replaceSound(9297);
} else {
if (_generatorVoltage)
- _vm->_sound->playSound(6297);
- else
- _vm->_sound->playSound(7297); //TODO: Replace with play sound and replace background 4297
+ _vm->_sound->replaceSound(6297);
+ else {
+ _vm->_sound->replaceSound(7297); //TODO: Replace with play sound and replace background 4297
+ _vm->_sound->replaceBackground(4297);
+ }
myst.generatorButtons |= mask;
myst.generatorVoltage += value;
@@ -1205,13 +1207,13 @@ void MystScriptParser_Myst::o_cabinSafeHandleMove(uint16 op, uint16 var, uint16
if (_tempVar == 0) {
uint16 soundId = handle->getList2(0);
if (soundId)
- _vm->_sound->playSound(soundId);
+ _vm->_sound->replaceSound(soundId);
}
// Combination is right
if (myst.cabinSafeCombination == 724) {
uint16 soundId = handle->getList2(1);
if (soundId)
- _vm->_sound->playSound(soundId);
+ _vm->_sound->replaceSound(soundId);
_vm->changeToCard(4103, false);
@@ -1265,7 +1267,7 @@ void MystScriptParser_Myst::opcode_133(uint16 op, uint16 var, uint16 argc, uint1
// etc.
// TODO: Sound seems to be stuck looping?
- _vm->_sound->playSound(soundId);
+ _vm->_sound->replaceSound(soundId);
} else
unknown(op, var, argc, argv);
}
@@ -1324,11 +1326,11 @@ void MystScriptParser_Myst::o_circuitBreakerMove(uint16 op, uint16 var, uint16 a
if (myst.generatorVoltage > 59 || myst.generatorBreakers != 1) {
uint16 soundId = breaker->getList2(1);
if (soundId)
- _vm->_sound->playSound(soundId);
+ _vm->_sound->replaceSound(soundId);
} else {
uint16 soundId = breaker->getList2(0);
if (soundId)
- _vm->_sound->playSound(soundId);
+ _vm->_sound->replaceSound(soundId);
// Reset breaker state
myst.generatorBreakers = 0;
@@ -1338,11 +1340,11 @@ void MystScriptParser_Myst::o_circuitBreakerMove(uint16 op, uint16 var, uint16 a
if (myst.generatorVoltage > 59 || myst.generatorBreakers != 2) {
uint16 soundId = breaker->getList2(1);
if (soundId)
- _vm->_sound->playSound(soundId);
+ _vm->_sound->replaceSound(soundId);
} else {
uint16 soundId = breaker->getList2(0);
if (soundId)
- _vm->_sound->playSound(soundId);
+ _vm->_sound->replaceSound(soundId);
// Reset breaker state
myst.generatorBreakers = 0;
@@ -1431,7 +1433,7 @@ void MystScriptParser_Myst::boilerPressureIncrease_run() {
}
// Pressure increasing sound
- _vm->_sound->playSound(5098);
+ _vm->_sound->replaceSound(5098);
// Redraw wheel
_vm->redrawArea(99);
@@ -1452,7 +1454,7 @@ void MystScriptParser_Myst::boilerPressureDecrease_run() {
}
// Pressure increasing sound
- _vm->_sound->playSound(5098);
+ _vm->_sound->replaceSound(5098);
// Redraw wheel
_vm->redrawArea(99);
@@ -1510,7 +1512,7 @@ void MystScriptParser_Myst::basementPressureIncrease_run() {
myst.cabinValvePosition++;
// Pressure increasing sound
- _vm->_sound->playSound(4642);
+ _vm->_sound->replaceSound(4642);
// Redraw wheel
_vm->redrawArea(99);
@@ -1525,7 +1527,7 @@ void MystScriptParser_Myst::basementPressureDecrease_run() {
myst.cabinValvePosition--;
// Pressure decreasing sound
- _vm->_sound->playSound(4642);
+ _vm->_sound->replaceSound(4642);
// Redraw wheel
_vm->redrawArea(99);
@@ -1572,17 +1574,18 @@ void MystScriptParser_Myst::tree_run() {
// Tree movement
if (goingDown) {
myst.treePosition--;
- _vm->_sound->playSound(2);
+ _vm->_sound->replaceSound(2);
} else {
myst.treePosition++;
- _vm->_sound->playSound(1);
+ _vm->_sound->replaceSound(1);
}
// Stop background music if going up from book room
- if (_vm->getCurCard() == 4630 && myst.treePosition > 0) {
- _vm->_sound->stopBackground();
- } else {
- _vm->_sound->replaceBackground(4630, 24576);
+ if (_vm->getCurCard() == 4630) {
+ if (myst.treePosition > 0)
+ _vm->_sound->stopBackground();
+ else
+ _vm->_sound->replaceBackground(4630, 24576);
}
// Redraw tree
@@ -1863,7 +1866,7 @@ void MystScriptParser_Myst::o_rocketLeverMove(uint16 op, uint16 var, uint16 argc
if (step == maxStep && step != _rocketLeverPosition) {
uint16 soundId = lever->getList2(0);
if (soundId)
- _vm->_sound->playSound(soundId);
+ _vm->_sound->replaceSound(soundId);
// If rocket correctly powered
if (myst.generatorVoltage == 59 && !myst.generatorBreakers) {
@@ -1975,7 +1978,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->playSound(4103);
+ _vm->_sound->replaceSound(4103);
// Match is lit
_cabinMatchState = 1;
@@ -2073,7 +2076,7 @@ void MystScriptParser_Myst::clockWheelStartTurn(uint16 wheel) {
MystResourceType11 *resource = static_cast<MystResourceType11 *>(_invokingResource);
uint16 soundId = resource->getList1(0);
if (soundId)
- _vm->_sound->playSound(soundId);
+ _vm->_sound->replaceSound(soundId);
// Turn wheel one step
if (wheel == 1) {
@@ -2136,9 +2139,9 @@ void MystScriptParser_Myst::libraryCombinationBookTurnLeft() {
_vm->_gfx->copyImageToScreen(_libraryBookBaseImage + _libraryBookPage, rect);
if (_vm->_rnd->getRandomBit())
- _vm->_sound->playSound(_libraryBookSound1);
+ _vm->_sound->replaceSound(_libraryBookSound1);
else
- _vm->_sound->playSound(_libraryBookSound2);
+ _vm->_sound->replaceSound(_libraryBookSound2);
_vm->_system->updateScreen();
}
@@ -2162,9 +2165,9 @@ void MystScriptParser_Myst::libraryCombinationBookTurnRight() {
_vm->_gfx->copyImageToScreen(_libraryBookBaseImage + _libraryBookPage, rect);
if (_vm->_rnd->getRandomBit())
- _vm->_sound->playSound(_libraryBookSound1);
+ _vm->_sound->replaceSound(_libraryBookSound1);
else
- _vm->_sound->playSound(_libraryBookSound2);
+ _vm->_sound->replaceSound(_libraryBookSound2);
_vm->_system->updateScreen();
}
@@ -2222,12 +2225,12 @@ void MystScriptParser_Myst::o_dockVaultForceClose(uint16 op, uint16 var, uint16
if (_dockVaultState) {
// Open switch
myst.dockMarkerSwitch = 1;
- _vm->_sound->playSound(4143);
+ _vm->_sound->replaceSound(4143);
_vm->redrawArea(4);
// Close vault
_dockVaultState = 0;
- _vm->_sound->playSound(soundId);
+ _vm->_sound->replaceSound(soundId);
_vm->redrawArea(41, false);
animatedUpdate(directionalUpdateDataSize, &argv[3], delay);
}
@@ -2289,7 +2292,7 @@ void MystScriptParser_Myst::opcode_201_run() {
uint16 var105 = _vm->_varStore->getVar(105);
if (var105 && !g_opcode201Parameters.lastVar105)
- _vm->_sound->playSound(g_opcode201Parameters.soundId);
+ _vm->_sound->replaceSound(g_opcode201Parameters.soundId);
g_opcode201Parameters.lastVar105 = var105;
}
@@ -2316,7 +2319,7 @@ void MystScriptParser_Myst::opcode_201(uint16 op, uint16 var, uint16 argc, uint1
void MystScriptParser_Myst::towerRotationMap_run() {
if (!_towerRotationMapInitialized) {
_towerRotationMapInitialized = true;
- _vm->_sound->playSound(4378);
+ _vm->_sound->replaceSound(4378);
towerRotationDrawBuildings();
@@ -2529,7 +2532,7 @@ void MystScriptParser_Myst::libraryBookcaseTransform_run(void) {
_libraryBookcaseMoving = false;
// Play transform sound and video
- _vm->_sound->playSound(_libraryBookcaseSoundId);
+ _vm->_sound->replaceSound(_libraryBookcaseSoundId);
_libraryBookcaseMovie->playMovie();
}
}
diff --git a/engines/mohawk/myst_stacks/preview.cpp b/engines/mohawk/myst_stacks/preview.cpp
index 64d0898000..6afb14b981 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->playSound(3001);
+ _vm->_sound->replaceSound(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 161c90b6f5..38b457e0cb 100644
--- a/engines/mohawk/myst_stacks/selenitic.cpp
+++ b/engines/mohawk/myst_stacks/selenitic.cpp
@@ -579,7 +579,7 @@ void MystScriptParser_Selenitic::mazeRunnerPlaySoundHelp() {
soundId = 2191;
if (soundId)
- _vm->_sound->playSound(soundId);
+ _vm->_sound->replaceSound(soundId);
_mazeRunnerLight->drawConditionalDataToScreen(0);
}
@@ -623,17 +623,17 @@ void MystScriptParser_Selenitic::o_soundReceiverSigma(uint16 op, uint16 var, uin
}
_soundReceiverPosition = &selenitic.soundReceiverPositions[source];
- _vm->_sound->stopSound();
- _vm->_sound->playSound(2287);
+ _vm->_sound->stopBackground();
+ _vm->_sound->replaceSound(2287);
soundReceiverDrawView();
uint16 soundId = soundReceiverCurrentSound(source, *_soundReceiverPosition);
- _vm->_sound->replaceSound(soundId);
+ _vm->_sound->replaceBackground(soundId);
_vm->_system->delayMillis(1000);
}
_soundReceiverPosition = oldPosition;
_soundReceiverSigmaPressed = true;
- _vm->_sound->stopSound();
+ _vm->_sound->stopBackground();
_soundReceiverSources[selenitic.soundReceiverCurrentSource]->drawConditionalDataToScreen(1);
@@ -738,7 +738,8 @@ void MystScriptParser_Selenitic::o_soundReceiverSource(uint16 op, uint16 var, ui
_vm->_sound->stopSound();
uint16 soundId = argv[0];
- _vm->_sound->playSound(soundId);
+ _vm->_sound->stopBackground();
+ _vm->_sound->replaceSound(soundId);
_soundReceiverCurrentSource->drawConditionalDataToScreen(1);
@@ -755,11 +756,11 @@ void MystScriptParser_Selenitic::o_mazeRunnerDoorButton(uint16 op, uint16 var, u
if (_mazeRunnerPosition == 288) {
_vm->changeToCard(cardIdEntry, false);
- _vm->_sound->playSound(cardIdEntry);
+ _vm->_sound->replaceSound(cardIdEntry);
animatedUpdate(argv[2], &argv[3], 10);
} else if (_mazeRunnerPosition == 289) {
_vm->changeToCard(cardIdExit, false);
- _vm->_sound->playSound(cardIdExit);
+ _vm->_sound->replaceSound(cardIdExit);
animatedUpdate(argv[2], &argv[3], 10);
}
}
@@ -877,15 +878,14 @@ void MystScriptParser_Selenitic::o_soundLockEndMove(uint16 op, uint16 var, uint1
uint16 soundId = slider->getList3(0);
if (soundId)
- _vm->_sound->playSound(soundId);
+ _vm->_sound->replaceSound(soundId);
- _vm->_sound->stopSound();
_vm->_sound->resumeBackground();
}
void MystScriptParser_Selenitic::soundLockCheckSolution(MystResourceType10 *slider, uint16 value, uint16 solution, bool &solved) {
slider->drawConditionalDataToScreen(2);
- _vm->_sound->playSound(soundLockCurrentSound(value / 12, false));
+ _vm->_sound->replaceSound(soundLockCurrentSound(value / 12, false));
_vm->_system->delayMillis(1500);
if (value / 12 != solution) {
@@ -903,7 +903,7 @@ void MystScriptParser_Selenitic::o_soundLockButton(uint16 op, uint16 var, uint16
bool solved = true;
_vm->_sound->pauseBackground();
- _vm->_sound->playSound(1147);
+ _vm->_sound->replaceSound(1147);
_soundLockButton->drawConditionalDataToScreen(1);
_vm->_cursor->hideCursor();
@@ -913,7 +913,7 @@ void MystScriptParser_Selenitic::o_soundLockButton(uint16 op, uint16 var, uint16
soundLockCheckSolution(_soundLockSlider4, selenitic.soundLockSliderPositions[3], 6, solved);
soundLockCheckSolution(_soundLockSlider5, selenitic.soundLockSliderPositions[4], 7, solved);
- _vm->_sound->playSound(1148);
+ _vm->_sound->replaceSound(1148);
_vm->_sound->resumeBackground();
if (solved) {
@@ -925,7 +925,7 @@ void MystScriptParser_Selenitic::o_soundLockButton(uint16 op, uint16 var, uint16
_vm->changeToCard(cardIdClosed, true);
_vm->changeToCard(cardIdOpen, false);
- _vm->_sound->playSound(argv[2]);
+ _vm->_sound->replaceSound(argv[2]);
animatedUpdate(argv[4], &argv[5], argv[3]);
} else {
diff --git a/engines/mohawk/myst_stacks/stoneship.cpp b/engines/mohawk/myst_stacks/stoneship.cpp
index 8979a2561d..0dcfccd66d 100644
--- a/engines/mohawk/myst_stacks/stoneship.cpp
+++ b/engines/mohawk/myst_stacks/stoneship.cpp
@@ -553,8 +553,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->playSound(soundId);
- _vm->_sound->playSound(soundIdStopping);
+ _vm->_sound->replaceSound(soundId);
+ _vm->_sound->replaceSound(soundIdStopping);
}
} else
unknown(op, var, argc, argv);