DIRECTOR: Parse common STXT scripts

This commit is contained in:
Dmitry Iskrich 2016-06-15 19:34:00 +03:00 committed by Eugene Sandulenko
parent 16a2b7e7c3
commit ddcaad4a11
2 changed files with 26 additions and 1 deletions

View File

@ -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;

View File

@ -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);