From 4b871b62e5fea82517301c7377118244420723d7 Mon Sep 17 00:00:00 2001 From: Dmitry Iskrich Date: Tue, 28 Jun 2016 20:33:14 +0300 Subject: DIRECTOR: Renew shared resources when loading new folder --- engines/director/director.cpp | 16 ++++++++++++++++ engines/director/director.h | 4 ++++ engines/director/score.cpp | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/director/director.cpp b/engines/director/director.cpp index af0f87bd19..0c63525c53 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -56,6 +56,8 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam _mainArchive = 0; _macBinary = 0; _currentPalette = 0; + //FIXME + _sharedMMM = "SHARDCST.MMM"; _movies = new Common::HashMap(); const Common::FSNode gameDataDir(ConfMan.get("path")); @@ -210,6 +212,11 @@ Common::HashMap DirectorEngine::loadMMMNames(Common::St if (!movies.empty()) { for (Common::FSList::const_iterator i = movies.begin(); i != movies.end(); ++i) { + if (i->getName() == _sharedMMM) { + loadSharedCastsFrom(i->getPath()); + continue; + } + RIFFArchive *arc = new RIFFArchive(); arc->openFile(i->getPath()); Score *sc = new Score(this); @@ -402,6 +409,15 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) { _sharedSTXT[*iterator] = shardcst->getResource(MKTAG('S','T','X','T'), *iterator); } } + + Common::Array sound = shardcst->getResourceIDList(MKTAG('S','N','D',' ')); + + if (stxt.size() != 0) { + Common::Array::iterator iterator; + for (iterator = sound.begin(); iterator != sound.end(); ++iterator) { + _sharedSTXT[*iterator] = shardcst->getResource(MKTAG('S','N','D',' '), *iterator); + } + } } } // End of namespace Director diff --git a/engines/director/director.h b/engines/director/director.h index 0e76cd9ea8..82c43fd90c 100644 --- a/engines/director/director.h +++ b/engines/director/director.h @@ -91,9 +91,13 @@ private: void loadMac(); Common::String readPascalString(Common::SeekableReadStream &stream); + + Common::String _sharedMMM; Common::HashMap _sharedCasts; Common::HashMap _sharedDIB; Common::HashMap _sharedSTXT; + Common::HashMap _sharedSound; + Archive *_mainArchive; Common::MacResManager *_macBinary; DirectorSound *_soundManager; diff --git a/engines/director/score.cpp b/engines/director/score.cpp index b334caf2bf..7b26a952e2 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -676,7 +676,7 @@ void Score::update() { Common::SortedArray