Skip to content

Commit

Permalink
DIRECTOR: Add file info loading, fix strings loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Iskrich authored and sev- committed Aug 3, 2016
1 parent 1b6b247 commit 414a0b1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
13 changes: 12 additions & 1 deletion engines/director/score.cpp
Expand Up @@ -59,6 +59,9 @@ Score::Score(Archive &movie) {
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));
}

Common::Array<uint16> vwci = _movieArchive->getResourceIDList(MKTAG('V','W','C','I'));
if (vwci.size() > 0) {
Expand Down Expand Up @@ -239,6 +242,14 @@ void Score::loadCastInfo(Common::SeekableReadStream &stream) {
//TODO storage in array, and use this info
}

void Score::loadFileInfo(Common::SeekableReadStream &stream) {
Common::Array<Common::String> fileInfoStrings = loadStrings(stream, _flags);
_script = fileInfoStrings[0];
_changedBy = fileInfoStrings[1];
_createdBy = fileInfoStrings[2];
_directory = fileInfoStrings[3];
}

Common::Array<Common::String> Score::loadStrings(Common::SeekableReadStream &stream, uint32 &entryType, bool hasHeader) {
Common::Array<Common::String> strings;
uint32 offset = 0;
Expand All @@ -251,7 +262,7 @@ Common::Array<Common::String> Score::loadStrings(Common::SeekableReadStream &str
}

uint16 count = stream.readUint16BE();
offset += count * 2 + 16; //positions info + header info
offset += (count + 1) * 4 + 2; //positions info + uint16 count
uint32 startPos = stream.readUint32BE() + offset;
for (uint16 i = 0; i < count; i++) {
Common::String entryString;
Expand Down
5 changes: 5 additions & 0 deletions engines/director/score.h
Expand Up @@ -206,6 +206,7 @@ class Score {
void loadLabels(Common::SeekableReadStream &stream);
void loadActions(Common::SeekableReadStream &stream);
void loadCastInfo(Common::SeekableReadStream &stream);
void loadFileInfo(Common::SeekableReadStream &stream);
Common::Array<Common::String> loadStrings(Common::SeekableReadStream &stream, uint32 &entryType, bool hasHeader = true);
public:
Common::Array<Frame *> _frames;
Expand All @@ -216,6 +217,10 @@ class Score {
private:
uint16 _versionMinor;
uint16 _versionMajor;
Common::String _createdBy;
Common::String _changedBy;
Common::String _script;
Common::String _directory;
byte _currentFrameRate;
uint16 _castArrayStart;
uint16 _currentFrame;
Expand Down

0 comments on commit 414a0b1

Please sign in to comment.