aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk/riven_scripts.cpp
diff options
context:
space:
mode:
authorBastien Bouclet2016-08-08 07:35:55 +0200
committerBastien Bouclet2016-08-11 19:53:20 +0200
commit2756d6226b1567dbe650284c56d93d722af906b2 (patch)
treec08237d5dd570950dff2e087d6f592183570848a /engines/mohawk/riven_scripts.cpp
parentaeee4888beb8ba15a32a438e4ac82c53d250e039 (diff)
downloadscummvm-rg350-2756d6226b1567dbe650284c56d93d722af906b2.tar.gz
scummvm-rg350-2756d6226b1567dbe650284c56d93d722af906b2.tar.bz2
scummvm-rg350-2756d6226b1567dbe650284c56d93d722af906b2.zip
MOHAWK: Add a Riven specific sound manager
- Add ambient sound fading - Fix ambient sound volume to use the list-level volume
Diffstat (limited to 'engines/mohawk/riven_scripts.cpp')
-rw-r--r--engines/mohawk/riven_scripts.cpp46
1 files changed, 18 insertions, 28 deletions
diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp
index caa235ec8b..3655452603 100644
--- a/engines/mohawk/riven_scripts.cpp
+++ b/engines/mohawk/riven_scripts.cpp
@@ -25,7 +25,7 @@
#include "mohawk/riven_external.h"
#include "mohawk/riven_graphics.h"
#include "mohawk/riven_scripts.h"
-#include "mohawk/sound.h"
+#include "mohawk/riven_sound.h"
#include "mohawk/video.h"
#include "common/memstream.h"
@@ -309,54 +309,44 @@ void RivenScript::switchCard(uint16 op, uint16 argc, uint16 *argv) {
// Command 3: play an SLST from the script
void RivenScript::playScriptSLST(uint16 op, uint16 argc, uint16 *argv) {
- SLSTRecord slstRecord;
int offset = 0, j = 0;
+ uint16 soundCount = argv[offset++];
+ SLSTRecord slstRecord;
slstRecord.index = 0; // not set by the scripts, so we set it to 0
- slstRecord.sound_count = argv[0];
- slstRecord.sound_ids = new uint16[slstRecord.sound_count];
-
- offset = slstRecord.sound_count;
+ slstRecord.soundIds.resize(soundCount);
- for (j = 0; j < slstRecord.sound_count; j++)
- slstRecord.sound_ids[j] = argv[offset++];
- slstRecord.fade_flags = argv[offset++];
+ for (j = 0; j < soundCount; j++)
+ slstRecord.soundIds[j] = argv[offset++];
+ slstRecord.fadeFlags = argv[offset++];
slstRecord.loop = argv[offset++];
- slstRecord.global_volume = argv[offset++];
+ slstRecord.globalVolume = argv[offset++];
slstRecord.u0 = argv[offset++];
- slstRecord.u1 = argv[offset++];
+ slstRecord.suspend = argv[offset++];
- slstRecord.volumes = new uint16[slstRecord.sound_count];
- slstRecord.balances = new int16[slstRecord.sound_count];
- slstRecord.u2 = new uint16[slstRecord.sound_count];
+ slstRecord.volumes.resize(soundCount);
+ slstRecord.balances.resize(soundCount);
+ slstRecord.u2.resize(soundCount);
- for (j = 0; j < slstRecord.sound_count; j++)
+ for (j = 0; j < soundCount; j++)
slstRecord.volumes[j] = argv[offset++];
- for (j = 0; j < slstRecord.sound_count; j++)
+ for (j = 0; j < soundCount; j++)
slstRecord.balances[j] = argv[offset++]; // negative = left, 0 = center, positive = right
- for (j = 0; j < slstRecord.sound_count; j++)
+ for (j = 0; j < soundCount; j++)
slstRecord.u2[j] = argv[offset++]; // Unknown
// Play the requested sound list
_vm->_sound->playSLST(slstRecord);
- _vm->_activatedSLST = true;
-
- delete[] slstRecord.sound_ids;
- delete[] slstRecord.volumes;
- delete[] slstRecord.balances;
- delete[] slstRecord.u2;
}
// Command 4: play local tWAV resource (twav_id, volume, block)
void RivenScript::playSound(uint16 op, uint16 argc, uint16 *argv) {
- byte volume = Sound::convertRivenVolume(argv[1]);
+ uint16 volume = argv[1];
+ bool playOnDraw = argv[2] == 1;
- if (argv[2] == 1)
- _vm->_sound->playSoundBlocking(argv[0], volume);
- else
- _vm->_sound->playSound(argv[0], volume);
+ _vm->_sound->playSound(argv[0], volume, playOnDraw);
}
// Command 7: set variable value (variable, value)