From 9e54089fe74940cf52bceefddb7e92928a4dcf28 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 29 Oct 2016 08:06:51 -0700 Subject: DIRECTOR: Mark current cast loading method as D2 --- engines/director/resource.cpp | 10 +++++++++- engines/director/score.cpp | 17 ++++++++++++----- engines/director/score.h | 3 ++- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp index 61e46e9a8d..bcf5db61bc 100644 --- a/engines/director/resource.cpp +++ b/engines/director/resource.cpp @@ -210,7 +210,15 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) { Score *castScore = new Score(this, shardcst); castScore->loadConfig(*shardcst->getResource(MKTAG('V','W','C','F'), 1024)); - castScore->loadCastData(*shardcst->getResource(MKTAG('V','W','C','R'), 1024)); + + if (getVersion() < 4) + castScore->loadCastDataD2(*shardcst->getResource(MKTAG('V','W','C','R'), 1024)); + + Common::Array cast = shardcst->getResourceIDList(MKTAG('C','A','S','t')); + if (cast.size() > 0) { + for (Common::Array::iterator iterator = cast.begin(); iterator != cast.end(); ++iterator) + castScore->loadCastData(*shardcst->getResource(MKTAG('C','A','S','t'), *iterator), *iterator); + } _sharedCasts = &castScore->_casts; diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 2bb538a91d..4519bfd71a 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -192,7 +192,7 @@ void Score::loadArchive() { if (_vm->getVersion() < 4) { assert(_movieArchive->hasResource(MKTAG('V','W','C','R'), 1024)); - loadCastData(*_movieArchive->getResource(MKTAG('V','W','C','R'), 1024)); + loadCastDataD2(*_movieArchive->getResource(MKTAG('V','W','C','R'), 1024)); } if (_movieArchive->hasResource(MKTAG('V','W','A','C'), 1024)) { @@ -209,12 +209,16 @@ void Score::loadArchive() { Common::Array vwci = _movieArchive->getResourceIDList(MKTAG('V','W','C','I')); if (vwci.size() > 0) { - Common::Array::iterator iterator; - - for (iterator = vwci.begin(); iterator != vwci.end(); ++iterator) + for (Common::Array::iterator iterator = vwci.begin(); iterator != vwci.end(); ++iterator) loadCastInfo(*_movieArchive->getResource(MKTAG('V','W','C','I'), *iterator), *iterator); } + Common::Array cast = _movieArchive->getResourceIDList(MKTAG('C','A','S','t')); + if (cast.size() > 0) { + for (Common::Array::iterator iterator = cast.begin(); iterator != cast.end(); ++iterator) + loadCastData(*_movieArchive->getResource(MKTAG('C','A','S','t'), *iterator), *iterator); + } + Common::Array stxt = _movieArchive->getResourceIDList(MKTAG('S','T','X','T')); if (stxt.size() > 0) { loadScriptText(*_movieArchive->getResource(MKTAG('S','T','X','T'), *stxt.begin())); @@ -343,7 +347,7 @@ void Score::readVersion(uint32 rid) { debug("Version: %d.%d", _versionMajor, _versionMinor); } -void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream) { +void Score::loadCastDataD2(Common::SeekableSubReadStreamEndian &stream) { debugC(1, kDebugLoading, "Score::loadCastData(). start: %d, end: %d", _castArrayStart, _castArrayEnd); for (uint16 id = _castArrayStart; id <= _castArrayEnd; id++) { @@ -388,6 +392,9 @@ void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream) { } } +void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream, uint16 id) { +} + void Score::loadLabels(Common::SeekableSubReadStreamEndian &stream) { _labels = new Common::SortedArray