diff options
author | Dmitry Iskrich | 2016-06-01 21:33:23 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | 4819a4e8572e49a14c83b41312e7f1791408b072 (patch) | |
tree | 9b0e96e0c6f08400b7ff476596b07158e941b4e0 | |
parent | 254b1e3c1f888ed48b745a93da23c4c3b3d02d38 (diff) | |
download | scummvm-rg350-4819a4e8572e49a14c83b41312e7f1791408b072.tar.gz scummvm-rg350-4819a4e8572e49a14c83b41312e7f1791408b072.tar.bz2 scummvm-rg350-4819a4e8572e49a14c83b41312e7f1791408b072.zip |
DIRECTOR: Load actions
-rw-r--r-- | engines/director/score.cpp | 37 | ||||
-rw-r--r-- | engines/director/score.h | 3 |
2 files changed, 40 insertions, 0 deletions
diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 28aed23cfd..7a3e8864e6 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -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) { @@ -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(); diff --git a/engines/director/score.h b/engines/director/score.h index fae6ea8fea..21756be212 100644 --- a/engines/director/score.h +++ b/engines/director/score.h @@ -197,10 +197,13 @@ private: 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; |