diff options
author | Dmitry Iskrich | 2016-06-16 22:16:27 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | 23c79a2786aad39251768bd644779607a04682ca (patch) | |
tree | 81653f78e07fc50ce4298d018bd1f1d290cd32a1 | |
parent | 2f8640c33a3bbff0dc8f6c8483211ac782297cb4 (diff) | |
download | scummvm-rg350-23c79a2786aad39251768bd644779607a04682ca.tar.gz scummvm-rg350-23c79a2786aad39251768bd644779607a04682ca.tar.bz2 scummvm-rg350-23c79a2786aad39251768bd644779607a04682ca.zip |
DIRECTOR: Add parsing mac names from folder
-rw-r--r-- | engines/director/director.cpp | 25 | ||||
-rw-r--r-- | engines/director/director.h | 4 | ||||
-rw-r--r-- | engines/director/lingo/lingo.cpp | 2 | ||||
-rw-r--r-- | engines/director/score.cpp | 18 |
4 files changed, 41 insertions, 8 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp index 7b7227e597..7808d52040 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -31,6 +31,7 @@ #include "common/stream.h" #include "common/system.h" #include "common/textconsole.h" +#include "common/fs.h" #include "engines/util.h" @@ -85,9 +86,11 @@ Common::Error DirectorEngine::run() { _mainArchive->openFile("bookshelf_example.mmm"); Score score(*_mainArchive, *_lingo, *_soundManager); + debug(0, "Score name %s", score.getMacName().c_str()); + score.loadArchive(); score.startLoop(); - debug(0, "Score name %s", score.getMacName().c_str()); + if (getPlatform() == Common::kPlatformWindows) loadEXE(); else @@ -96,6 +99,25 @@ Common::Error DirectorEngine::run() { return Common::kNoError; } +Common::HashMap<Common::String, Score *> DirectorEngine::loadMMMNames(Common::String folder) { + Common::FSNode directory(folder); + Common::FSList movies; + + Common::HashMap<Common::String, Score *> nameMap; + directory.getChildren(movies, Common::FSNode::kListFilesOnly); + + if (!movies.empty()) { + for (Common::FSList::const_iterator i = movies.begin(); i != movies.end(); ++i) { + RIFFArchive *arc = new RIFFArchive(); + arc->openFile(i->getPath()); + Score *sc = new Score(*arc, *_lingo, *_soundManager); + nameMap[sc->getMacName()] = sc; + } + } + + return nameMap; +} + void DirectorEngine::loadEXE() { Common::SeekableReadStream *exeStream = SearchMan.createReadStreamForMember(getEXEName()); if (!exeStream) @@ -126,7 +148,6 @@ void DirectorEngine::loadEXE() { void DirectorEngine::loadEXEv3(Common::SeekableReadStream *stream) { uint16 entryCount = stream->readUint16LE(); - if (entryCount != 1) error("Unhandled multiple entry v3 EXE"); diff --git a/engines/director/director.h b/engines/director/director.h index 7e3117d4d5..9a961b78e7 100644 --- a/engines/director/director.h +++ b/engines/director/director.h @@ -25,6 +25,8 @@ #include "common/scummsys.h" +#include "common/str.h" +#include "common/hashmap.h" #include "engines/engine.h" #include "engines/director/sound.h" @@ -41,6 +43,7 @@ enum DirectorGameID { class Archive; struct DirectorGameDescription; class Lingo; +class Score; class DirectorEngine : public ::Engine { @@ -64,6 +67,7 @@ protected: private: const DirectorGameDescription *_gameDescription; + Common::HashMap<Common::String, Score *> loadMMMNames(Common::String folder); void loadEXE(); void loadEXEv3(Common::SeekableReadStream *stream); void loadEXEv4(Common::SeekableReadStream *stream); diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index e338c3d646..d7bd1dca87 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -81,6 +81,8 @@ Lingo::~Lingo() { void Lingo::addCode(Common::String code, ScriptType type, uint16 id) { debug(0, "Add code %s for type %d with id %d", code.c_str(), type, id); + //FIXME + return; if (_scripts[type].contains(id)) { free(_scripts[type][id]); } diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 32ade8bc75..7868353dd5 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -261,7 +261,11 @@ void Score::loadActions(Common::SeekableReadStream &stream) { stream.seek(stringPos); for (uint16 j = stringPos; j < nextStringPos; j++) { - _actions[id] += stream.readByte(); + byte ch = stream.readByte(); + if (ch == 0x0d) { + ch = '\n'; + } + _actions[id] += ch; } stream.seek(streamPos); @@ -276,13 +280,15 @@ void Score::loadActions(Common::SeekableReadStream &stream) { Common::HashMap<uint16, Common::String>::iterator j; for (j = _actions.begin(); j != _actions.end(); ++j) - _lingo->addCode(j->_value, kFrameScript, j->_key); + if (j->_value != "") + _lingo->addCode(j->_value, kFrameScript, j->_key); if (!ConfMan.getBool("dump_scripts")) return; for (j = _actions.begin(); j != _actions.end(); ++j) { - dumpScript(j->_key, kFrameScript, j->_value); + if (j->_value != "") + dumpScript(j->_key, kFrameScript, j->_value); } } @@ -301,10 +307,10 @@ void Score::loadScriptText(Common::SeekableReadStream &stream) { } script += ch; } + if (script != "") + _lingo->addCode(script, kMovieScript, _movieScriptCount); - _lingo->addCode(script, kMovieScript, _movieScriptCount); - - if (ConfMan.getBool("dump_scripts")) { + if (ConfMan.getBool("dump_scripts") && (script != "")) { dumpScript(_movieScriptCount, kMovieScript, script); } |