Skip to content

Commit

Permalink
DIRECTOR: Add font map 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 414a0b1 commit 61f15f1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
28 changes: 28 additions & 0 deletions engines/director/score.cpp
Expand Up @@ -63,6 +63,10 @@ Score::Score(Archive &movie) {
loadFileInfo(*_movieArchive->getResource(MKTAG('V','W','F','I'), 1024));
}

if (_movieArchive->hasResource(MKTAG('V','W','F','M'), 1024)) {
loadFontMap(*_movieArchive->getResource(MKTAG('V','W','F','M'), 1024));
}

Common::Array<uint16> vwci = _movieArchive->getResourceIDList(MKTAG('V','W','C','I'));
if (vwci.size() > 0) {
Common::Array<uint16>::iterator iterator;
Expand Down Expand Up @@ -284,6 +288,30 @@ Common::Array<Common::String> Score::loadStrings(Common::SeekableReadStream &str
return strings;
}

void Score::loadFontMap(Common::SeekableReadStream &stream) {
uint16 count = stream.readUint16BE();
uint32 offset = (count * 2) + 2;
uint16 currentRawPosition = offset;

for (uint16 i = 0; i < count; i++) {
uint16 id = stream.readUint16BE();
uint32 positionInfo = stream.pos();

stream.seek(currentRawPosition);

uint16 size = stream.readByte();
Common::String font;

for (uint16 k = 0; k < size; k++) {
font += stream.readByte();
}

_fontMap[id] = font;
currentRawPosition = stream.pos();
stream.seek(positionInfo);
}
}

BitmapCast::BitmapCast(Common::SeekableReadStream &stream) {
/*byte flags = */ stream.readByte();
uint16 someFlaggyThing = stream.readUint16BE();
Expand Down
4 changes: 3 additions & 1 deletion engines/director/score.h
Expand Up @@ -207,13 +207,14 @@ class Score {
void loadActions(Common::SeekableReadStream &stream);
void loadCastInfo(Common::SeekableReadStream &stream);
void loadFileInfo(Common::SeekableReadStream &stream);
void loadFontMap(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;
Common::HashMap<uint16, Common::String> _labels;
Common::HashMap<uint16, Common::String> _actions;

Common::HashMap<uint16, Common::String> _fontMap;
private:
uint16 _versionMinor;
uint16 _versionMajor;
Expand All @@ -225,6 +226,7 @@ class Score {
uint16 _castArrayStart;
uint16 _currentFrame;
uint32 _nextFrameTime;
uint32 _flags;
bool _stopPlay;
uint16 _castArrayEnd;
Common::Rect _movieRect;
Expand Down

0 comments on commit 61f15f1

Please sign in to comment.