diff options
author | Eugene Sandulenko | 2016-08-30 09:55:20 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-30 09:55:20 +0200 |
commit | c207d703fea29f9630e4776b14d78eb8138b1aa3 (patch) | |
tree | b1a1915b82e42a57670915325aa89c8e274ced54 | |
parent | 736f5e61db244a62c03eb1dfcfa3786f4005255a (diff) | |
download | scummvm-rg350-c207d703fea29f9630e4776b14d78eb8138b1aa3.tar.gz scummvm-rg350-c207d703fea29f9630e4776b14d78eb8138b1aa3.tar.bz2 scummvm-rg350-c207d703fea29f9630e4776b14d78eb8138b1aa3.zip |
DIRECTOR: Fixed shared cast loading
-rw-r--r-- | engines/director/archive.cpp | 29 | ||||
-rw-r--r-- | engines/director/director.cpp | 4 | ||||
-rw-r--r-- | engines/director/score.cpp | 2 | ||||
-rw-r--r-- | engines/director/score.h | 2 |
4 files changed, 19 insertions, 18 deletions
diff --git a/engines/director/archive.cpp b/engines/director/archive.cpp index 4d85d33d4a..5b22b45734 100644 --- a/engines/director/archive.cpp +++ b/engines/director/archive.cpp @@ -196,21 +196,22 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) { shardcst->openFile(filename); + _sharedDIB = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>; + _sharedSTXT = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>; + _sharedSound = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>; + _sharedBMP = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>; + Score *castScore = new Score(this, shardcst); - Common::Array<uint16> cast = shardcst->getResourceIDList(MKTAG('V','W','C','R')); - if (cast.size() == 1) { - for (Common::Array<uint16>::iterator iterator = cast.begin(); iterator != cast.end(); ++iterator) { - debugC(3, kDebugLoading, "Shared VWCR %d", *iterator); - castScore->loadCastData(*shardcst->getResource(MKTAG('V','W','C','R'), *iterator)); - *_sharedCasts = castScore->_casts; - } - } else { - error("Incorrect number of VWCR in shared cast '%s': %d", filename.c_str(), cast.size()); - } + castScore->loadConfig(*shardcst->getResource(MKTAG('V','W','C','F'), 1024)); + castScore->loadCastData(*shardcst->getResource(MKTAG('V','W','C','R'), 1024)); + + _sharedCasts = &castScore->_casts; Common::Array<uint16> dib = shardcst->getResourceIDList(MKTAG('D','I','B',' ')); if (dib.size() != 0) { + debugC(3, kDebugLoading, "Loading %d DIBs", dib.size()); + for (Common::Array<uint16>::iterator iterator = dib.begin(); iterator != dib.end(); ++iterator) { debugC(3, kDebugLoading, "Shared DIB %d", *iterator); _sharedDIB->setVal(*iterator, shardcst->getResource(MKTAG('D','I','B',' '), *iterator)); @@ -219,6 +220,8 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) { Common::Array<uint16> stxt = shardcst->getResourceIDList(MKTAG('S','T','X','T')); if (stxt.size() != 0) { + debugC(3, kDebugLoading, "Loading %d STXTs", stxt.size()); + for (Common::Array<uint16>::iterator iterator = stxt.begin(); iterator != stxt.end(); ++iterator) { debugC(3, kDebugLoading, "Shared STXT %d", *iterator); _sharedSTXT->setVal(*iterator, shardcst->getResource(MKTAG('S','T','X','T'), *iterator)); @@ -227,16 +230,16 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) { Common::Array<uint16> bmp = shardcst->getResourceIDList(MKTAG('B','I','T','D')); if (bmp.size() != 0) { + debugC(3, kDebugLoading, "Loading %d BITDs", bmp.size()); for (Common::Array<uint16>::iterator iterator = bmp.begin(); iterator != bmp.end(); ++iterator) { _sharedBMP->setVal(*iterator, shardcst->getResource(MKTAG('B','I','T','D'), *iterator)); } } Common::Array<uint16> sound = shardcst->getResourceIDList(MKTAG('S','N','D',' ')); - if (stxt.size() != 0) { - Common::Array<uint16>::iterator iterator; - for (iterator = sound.begin(); iterator != sound.end(); ++iterator) { + debugC(3, kDebugLoading, "Loading %d SNDs", sound.size()); + for (Common::Array<uint16>::iterator iterator = sound.begin(); iterator != sound.end(); ++iterator) { _sharedSound->setVal(*iterator, shardcst->getResource(MKTAG('S','N','D',' '), *iterator)); } } diff --git a/engines/director/director.cpp b/engines/director/director.cpp index f868c9ac0c..1e46d2bbb0 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -47,10 +47,6 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam syncSoundSettings(); _sharedCasts = nullptr; - _sharedSound = nullptr; - _sharedBMP = nullptr; - _sharedSTXT = nullptr; - _sharedDIB = nullptr; _currentScore = nullptr; _soundManager = nullptr; diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 8278c2864f..6d6d02274c 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -272,6 +272,8 @@ void Score::readVersion(uint32 rid) { } void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream) { + debugC(1, kDebugLoading, "Score::loadCastData(). start: %d, end: %d", _castArrayStart, _castArrayEnd); + for (uint16 id = _castArrayStart; id <= _castArrayEnd; id++) { byte size = stream.readByte(); if (size == 0) diff --git a/engines/director/score.h b/engines/director/score.h index 35e6f975ea..a9ac1f97de 100644 --- a/engines/director/score.h +++ b/engines/director/score.h @@ -183,6 +183,7 @@ public: void startLoop(); void processEvents(); Archive *getArchive() const { return _movieArchive; }; + void loadConfig(Common::SeekableSubReadStreamEndian &stream); void loadCastData(Common::SeekableSubReadStreamEndian &stream); void setCurrentFrame(uint16 frameId) { _currentFrame = frameId; } Common::String getMacName() const { return _macName; } @@ -190,7 +191,6 @@ public: private: void update(); void readVersion(uint32 rid); - void loadConfig(Common::SeekableSubReadStreamEndian &stream); void loadPalette(Common::SeekableSubReadStreamEndian &stream); void loadFrames(Common::SeekableSubReadStreamEndian &stream); void loadLabels(Common::SeekableSubReadStreamEndian &stream); |