diff options
author | Dmitry Iskrich | 2016-06-07 16:45:02 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | bc2e73c20b28d4582c1a8a17ce03a8d6beda0ca9 (patch) | |
tree | 8a1e728a7075f3ded3ea0176ede65f15cc10215c /engines/director | |
parent | fd7b2f33bf3600f091a6aea1dd4499db5f963424 (diff) | |
download | scummvm-rg350-bc2e73c20b28d4582c1a8a17ce03a8d6beda0ca9.tar.gz scummvm-rg350-bc2e73c20b28d4582c1a8a17ce03a8d6beda0ca9.tar.bz2 scummvm-rg350-bc2e73c20b28d4582c1a8a17ce03a8d6beda0ca9.zip |
DIRECTOR: Add dump scripts
Diffstat (limited to 'engines/director')
-rw-r--r-- | engines/director/score.cpp | 44 | ||||
-rw-r--r-- | engines/director/score.h | 8 |
2 files changed, 47 insertions, 5 deletions
diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 6d6f295e83..cfd4a43230 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -23,6 +23,8 @@ #include "director/score.h" #include "common/stream.h" #include "common/debug.h" +#include "common/file.h" +#include "common/config-manager.h" #include "common/system.h" #include "director/dib.h" @@ -47,6 +49,10 @@ Score::Score(Archive &movie) { loadConfig(*_movieArchive->getResource(MKTAG('V','W','C','F'), 1024)); loadCastData(*_movieArchive->getResource(MKTAG('V','W','C','R'), 1024)); + if (_movieArchive->hasResource(MKTAG('M','C','N','M'), 0)) { + _macName = _movieArchive->getName(MKTAG('M','C','N','M'), 0).c_str(); + } + if (_movieArchive->hasResource(MKTAG('V','W','L','B'), 1024)) { loadLabels(*_movieArchive->getResource(MKTAG('V','W','L','B'), 1024)); } @@ -55,10 +61,6 @@ Score::Score(Archive &movie) { loadActions(*_movieArchive->getResource(MKTAG('V','W','A','C'), 1024)); } - if (_movieArchive->hasResource(MKTAG('M','C','N','M'), 0)) { - debug("Mac name %s", _movieArchive->getName(MKTAG('M','C','N','M'), 0).c_str()); - } - if (_movieArchive->hasResource(MKTAG('V','W','F','I'), 1024)) { loadFileInfo(*_movieArchive->getResource(MKTAG('V','W','F','I'), 1024)); } @@ -202,6 +204,7 @@ void Score::loadLabels(Common::SeekableReadStream &stream) { } void Score::loadActions(Common::SeekableReadStream &stream) { + uint16 count = stream.readUint16BE() + 1; uint16 offset = count * 4 + 2; @@ -229,9 +232,40 @@ void Score::loadActions(Common::SeekableReadStream &stream) { } Common::HashMap<uint16, Common::String>::iterator j; + + debug("%d", ConfMan.getBool("dump_scripts")); + if (!ConfMan.getBool("dump_scripts")) + return; + for (j = _actions.begin(); j != _actions.end(); ++j) { - debug("Id %d, Script %s", j->_key, j->_value.c_str()); + dumpScript(j->_key, kFrameScript, j->_value); + } +} + +void Score::dumpScript(uint16 id, scriptType type, Common::String script) { + Common::DumpFile out; + Common::String typeName; + char buf[256]; + + switch (type) { + case kFrameScript: + typeName = "frame"; + break; + case kMovieScript: + typeName = "movie"; + break; + case kSpriteScript: + typeName = "sprite"; + break; } + + sprintf(buf, "./dump/%s-%s-%d.txt", _macName.c_str(), typeName.c_str(), id); + + out.open(buf); + out.writeString(script); + + out.flush(); + out.close(); } void Score::loadCastInfo(Common::SeekableReadStream &stream) { diff --git a/engines/director/score.h b/engines/director/score.h index b0d53b23e3..60fa0e76d7 100644 --- a/engines/director/score.h +++ b/engines/director/score.h @@ -97,6 +97,12 @@ enum inkType { kInkTypeDark }; +enum scriptType { + kMovieScript, + kSpriteScript, + kFrameScript +}; + struct Cast { castType type; Common::Rect initialRect; @@ -211,6 +217,7 @@ private: void loadCastInfo(Common::SeekableReadStream &stream); void loadFileInfo(Common::SeekableReadStream &stream); void loadFontMap(Common::SeekableReadStream &stream); + void dumpScript(uint16 id, scriptType type, Common::String script); Common::Array<Common::String> loadStrings(Common::SeekableReadStream &stream, uint32 &entryType, bool hasHeader = true); public: Common::Array<Frame *> _frames; @@ -221,6 +228,7 @@ public: private: uint16 _versionMinor; uint16 _versionMajor; + Common::String _macName; Common::String _createdBy; Common::String _changedBy; Common::String _script; |