diff options
author | Johannes Schickel | 2010-10-13 03:57:44 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-10-13 03:57:44 +0000 |
commit | 75e8452b6e6a2bf4fb2f588aa00b428a60d873b5 (patch) | |
tree | f29541d55309487a94bd1d38e8b53bb3dde9aec6 /engines/mohawk/riven_scripts.cpp | |
parent | 48ee83b88957dab86bc763e9ef21a70179fa8679 (diff) | |
parent | e9f50882ea5b6beeefa994040be9d3bab6a1f107 (diff) | |
download | scummvm-rg350-75e8452b6e6a2bf4fb2f588aa00b428a60d873b5.tar.gz scummvm-rg350-75e8452b6e6a2bf4fb2f588aa00b428a60d873b5.tar.bz2 scummvm-rg350-75e8452b6e6a2bf4fb2f588aa00b428a60d873b5.zip |
OPENGL: Merged from trunk, from rev 52105 to 53396.
This includes an rather hacky attempt to merge all the recent gp2x backend
changes into the branch. I suppose the gp2x backend and probably all new
backends, i.e. gph, dingux etc., might not compile anymore.
Since I have no way of testing those it would be nice if porters could look
into getting those up to speed in this branch.
svn-id: r53399
Diffstat (limited to 'engines/mohawk/riven_scripts.cpp')
-rw-r--r-- | engines/mohawk/riven_scripts.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp index 1fcaba8ac0..30d1d727eb 100644 --- a/engines/mohawk/riven_scripts.cpp +++ b/engines/mohawk/riven_scripts.cpp @@ -38,7 +38,7 @@ namespace Mohawk { RivenScript::RivenScript(MohawkEngine_Riven *vm, Common::SeekableReadStream *stream, uint16 scriptType, uint16 parentStack, uint16 parentCard) : _vm(vm), _stream(stream), _scriptType(scriptType), _parentStack(parentStack), _parentCard(parentCard) { setupOpcodes(); - _isRunning = false; + _isRunning = _continueRunning = false; } RivenScript::~RivenScript() { @@ -227,7 +227,7 @@ void RivenScript::dumpCommands(Common::StringArray varNames, Common::StringArray } void RivenScript::runScript() { - _isRunning = true; + _isRunning = _continueRunning = true; if (_stream->pos() != 0) _stream->seek(0); @@ -242,7 +242,7 @@ void RivenScript::processCommands(bool runCommands) { uint16 commandCount = _stream->readUint16BE(); - for (uint16 j = 0; j < commandCount && !_vm->shouldQuit() && _stream->pos() < _stream->size(); j++) { + for (uint16 j = 0; j < commandCount && !_vm->shouldQuit() && _stream->pos() < _stream->size() && _continueRunning; j++) { uint16 command = _stream->readUint16BE(); if (command == 8) { @@ -346,9 +346,14 @@ void RivenScript::playScriptSLST(uint16 op, uint16 argc, uint16 *argv) { _vm->_activatedSLST = true; } -// Command 4: play local tWAV resource (twav_id, volume, u1) +// Command 4: play local tWAV resource (twav_id, volume, block) void RivenScript::playSound(uint16 op, uint16 argc, uint16 *argv) { - _vm->_sound->playSound(argv[0], false); + byte volume = Sound::convertRivenVolume(argv[1]); + + if (argv[2] == 1) + _vm->_sound->playSoundBlocking(argv[0], volume); + else + _vm->_sound->playSound(argv[0], volume); } // Command 7: set variable value (variable, value) @@ -398,7 +403,7 @@ void RivenScript::changeCursor(uint16 op, uint16 argc, uint16 *argv) { void RivenScript::delay(uint16 op, uint16 argc, uint16 *argv) { debug(2, "Delay %dms", argv[0]); if (argv[0] > 0) - _vm->_system->delayMillis(argv[0]); + _vm->delayAndUpdate(argv[0]); } // Command 17: call external command @@ -572,7 +577,8 @@ void RivenScript::activateFLST(uint16 op, uint16 argc, uint16 *argv) { for (uint16 i = 0; i < recordCount; i++) { uint16 index = flst->readUint16BE(); uint16 sfxeID = flst->readUint16BE(); - if(flst->readUint16BE() != 0) + + if (flst->readUint16BE() != 0) warning("FLST u0 non-zero"); if (index == argv[0]) { @@ -632,6 +638,11 @@ RivenScriptList RivenScriptManager::readScripts(Common::SeekableReadStream *stre return scriptList; } +void RivenScriptManager::stopAllScripts() { + for (uint32 i = 0; i < _currentScripts.size(); i++) + _currentScripts[i]->stopRunning(); +} + void RivenScriptManager::unloadUnusedScripts() { // Free any scripts that aren't part of the current card and aren't running for (uint32 i = 0; i < _currentScripts.size(); i++) { |