diff options
author | Eugene Sandulenko | 2016-08-29 18:06:41 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-29 18:06:41 +0200 |
commit | ae54fb98db317ddbecefe4659eca3dc41da9576d (patch) | |
tree | 318e62d68ad028ab11d63cc4c4d100252ef9aaf8 /engines | |
parent | 3ff6dfee8bef8aa9af1a665d3131834883987ccd (diff) | |
download | scummvm-rg350-ae54fb98db317ddbecefe4659eca3dc41da9576d.tar.gz scummvm-rg350-ae54fb98db317ddbecefe4659eca3dc41da9576d.tar.bz2 scummvm-rg350-ae54fb98db317ddbecefe4659eca3dc41da9576d.zip |
DIRECTOR: Refactor Archive creation
Diffstat (limited to 'engines')
-rw-r--r-- | engines/director/director.cpp | 33 | ||||
-rw-r--r-- | engines/director/director.h | 3 |
2 files changed, 18 insertions, 18 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp index 7ce85c5ab6..44275f73b6 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -146,18 +146,13 @@ Common::HashMap<Common::String, Score *> DirectorEngine::loadMMMNames(Common::St if (!movies.empty()) { for (Common::FSList::const_iterator i = movies.begin(); i != movies.end(); ++i) { + debugC(2, kDebugLoading, "File: %s", i->getName().c_str()); if (Common::matchString(i->getName().c_str(), sharedMMMname, true)) { loadSharedCastsFrom(i->getPath()); continue; } - Archive *arc; - - if (getVersion() < 4) { - arc = new RIFFArchive(); - } else { - arc = new RIFXArchive(); - } + Archive *arc = createArchive(); arc->openFile(i->getPath()); Score *sc = new Score(this); @@ -168,6 +163,14 @@ Common::HashMap<Common::String, Score *> DirectorEngine::loadMMMNames(Common::St return nameMap; } +Archive *DirectorEngine::createArchive() { + if (getVersion() < 4) { + return new RIFFArchive(); + } else { + return new RIFXArchive(); + } +} + void DirectorEngine::loadEXE() { Common::SeekableReadStream *exeStream = SearchMan.createReadStreamForMember(getEXEName()); if (!exeStream) @@ -207,8 +210,8 @@ void DirectorEngine::loadEXEv3(Common::SeekableReadStream *stream) { Common::String mmmFileName = readPascalString(*stream); Common::String directoryName = readPascalString(*stream); - debug("Main MMM: '%s'", mmmFileName.c_str()); - debug("Directory Name: '%s'", directoryName.c_str()); + debugC(1, kDebugLoading, "Main MMM: '%s'", mmmFileName.c_str()); + debugC(1, kDebugLoading, "Directory Name: '%s'", directoryName.c_str()); _mainArchive = new RIFFArchive(); @@ -322,13 +325,7 @@ void DirectorEngine::setPalette(byte *palette, uint16 count) { } void DirectorEngine::loadSharedCastsFrom(Common::String filename) { - Archive *shardcst; - - if (getVersion() < 4) { - shardcst = new RIFFArchive(); - } else { - shardcst = new RIFXArchive(); - } + Archive *shardcst = createArchive(); shardcst->openFile(filename); @@ -343,7 +340,7 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) { if (dib.size() != 0) { Common::Array<uint16>::iterator iterator; for (iterator = dib.begin(); iterator != dib.end(); ++iterator) { - debug(3, "Shared DIB %d", *iterator); + debugC(3, kDebugLoading, "Shared DIB %d", *iterator); _sharedDIB->setVal(*iterator, shardcst->getResource(MKTAG('D','I','B',' '), *iterator)); } } @@ -353,7 +350,7 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) { if (stxt.size() != 0) { Common::Array<uint16>::iterator iterator; for (iterator = stxt.begin(); iterator != stxt.end(); ++iterator) { - debug(3, "Shared STXT %d", *iterator); + debugC(3, kDebugLoading, "Shared STXT %d", *iterator); _sharedSTXT->setVal(*iterator, shardcst->getResource(MKTAG('S','T','X','T'), *iterator)); } } diff --git a/engines/director/director.h b/engines/director/director.h index e0d5d82240..05ce34e7ca 100644 --- a/engines/director/director.h +++ b/engines/director/director.h @@ -80,6 +80,9 @@ public: const byte *getPalette() const { return _currentPalette; } uint16 getPaletteColorCount() const { return _currentPaletteLength; } void loadSharedCastsFrom(Common::String filename); + + Archive *createArchive(); + 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; } |