aboutsummaryrefslogtreecommitdiff
path: root/engines/composer/composer.cpp
diff options
context:
space:
mode:
authorAlyssa Milburn2011-07-16 00:59:00 +0200
committerAlyssa Milburn2011-07-16 00:59:00 +0200
commit9e127a10327ced6e7172efbb237672b07df4a0a0 (patch)
treee4cb11af9d71f08f3724c2e65a1dd51487d2a496 /engines/composer/composer.cpp
parent70ae2c74e04ac84503cfe9c1a555495700d55e68 (diff)
downloadscummvm-rg350-9e127a10327ced6e7172efbb237672b07df4a0a0.tar.gz
scummvm-rg350-9e127a10327ced6e7172efbb237672b07df4a0a0.tar.bz2
scummvm-rg350-9e127a10327ced6e7172efbb237672b07df4a0a0.zip
COMPOSER: Don't die on missing/bad anims.
Diffstat (limited to 'engines/composer/composer.cpp')
-rw-r--r--engines/composer/composer.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/engines/composer/composer.cpp b/engines/composer/composer.cpp
index 6228292676..cafb5e7bd9 100644
--- a/engines/composer/composer.cpp
+++ b/engines/composer/composer.cpp
@@ -296,6 +296,10 @@ void ComposerEngine::playAnimation(uint16 animId, int16 x, int16 y, int16 eventP
// If we didn't find it, try the libraries.
if (!stream) {
+ if (!hasResource(ID_ANIM, animId)) {
+ warning("ignoring attempt to play invalid anim %d", animId);
+ return;
+ }
stream = getResource(ID_ANIM, animId);
uint32 type = 0;
@@ -350,6 +354,12 @@ void ComposerEngine::processAnimFrame() {
for (Common::List<Animation *>::iterator i = _anims.begin(); i != _anims.end(); i++) {
Animation *anim = *i;
+ anim->seekToCurrPos();
+ if (anim->_stream->pos() == anim->_stream->size()) {
+ warning("anim with id %d ended too soon", anim->_id);
+ anim->_state = 0;
+ }
+
if (anim->_state <= 1) {
if (anim->_state == 1) {
runEvent(2, anim->_id, anim->_eventParam, 0);
@@ -363,8 +373,6 @@ void ComposerEngine::processAnimFrame() {
continue;
}
- anim->seekToCurrPos();
-
for (uint j = 0; j < anim->_entries.size(); j++) {
AnimationEntry &entry = anim->_entries[j];
if (entry.op != 1)
@@ -679,8 +687,9 @@ void ComposerEngine::loadLibrary(uint id) {
Common::hexdump(buf, stream->size());
delete stream;*/
- // TODO: set background properly
- addSprite(1000, 0, 0, Common::Point());
+ // add background sprite, if it exists
+ if (hasResource(ID_BMAP, 1000))
+ addSprite(1000, 0, -1, Common::Point());
// TODO: better CTBL logic
loadCTBL(1000, 100);