Skip to content

Commit

Permalink
DIRECTOR: Load actions
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 254b1e3 commit 4819a4e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
37 changes: 37 additions & 0 deletions engines/director/score.cpp
Expand Up @@ -50,6 +50,10 @@ Score::Score(Archive &movie) {
if (_movieArchive->hasResource(MKTAG('V','W','L','B'), 1024)) {
loadLabels(*_movieArchive->getResource(MKTAG('V','W','L','B'), 1024));
}

if (_movieArchive->hasResource(MKTAG('V','W','A','C'), 1024)) {
loadActions(*_movieArchive->getResource(MKTAG('V','W','A','C'), 1024));
}
}

void Score::loadFrames(Common::SeekableReadStream &stream) {
Expand Down Expand Up @@ -166,6 +170,39 @@ void Score::loadLabels(Common::SeekableReadStream &stream) {
}
}

void Score::loadActions(Common::SeekableReadStream &stream) {
uint16 count = stream.readUint16BE() + 1;
uint16 offset = count * 4 + 2;

byte id = stream.readByte();
/*byte subId = */ stream.readByte(); //I couldn't find how it used in continuity (except print). Frame actionId = 1 byte.
uint16 stringPos = stream.readUint16BE() + offset;

for (uint16 i = 0; i < count; i++) {

uint16 nextId = stream.readByte();
/*byte subId = */ stream.readByte();
uint16 nextStringPos = stream.readUint16BE() + offset;
uint16 streamPos = stream.pos();

stream.seek(stringPos);

for (uint16 j = stringPos; j < nextStringPos; j++) {
_actions[id] += stream.readByte();
}

stream.seek(streamPos);

id = nextId;
stringPos = nextStringPos;
}

Common::HashMap<uint16, Common::String>::iterator j;
for (j = _actions.begin(); j != _actions.end(); ++j) {
debug("Id %d, Script %s", j->_key, j->_value.c_str());
}
}

BitmapCast::BitmapCast(Common::SeekableReadStream &stream) {
/*byte flags = */ stream.readByte();
/*uint16 someFlaggyThing = */ stream.readUint16BE();
Expand Down
3 changes: 3 additions & 0 deletions engines/director/score.h
Expand Up @@ -197,10 +197,13 @@ class Score {
void loadCastData(Common::SeekableReadStream &stream);
void loadFrames(Common::SeekableReadStream &stream);
void loadLabels(Common::SeekableReadStream &stream);
void loadActions(Common::SeekableReadStream &stream);

public:
Common::Array<Frame *> _frames;
Common::HashMap<int, Cast *> _casts;
Common::HashMap<uint16, Common::String> _labels;
Common::HashMap<uint16, Common::String> _actions;

private:
uint16 _versionMinor;
Expand Down

0 comments on commit 4819a4e

Please sign in to comment.