diff options
-rw-r--r-- | engines/director/director.cpp | 12 | ||||
-rw-r--r-- | engines/director/director.h | 5 | ||||
-rw-r--r-- | engines/director/resource.cpp | 15 |
3 files changed, 18 insertions, 14 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp index a1ee253087..1f0c89780e 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -59,7 +59,7 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam // Load Patterns loadPatterns(); - _sharedCasts = nullptr; + _sharedScore = nullptr; _currentScore = nullptr; _soundManager = nullptr; @@ -67,7 +67,7 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam _currentPaletteLength = 0; _lingo = nullptr; - _sharedCasts = nullptr; + _sharedScore = nullptr; _sharedSound = nullptr; _sharedBMP = nullptr; _sharedSTXT = nullptr; @@ -100,6 +100,7 @@ DirectorEngine::~DirectorEngine() { delete _sharedBMP; delete _sharedSTXT; delete _sharedDIB; + delete _sharedScore; delete _currentScore; @@ -242,4 +243,11 @@ Common::HashMap<Common::String, Score *> *DirectorEngine::scanMovies(const Commo return nameMap; } +Common::HashMap<int, Cast *> *DirectorEngine::getSharedCasts() { + if (_sharedScore) + return &_sharedScore->_casts; + + return &_dummyCast; +} + } // End of namespace Director diff --git a/engines/director/director.h b/engines/director/director.h index 1c3d77fc71..5b1e9b36eb 100644 --- a/engines/director/director.h +++ b/engines/director/director.h @@ -105,7 +105,7 @@ public: Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *getSharedDIB() const { return _sharedDIB; } Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *getSharedBMP() const { return _sharedBMP; } Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *getSharedSTXT() const { return _sharedSTXT; } - Common::HashMap<int, Cast *> *getSharedCasts() const { return _sharedCasts; } + Common::HashMap<int, Cast *> *getSharedCasts(); Common::HashMap<Common::String, Score *> *_movies; @@ -138,7 +138,7 @@ private: void loadEXERIFX(Common::SeekableReadStream *stream, uint32 offset); void loadMac(const Common::String movie); - Common::HashMap<int, Cast *> *_sharedCasts; + Score *_sharedScore; Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *_sharedDIB; Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *_sharedSTXT; Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *_sharedSound; @@ -157,6 +157,7 @@ private: Graphics::MacPatterns _director3QuickDrawPatterns; Common::String _sharedCastFile; + Common::HashMap<int, Cast *> _dummyCast; private: void testFontScaling(); diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp index 9ceb95ba74..3db6d66a13 100644 --- a/engines/director/resource.cpp +++ b/engines/director/resource.cpp @@ -205,8 +205,6 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) { if (!shardcst->openFile(filename)) { warning("No shared cast %s", filename.c_str()); - _sharedCasts = new Common::HashMap<int, Cast *>; - return; } @@ -214,8 +212,7 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) { _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); + _sharedScore = new Score(this, shardcst); if (shardcst->hasResource(MKTAG('F', 'O', 'N', 'D'), -1)) { debug("Shared cast has fonts. Loading...."); @@ -223,20 +220,18 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) { _wm->_fontMan->loadFonts(filename); } - castScore->loadConfig(*shardcst->getResource(MKTAG('V','W','C','F'), 1024)); + _sharedScore->loadConfig(*shardcst->getResource(MKTAG('V','W','C','F'), 1024)); if (getVersion() < 4) - castScore->loadCastDataVWCR(*shardcst->getResource(MKTAG('V','W','C','R'), 1024)); + _sharedScore->loadCastDataVWCR(*shardcst->getResource(MKTAG('V','W','C','R'), 1024)); Common::Array<uint16> cast = shardcst->getResourceIDList(MKTAG('C','A','S','t')); if (cast.size() > 0) { for (Common::Array<uint16>::iterator iterator = cast.begin(); iterator != cast.end(); ++iterator) - castScore->loadCastData(*shardcst->getResource(MKTAG('C','A','S','t'), *iterator), *iterator, NULL); + _sharedScore->loadCastData(*shardcst->getResource(MKTAG('C','A','S','t'), *iterator), *iterator, NULL); } - castScore->setSpriteCasts(); - - _sharedCasts = &castScore->_casts; + _sharedScore->setSpriteCasts(); Common::Array<uint16> dib = shardcst->getResourceIDList(MKTAG('D','I','B',' ')); if (dib.size() != 0) { |