diff options
author | Eugene Sandulenko | 2020-01-01 14:50:53 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2020-01-01 14:50:53 +0100 |
commit | 693149ee56a4fd32dc8fff79b1f033bf244c9563 (patch) | |
tree | dc5755cd15a6fe9c6b51f64fdccbceff8ace7d16 | |
parent | f263ed4bb63dca26a73790eb12ec908e75e5818a (diff) | |
download | scummvm-rg350-693149ee56a4fd32dc8fff79b1f033bf244c9563.tar.gz scummvm-rg350-693149ee56a4fd32dc8fff79b1f033bf244c9563.tar.bz2 scummvm-rg350-693149ee56a4fd32dc8fff79b1f033bf244c9563.zip |
DIRECTOR: Load Shared Cast from movie directory
-rw-r--r-- | engines/director/director.cpp | 8 | ||||
-rw-r--r-- | engines/director/director.h | 2 | ||||
-rw-r--r-- | engines/director/resource.cpp | 19 | ||||
-rw-r--r-- | engines/director/util.cpp | 9 | ||||
-rw-r--r-- | engines/director/util.h | 2 |
5 files changed, 39 insertions, 1 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp index 7862fb0dfd..848553b4b8 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -35,6 +35,7 @@ #include "director/score.h" #include "director/sound.h" #include "director/lingo/lingo.h" +#include "director/util.h" namespace Director { @@ -153,6 +154,7 @@ Common::Error DirectorEngine::run() { //_mainArchive->openFile("bookshelf_example.mmm"); _currentScore = new Score(this); + _currentPath = getPath(getEXEName()); if (getVersion() < 4) { if (getPlatform() == Common::kPlatformWindows) { @@ -168,7 +170,7 @@ Common::Error DirectorEngine::run() { _sharedCastFile = "Shared.dir"; } - loadSharedCastsFrom(_sharedCastFile); + loadSharedCastsFrom(_currentPath + _sharedCastFile); debug(0, "\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\nObtaining score name\n"); loadInitialMovie(getEXEName()); @@ -208,6 +210,10 @@ Common::Error DirectorEngine::run() { delete _currentScore; + _currentPath = getPath(_nextMovie.movie); + + loadSharedCastsFrom(_currentPath + _sharedCastFile); + Archive *mov = openMainArchive(_nextMovie.movie); if (!mov) { diff --git a/engines/director/director.h b/engines/director/director.h index 4575df3fd5..3b0a647800 100644 --- a/engines/director/director.h +++ b/engines/director/director.h @@ -105,6 +105,7 @@ public: const byte *getPalette() const { return _currentPalette; } uint16 getPaletteColorCount() const { return _currentPaletteLength; } void loadSharedCastsFrom(Common::String filename); + void clearSharedCast(); void loadPatterns(); Graphics::MacPatterns &getPatterns(); @@ -165,6 +166,7 @@ private: Lingo *_lingo; Score *_currentScore; + Common::String _currentPath; Graphics::MacPatterns _director3Patterns; Graphics::MacPatterns _director3QuickDrawPatterns; diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp index a735ab3fc6..73d08d9fe3 100644 --- a/engines/director/resource.cpp +++ b/engines/director/resource.cpp @@ -248,7 +248,26 @@ void DirectorEngine::loadMac(const Common::String movie) { } } +void DirectorEngine::clearSharedCast() { + if (!_sharedScore) + return; + + delete _sharedScore; + + delete _sharedDIB; + delete _sharedSTXT; + delete _sharedSound; + delete _sharedBMP; +} + void DirectorEngine::loadSharedCastsFrom(Common::String filename) { + if (_sharedScore) { + if (_sharedScore->_movieArchive->getFileName().equalsIgnoreCase(filename)) + return; + } + + clearSharedCast(); + Archive *shardcst = createArchive(); debug(0, "\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); diff --git a/engines/director/util.cpp b/engines/director/util.cpp index 55a9893dfc..1774630b95 100644 --- a/engines/director/util.cpp +++ b/engines/director/util.cpp @@ -142,4 +142,13 @@ Common::String convertPath(Common::String &path) { return res; } +Common::String getPath(Common::String path) { + const char *s; + if ((s = strrchr(path.c_str(), '/'))) { + return Common::String(path.c_str(), s + 1); + } + + return ""; +} + } // End of namespace Director diff --git a/engines/director/util.h b/engines/director/util.h index e5ce0f5355..0d06ee36da 100644 --- a/engines/director/util.h +++ b/engines/director/util.h @@ -36,6 +36,8 @@ Common::String *toLowercaseMac(Common::String *s); Common::String convertPath(Common::String &path); +Common::String getPath(Common::String path); + void processQuitEvent(); // events.cpp } // End of namespace Director |