diff options
author | Dmitry Iskrich | 2016-06-01 20:13:36 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | 254b1e3c1f888ed48b745a93da23c4c3b3d02d38 (patch) | |
tree | 1ce5f5db8edf4e6f459c091f9ac8fb27bbcdf12b /engines/director | |
parent | f8583622848e1d3d451871ad944645b38714b3ce (diff) | |
download | scummvm-rg350-254b1e3c1f888ed48b745a93da23c4c3b3d02d38.tar.gz scummvm-rg350-254b1e3c1f888ed48b745a93da23c4c3b3d02d38.tar.bz2 scummvm-rg350-254b1e3c1f888ed48b745a93da23c4c3b3d02d38.zip |
DIRECTOR: Load labels
Diffstat (limited to 'engines/director')
-rw-r--r-- | engines/director/score.cpp | 35 | ||||
-rw-r--r-- | engines/director/score.h | 3 |
2 files changed, 38 insertions, 0 deletions
diff --git a/engines/director/score.cpp b/engines/director/score.cpp index ed4d11ffe5..28aed23cfd 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -46,6 +46,10 @@ Score::Score(Archive &movie) { loadFrames(*_movieArchive->getResource(MKTAG('V','W','S','C'), 1024)); loadConfig(*_movieArchive->getResource(MKTAG('V','W','C','F'), 1024)); loadCastData(*_movieArchive->getResource(MKTAG('V','W','C','R'), 1024)); + + if (_movieArchive->hasResource(MKTAG('V','W','L','B'), 1024)) { + loadLabels(*_movieArchive->getResource(MKTAG('V','W','L','B'), 1024)); + } } void Score::loadFrames(Common::SeekableReadStream &stream) { @@ -131,6 +135,37 @@ void Score::loadCastData(Common::SeekableReadStream &stream) { } } +void Score::loadLabels(Common::SeekableReadStream &stream) { + uint16 count = stream.readUint16BE() + 1; + uint16 offset = count * 4 + 2; + + uint16 frame = stream.readUint16BE(); + uint16 stringPos = stream.readUint16BE() + offset; + + for (uint16 i = 0; i < count; i++) { + + uint16 nextFrame = stream.readUint16BE(); + uint16 nextStringPos = stream.readUint16BE() + offset; + uint16 streamPos = stream.pos(); + + stream.seek(stringPos); + + for (uint16 j = stringPos; j < nextStringPos; j++) { + _labels[frame] += stream.readByte(); + } + + stream.seek(streamPos); + + frame = nextFrame; + stringPos = nextStringPos; + } + + Common::HashMap<uint16, Common::String>::iterator j; + for (j = _labels.begin(); j != _labels.end(); ++j) { + debug("Frame %d, Label %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 ba10f2df7e..fae6ea8fea 100644 --- a/engines/director/score.h +++ b/engines/director/score.h @@ -25,6 +25,7 @@ #include "common/array.h" #include "director/resource.h" #include "graphics/managed_surface.h" +#include "common/str.h" namespace Director { @@ -195,9 +196,11 @@ private: void loadConfig(Common::SeekableReadStream &stream); void loadCastData(Common::SeekableReadStream &stream); void loadFrames(Common::SeekableReadStream &stream); + void loadLabels(Common::SeekableReadStream &stream); public: Common::Array<Frame *> _frames; Common::HashMap<int, Cast *> _casts; + Common::HashMap<uint16, Common::String> _labels; private: uint16 _versionMinor; |