aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Iskrich2016-06-06 17:20:19 +0300
committerEugene Sandulenko2016-08-03 23:40:36 +0200
commit1b6b24740e91cb6a3191728e0e2f01c4d475cc84 (patch)
tree6a424ce42daf2e68b51f4ed2bc0e0103398e6b7e
parente17de45075f75cf9657764c31a7893dd73a1822f (diff)
downloadscummvm-rg350-1b6b24740e91cb6a3191728e0e2f01c4d475cc84.tar.gz
scummvm-rg350-1b6b24740e91cb6a3191728e0e2f01c4d475cc84.tar.bz2
scummvm-rg350-1b6b24740e91cb6a3191728e0e2f01c4d475cc84.zip
DIRECTOR: Add cast info loading
-rw-r--r--engines/director/score.cpp55
-rw-r--r--engines/director/score.h10
2 files changed, 64 insertions, 1 deletions
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index d8d76ffb66..59e3f9e507 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -58,6 +58,15 @@ Score::Score(Archive &movie) {
if (_movieArchive->hasResource(MKTAG('M','C','N','M'), 0)) {
debug("Mac name %s", _movieArchive->getName(MKTAG('M','C','N','M'), 0).c_str());
}
+
+
+ Common::Array<uint16> vwci = _movieArchive->getResourceIDList(MKTAG('V','W','C','I'));
+ if (vwci.size() > 0) {
+ Common::Array<uint16>::iterator iterator;
+ for (iterator = vwci.begin(); iterator != vwci.end(); ++iterator)
+ loadCastInfo(*_movieArchive->getResource(MKTAG('V','W','C','I'), *iterator));
+ }
+
DIBDecoder palette;
Common::Array<uint16> clutList = _movieArchive->getResourceIDList(MKTAG('C','L','U','T'));
@@ -218,6 +227,52 @@ void Score::loadActions(Common::SeekableReadStream &stream) {
}
}
+void Score::loadCastInfo(Common::SeekableReadStream &stream) {
+ uint32 entryType = 0;
+ Common::Array<Common::String> castStrings = loadStrings(stream, entryType);
+ CastInfo ci;
+ ci.script = castStrings[0];
+ ci.name = castStrings[1];
+ ci.directory = castStrings[2];
+ ci.fileName = castStrings[3];
+ ci.type = castStrings[4];
+ //TODO storage in array, and use this info
+}
+
+Common::Array<Common::String> Score::loadStrings(Common::SeekableReadStream &stream, uint32 &entryType, bool hasHeader) {
+ Common::Array<Common::String> strings;
+ uint32 offset = 0;
+ if (hasHeader) {
+ offset = stream.readUint32BE();
+ /*uint32 unk1 = */ stream.readUint32BE();
+ /*uint32 unk2 = */ stream.readUint32BE();
+ entryType = stream.readUint32BE();
+ stream.seek(offset);
+ }
+
+ uint16 count = stream.readUint16BE();
+ offset += count * 2 + 16; //positions info + header info
+ uint32 startPos = stream.readUint32BE() + offset;
+ for (uint16 i = 0; i < count; i++) {
+ Common::String entryString;
+ uint32 nextPos = stream.readUint32BE() + offset;
+ uint32 streamPos = stream.pos();
+
+ stream.seek(startPos);
+
+ while (startPos != nextPos) {
+ entryString += stream.readByte();
+ ++startPos;
+ }
+
+ strings.push_back(entryString);
+
+ stream.seek(streamPos);
+ startPos = nextPos;
+ }
+ return strings;
+}
+
BitmapCast::BitmapCast(Common::SeekableReadStream &stream) {
/*byte flags = */ stream.readByte();
uint16 someFlaggyThing = stream.readUint16BE();
diff --git a/engines/director/score.h b/engines/director/score.h
index 7c2a75fc7e..b8312df5dc 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -138,6 +138,13 @@ struct ButtonCast : TextCast {
uint16 buttonType;
};
+struct CastInfo {
+ Common::String script;
+ Common::String name;
+ Common::String directory;
+ Common::String fileName;
+ Common::String type;
+};
class Sprite {
public:
@@ -198,7 +205,8 @@ private:
void loadFrames(Common::SeekableReadStream &stream);
void loadLabels(Common::SeekableReadStream &stream);
void loadActions(Common::SeekableReadStream &stream);
-
+ void loadCastInfo(Common::SeekableReadStream &stream);
+ Common::Array<Common::String> loadStrings(Common::SeekableReadStream &stream, uint32 &entryType, bool hasHeader = true);
public:
Common::Array<Frame *> _frames;
Common::HashMap<int, Cast *> _casts;