aboutsummaryrefslogtreecommitdiff
path: root/engines/director/score.cpp
diff options
context:
space:
mode:
authorScott Percival2019-12-22 12:37:17 +0800
committerScott Percival2019-12-23 08:58:14 +0800
commit86a3581847bc78f058a28f9a14bd8970b054893f (patch)
treefa812ea4526b48cf67dee0c3277e3d2517cc2102 /engines/director/score.cpp
parent3ca1b8aac20e46f59f301c0b778a658c41e6b192 (diff)
downloadscummvm-rg350-86a3581847bc78f058a28f9a14bd8970b054893f.tar.gz
scummvm-rg350-86a3581847bc78f058a28f9a14bd8970b054893f.tar.bz2
scummvm-rg350-86a3581847bc78f058a28f9a14bd8970b054893f.zip
DIRECTOR: Add intial loader for Lctx blocks
Diffstat (limited to 'engines/director/score.cpp')
-rw-r--r--engines/director/score.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index b32b436506..a75aed3060 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -163,6 +163,18 @@ void Score::loadArchive() {
loadFontMap(*_movieArchive->getResource(MKTAG('V', 'W', 'F', 'M'), 1024));
}
+ // Try to load script context
+ if (_vm->getVersion() >= 4) {
+ Common::Array<uint16> lctx = _movieArchive->getResourceIDList(MKTAG('L','c','t','x'));
+ if (lctx.size() > 0) {
+ debugC(2, kDebugLoading, "****** Loading %d Lctx resources", lctx.size());
+
+ for (Common::Array<uint16>::iterator iterator = lctx.begin(); iterator != lctx.end(); ++iterator) {
+ loadLingoContext(*_movieArchive->getResource(MKTAG('L','c','t','x'), *iterator));
+ }
+ }
+ }
+
Common::Array<uint16> vwci = _movieArchive->getResourceIDList(MKTAG('V', 'W', 'C', 'I'));
if (vwci.size() > 0) {
debugC(2, kDebugLoading, "****** Loading %d CastInfos", vwci.size());
@@ -322,6 +334,7 @@ void Score::loadSpriteImages(bool isSharedCast) {
}
}
+
Score::~Score() {
if (_surface)
_surface->free();
@@ -944,6 +957,48 @@ void Score::loadLingoScript(Common::SeekableSubReadStreamEndian &stream) {
_movieScriptCount++;
}
+void Score::loadLingoContext(Common::SeekableSubReadStreamEndian &stream) {
+ if (_vm->getVersion() >= 4) {
+ debugC(1, kDebugLingoCompile, "Add V4 script context");
+
+ if (debugChannelSet(5, kDebugLoading)) {
+ debugC(5, kDebugLoading, "Lctx header:");
+ stream.hexdump(0x2a);
+ }
+
+ _castScriptIds.clear();
+
+ stream.readUint16();
+ stream.readUint16();
+ stream.readUint16();
+ stream.readUint16();
+ stream.readUint16();
+ uint16 itemCount = stream.readUint16();
+ stream.readUint16();
+ /*uint16 itemCount2 = */ stream.readUint16();
+ uint16 itemsOffset = stream.readUint16();
+
+ stream.seek(itemsOffset);
+ for (uint16 i = 0; i < itemCount; i++) {
+ if (debugChannelSet(5, kDebugLoading)) {
+ debugC(5, kDebugLoading, "Context entry %d:", i);
+ stream.hexdump(0xc);
+ }
+
+ stream.readUint16();
+ stream.readUint16();
+ stream.readUint16();
+ uint16 index = stream.readUint16();
+ stream.readUint16();
+ stream.readUint16();
+
+ _castScriptIds.push_back(index);
+ }
+ } else {
+ error("Score::loadLingoContext: unsuported Director version (%d)", _vm->getVersion());
+ }
+}
+
void Score::loadScriptText(Common::SeekableSubReadStreamEndian &stream) {
/*uint32 unk1 = */ stream.readUint32();
uint32 strLen = stream.readUint32();