diff options
author | Dmitry Iskrich | 2016-06-15 19:34:00 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | ddcaad4a11b8b9d542a01d2544283416a03ea80a (patch) | |
tree | e16b514326b1340e6e6d7552dc89287a16d45359 | |
parent | 16a2b7e7c3c89945c1e80702238e6cee5bbe4faa (diff) | |
download | scummvm-rg350-ddcaad4a11b8b9d542a01d2544283416a03ea80a.tar.gz scummvm-rg350-ddcaad4a11b8b9d542a01d2544283416a03ea80a.tar.bz2 scummvm-rg350-ddcaad4a11b8b9d542a01d2544283416a03ea80a.zip |
DIRECTOR: Parse common STXT scripts
-rw-r--r-- | engines/director/score.cpp | 26 | ||||
-rw-r--r-- | engines/director/score.h | 1 |
2 files changed, 26 insertions, 1 deletions
diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 4cbc4f2cf0..16f85fc02f 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -83,13 +83,21 @@ Score::Score(Archive &movie, Lingo &lingo, DirectorSound &soundManager) { loadCastInfo(*_movieArchive->getResource(MKTAG('V','W','C','I'), *iterator), *iterator); } + Common::Array<uint16> stxt = _movieArchive->getResourceIDList(MKTAG('S','T','X','T')); + if (stxt.size() > 0) { + Common::Array<uint16>::iterator iterator; + for (iterator = stxt.begin(); iterator != stxt.end(); ++iterator) { + loadScriptText(*_movieArchive->getResource(MKTAG('S','T','X','T'), *iterator)); + } + } + DIBDecoder palette; Common::Array<uint16> clutList = _movieArchive->getResourceIDList(MKTAG('C','L','U','T')); if (clutList.size() > 1) error("More than one palette was found"); if (clutList.size() == 0) - warning("CLUT not found"); + error("CLUT not found"); Common::SeekableReadStream *pal = _movieArchive->getResource(MKTAG('C', 'L', 'U', 'T'), clutList[0]); palette.loadPalette(*pal); @@ -263,6 +271,22 @@ void Score::loadActions(Common::SeekableReadStream &stream) { } } +void Score::loadScriptText(Common::SeekableReadStream &stream) { + /*uint32 unk1 = */ stream.readUint32BE(); + uint32 strLen = stream.readUint32BE(); + /*uin32 dataLen = */ stream.readUint32BE(); + Common::String script; + for (uint32 i = 0; i < strLen; i++) { + byte ch = stream.readByte(); + if (ch == 0x0d){ + //in old Mac systems \r was the code for end-of-line instead. + ch = '\n'; + } + script += ch; + } + _lingo->addCode(script, kMovieScript, 0); +} + void Score::dumpScript(uint16 id, ScriptType type, Common::String script) { Common::DumpFile out; Common::String typeName; diff --git a/engines/director/score.h b/engines/director/score.h index a05c6bb060..6156194df4 100644 --- a/engines/director/score.h +++ b/engines/director/score.h @@ -291,6 +291,7 @@ private: void loadLabels(Common::SeekableReadStream &stream); void loadActions(Common::SeekableReadStream &stream); void loadCastInfo(Common::SeekableReadStream &stream, uint16 id); + void loadScriptText(Common::SeekableReadStream &stream); void loadFileInfo(Common::SeekableReadStream &stream); void loadFontMap(Common::SeekableReadStream &stream); void dumpScript(uint16 id, ScriptType type, Common::String script); |