diff options
author | Alyssa Milburn | 2011-07-17 23:44:27 +0200 |
---|---|---|
committer | Alyssa Milburn | 2011-07-17 23:44:27 +0200 |
commit | 0366a982c3a5682b636b16e3b3cb6d76e74d6489 (patch) | |
tree | 90ec59369378c4716bd911d58594783bd1076bbd /engines/composer | |
parent | b9cd4e7e717df8bb79e5f965053c43d2d956aa0e (diff) | |
download | scummvm-rg350-0366a982c3a5682b636b16e3b3cb6d76e74d6489.tar.gz scummvm-rg350-0366a982c3a5682b636b16e3b3cb6d76e74d6489.tar.bz2 scummvm-rg350-0366a982c3a5682b636b16e3b3cb6d76e74d6489.zip |
COMPOSER: Implement AddSprite, RemoveSprite, GetSpriteSize script functions.
Diffstat (limited to 'engines/composer')
-rw-r--r-- | engines/composer/composer.cpp | 54 | ||||
-rw-r--r-- | engines/composer/composer.h | 1 |
2 files changed, 37 insertions, 18 deletions
diff --git a/engines/composer/composer.cpp b/engines/composer/composer.cpp index b1ef31dc0e..9b7b4d6f03 100644 --- a/engines/composer/composer.cpp +++ b/engines/composer/composer.cpp @@ -1558,12 +1558,16 @@ int16 ComposerEngine::scriptFuncCall(uint16 id, int16 param1, int16 param2, int1 warning("ignoring kFuncClearSprites()"); return 0; case kFuncAddSprite: - // TODO - warning("ignoring kFuncAddSprite(%d, %d, %d)", param1, param2, param3); + { + Common::Point pos(_vars[param3], _vars[param3 + 1]); + int16 zorder = _vars[param3 + 2]; + debug(3, "kFuncAddSprite(%d, %d, [%d = %d, (%d, %d)])", param1, param2, param3, pos.x, pos.y, zorder); + addSprite(param1, param2, zorder, pos); + } return 0; case kFuncRemoveSprite: - // TODO - warning("ignoring kFuncRemoveSprite(%d, %d)", param1, param2); + debug(3, "kFuncRemoveSprite(%d, %d)", param1, param2); + removeSprite(param1, param2); return 0; case kFuncQuit: // TODO @@ -1578,8 +1582,21 @@ int16 ComposerEngine::scriptFuncCall(uint16 id, int16 param1, int16 param2, int1 warning("ignoring kFuncLoadData(%d, %d, %d)", param1, param2, param3); return 1; case kFuncGetSpriteSize: - // TODO - warning("ignoring kFuncGetSpriteSize(%d, %d, %d)", param1, param2, param3); + debug(3, "kFuncGetSpriteSize(%d, %d, %d)", param1, param2, param3); + int16 width, height; + width = 0; + height = 0; + { + Common::SeekableReadStream *stream = getStreamForSprite(param1); + if (stream) { + stream->readUint16LE(); + height = stream->readSint16LE(); + width = stream->readSint16LE(); + delete stream; + } + } + _vars[param2] = width; + _vars[param3] = height; return 0; default: error("unknown scriptFuncCall %d(%d, %d, %d)", (uint32)id, param1, param2, param3); @@ -1770,19 +1787,20 @@ void ComposerEngine::decompressBitmap(uint16 type, Common::SeekableReadStream *s } } -bool ComposerEngine::initSprite(Sprite &sprite) { - Common::SeekableReadStream *stream = NULL; - if (hasResource(ID_BMAP, sprite._id)) - stream = getResource(ID_BMAP, sprite._id); - else - for (Common::List<Pipe *>::iterator k = _pipes.begin(); k != _pipes.end(); k++) { - Pipe *pipe = *k; - if (!pipe->hasResource(ID_BMAP, sprite._id)) - continue; - stream = pipe->getResource(ID_BMAP, sprite._id, false); - break; - } +Common::SeekableReadStream *ComposerEngine::getStreamForSprite(uint16 id) { + if (hasResource(ID_BMAP, id)) + return getResource(ID_BMAP, id); + for (Common::List<Pipe *>::iterator k = _pipes.begin(); k != _pipes.end(); k++) { + Pipe *pipe = *k; + if (!pipe->hasResource(ID_BMAP, id)) + continue; + return pipe->getResource(ID_BMAP, id, false); + } + return NULL; +} +bool ComposerEngine::initSprite(Sprite &sprite) { + Common::SeekableReadStream *stream = getStreamForSprite(sprite._id); if (!stream) return false; diff --git a/engines/composer/composer.h b/engines/composer/composer.h index 4c87a6e6df..2025a2ebf3 100644 --- a/engines/composer/composer.h +++ b/engines/composer/composer.h @@ -253,6 +253,7 @@ private: void loadCTBL(uint id, uint fadePercent); void decompressBitmap(uint16 type, Common::SeekableReadStream *stream, byte *buffer, uint32 size, uint width, uint height); bool initSprite(Sprite &sprite); + Common::SeekableReadStream *getStreamForSprite(uint16 id); void drawSprite(const Sprite &sprite); }; |