aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorScott Percival2019-12-22 14:22:46 +0800
committerScott Percival2019-12-23 08:58:14 +0800
commit1c13d5d6051e606ccabe733ba645e31c85533688 (patch)
treec83b7519eb9fc00b5acd08c2c1927ef070f4f212 /engines
parent86a3581847bc78f058a28f9a14bd8970b054893f (diff)
downloadscummvm-rg350-1c13d5d6051e606ccabe733ba645e31c85533688.tar.gz
scummvm-rg350-1c13d5d6051e606ccabe733ba645e31c85533688.tar.bz2
scummvm-rg350-1c13d5d6051e606ccabe733ba645e31c85533688.zip
DIRECTOR: Load compiled Lingo scripts based on cast id
Diffstat (limited to 'engines')
-rw-r--r--engines/director/score.cpp33
-rw-r--r--engines/director/score.h1
2 files changed, 12 insertions, 22 deletions
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index a75aed3060..acbccf145f 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -209,18 +209,6 @@ void Score::loadArchive() {
}
}
- // Try to load compiled Lingo scripts
- // FIXME. Disabled by default, requires --debugflags=bytecode for now
- if (_vm->getVersion() >= 4 && debugChannelSet(-1, kDebugBytecode)) {
- Common::Array<uint16> lscr = _movieArchive->getResourceIDList(MKTAG('L','s','c','r'));
- if (lscr.size() > 0) {
- debugC(2, kDebugLoading, "****** Loading %d Lscr resources", lscr.size());
-
- for (Common::Array<uint16>::iterator iterator = lscr.begin(); iterator != lscr.end(); ++iterator) {
- loadLingoScript(*_movieArchive->getResource(MKTAG('L','s','c','r'), *iterator));
- }
- }
- }
// Now process STXTs
Common::Array<uint16> stxt = _movieArchive->getResourceIDList(MKTAG('S','T','X','T'));
@@ -759,7 +747,19 @@ void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream, uint16 id,
ci->directory = castStrings[2];
ci->fileName = castStrings[3];
ci->type = castStrings[4];
+ }
+ // FIXME. Disabled by default, requires --debugflags=bytecode for now
+ if (_vm->getVersion() >= 4 && castType == kCastLingoScript && debugChannelSet(-1, kDebugBytecode)) {
+ // Try and load the compiled Lingo script associated with this cast
+ uint scriptId = (*_loadedScripts)[id]->_id - 1;
+ if (scriptId < _castScriptIds.size()) {
+ int resourceId = _castScriptIds[scriptId];
+ _lingo->addCodeV4(*_movieArchive->getResource(MKTAG('L', 's', 'c', 'r'), resourceId), kCastScript, id);
+ } else {
+ warning("Lingo context missing a resource entry for script %d referenced in cast %d", scriptId, id);
+ }
+ } else {
if (!ci->script.empty()) {
// the script type here could be wrong!
if (ConfMan.getBool("dump_scripts"))
@@ -948,15 +948,6 @@ void Score::loadLingoNames(Common::SeekableSubReadStreamEndian &stream) {
}
}
-void Score::loadLingoScript(Common::SeekableSubReadStreamEndian &stream) {
- if (_vm->getVersion() >= 4) {
- _lingo->addCodeV4(stream, kMovieScript, _movieScriptCount);
- } else {
- error("Score::loadLingoScript: unsuported Director version (%d)", _vm->getVersion());
- }
- _movieScriptCount++;
-}
-
void Score::loadLingoContext(Common::SeekableSubReadStreamEndian &stream) {
if (_vm->getVersion() >= 4) {
debugC(1, kDebugLingoCompile, "Add V4 script context");
diff --git a/engines/director/score.h b/engines/director/score.h
index d8c0e83f7a..dd5ca03d93 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -115,7 +115,6 @@ private:
void loadLabels(Common::SeekableSubReadStreamEndian &stream);
void loadActions(Common::SeekableSubReadStreamEndian &stream);
void loadLingoNames(Common::SeekableSubReadStreamEndian &stream);
- void loadLingoScript(Common::SeekableSubReadStreamEndian &stream);
void loadLingoContext(Common::SeekableSubReadStreamEndian &stream);
void loadScriptText(Common::SeekableSubReadStreamEndian &stream);
void loadFileInfo(Common::SeekableSubReadStreamEndian &stream);