From 3c303c0dfda28d149b8b142fd758a19dc354b226 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 13 Mar 2006 11:20:58 +0000 Subject: Add proper handling for animations with frame offset tables during decoding svn-id: r21255 --- engines/lure/hotspots.cpp | 10 +++++++++- engines/lure/luredefs.h | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp index 0721df22b7..01da3ab674 100644 --- a/engines/lure/hotspots.cpp +++ b/engines/lure/hotspots.cpp @@ -171,7 +171,15 @@ void Hotspot::setAnimation(HotspotAnimData *newRecord) { MemoryBlock &mDest = _frames->data(); for (uint16 frameCtr = 0; frameCtr < _numFrames; ++frameCtr, ++headerEntry) { - + + if ((newRecord->flags & PIXELFLAG_HAS_TABLE) != 0) { + // For animations with an offset table, set the source point for each frame + uint16 frameOffset = *((uint16 *) (src->data() + ((frameCtr + 1) * sizeof(uint16)))) + 0x40; + if (frameOffset + _height * (_width / 2) > dest->size()) + error("Invalid frame offset in animation %x", newRecord->animRecordId); + pSrc = dest->data() + frameOffset; + } + // Copy over the frame, applying the colour offset to each nibble for (uint16 yPos = 0; yPos < _height; ++yPos) { pDest = mDest.data() + (yPos * _numFrames + frameCtr) * _width; diff --git a/engines/lure/luredefs.h b/engines/lure/luredefs.h index d259502811..242299bea9 100644 --- a/engines/lure/luredefs.h +++ b/engines/lure/luredefs.h @@ -202,6 +202,9 @@ enum Action { // Misc constants #define VOICE_ANIM_ID 0x5810 +// Pixel record flags +#define PIXELFLAG_HAS_TABLE 4 + } // End of namespace Lure #endif -- cgit v1.2.3