aboutsummaryrefslogtreecommitdiff
path: root/engines/director/score.cpp
diff options
context:
space:
mode:
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();