diff options
author | Alyssa Milburn | 2011-08-13 22:13:31 +0200 |
---|---|---|
committer | Alyssa Milburn | 2011-08-13 22:15:23 +0200 |
commit | a6acf42e74dc49a184bab461fcc29ac9b30af8fb (patch) | |
tree | c40d529537ab94626210ef89171913254d246186 /engines/composer | |
parent | bdc24b6565c69f57d194feb5538a67caa5cdfa1c (diff) | |
download | scummvm-rg350-a6acf42e74dc49a184bab461fcc29ac9b30af8fb.tar.gz scummvm-rg350-a6acf42e74dc49a184bab461fcc29ac9b30af8fb.tar.bz2 scummvm-rg350-a6acf42e74dc49a184bab461fcc29ac9b30af8fb.zip |
COMPOSER: Support reading V1 buttons.
Diffstat (limited to 'engines/composer')
-rw-r--r-- | engines/composer/composer.cpp | 44 | ||||
-rw-r--r-- | engines/composer/composer.h | 2 |
2 files changed, 31 insertions, 15 deletions
diff --git a/engines/composer/composer.cpp b/engines/composer/composer.cpp index 165918adfd..d9bb0cdc54 100644 --- a/engines/composer/composer.cpp +++ b/engines/composer/composer.cpp @@ -322,7 +322,7 @@ void ComposerEngine::loadLibrary(uint id) { for (uint i = 0; i < buttonResources.size(); i++) { uint16 buttonId = buttonResources[i]; Common::SeekableReadStream *stream = library._archive->getResource(ID_BUTN, buttonId); - Button button(stream, buttonId); + Button button(stream, buttonId, getGameType()); bool inserted = false; for (Common::List<Button>::iterator b = newLib._buttons.begin(); b != newLib._buttons.end(); b++) { @@ -409,22 +409,32 @@ Common::SeekableReadStream *ComposerEngine::getResource(uint32 tag, uint16 id) { error("No loaded library contains '%s' %04x", tag2str(tag), id); } -Button::Button(Common::SeekableReadStream *stream, uint16 id) { +Button::Button(Common::SeekableReadStream *stream, uint16 id, uint gameType) { _id = id; _type = stream->readUint16LE(); _active = (_type & 0x8000) ? true : false; _type &= 0xfff; - debug(9, "button: type %d, active %d", _type, _active); - - _zorder = stream->readUint16LE(); - _scriptId = stream->readUint16LE(); - _scriptIdRollOn = stream->readUint16LE(); - _scriptIdRollOff = stream->readUint16LE(); - - stream->skip(4); - - uint16 size = stream->readUint16LE(); + debug(9, "button %d: type %d, active %d", id, _type, _active); + + uint16 flags = 0; + uint16 size = 4; + if (gameType == GType_ComposerV1) { + flags = stream->readUint16LE(); + _zorder = 0; + _scriptId = stream->readUint16LE(); + _scriptIdRollOn = 0; + _scriptIdRollOff = 0; + } else { + _zorder = stream->readUint16LE(); + _scriptId = stream->readUint16LE(); + _scriptIdRollOn = stream->readUint16LE(); + _scriptIdRollOff = stream->readUint16LE(); + + stream->skip(4); + + size = stream->readUint16LE(); + } switch (_type) { case kButtonRect: @@ -435,17 +445,23 @@ Button::Button(Common::SeekableReadStream *stream, uint16 id) { _rect.top = stream->readSint16LE(); _rect.right = stream->readSint16LE(); _rect.bottom = stream->readSint16LE(); - debug(9, "button: (%d, %d, %d, %d)", _rect.left, _rect.top, _rect.right, _rect.bottom); break; case kButtonSprites: + if (gameType == GType_ComposerV1) + error("encountered kButtonSprites in V1 data"); for (uint i = 0; i < size; i++) { - _spriteIds.push_back(stream->readSint16LE()); + _spriteIds.push_back(stream->readUint16LE()); } break; default: error("unknown button type %d", _type); } + if (flags & 0x40) { + _scriptIdRollOn = stream->readUint16LE(); + _scriptIdRollOff = stream->readUint16LE(); + } + delete stream; } diff --git a/engines/composer/composer.h b/engines/composer/composer.h index 955b78d3cd..c0d456daaa 100644 --- a/engines/composer/composer.h +++ b/engines/composer/composer.h @@ -68,7 +68,7 @@ enum { class Button { public: Button() { } - Button(Common::SeekableReadStream *stream, uint16 id); + Button(Common::SeekableReadStream *stream, uint16 id, uint gameType); bool contains(const Common::Point &pos) const; |