aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2015-05-01 12:29:40 -1000
committerPaul Gilbert2015-05-01 12:29:40 -1000
commitda75ee1f8b233cbfacfd1f18a1be970edbc0b0f2 (patch)
tree11bed55b45ff44a7015de70ee4476cca3b1b7f79 /engines
parentedec4abfe5cace1b5a0761adc33bf8e526561f27 (diff)
downloadscummvm-rg350-da75ee1f8b233cbfacfd1f18a1be970edbc0b0f2.tar.gz
scummvm-rg350-da75ee1f8b233cbfacfd1f18a1be970edbc0b0f2.tar.bz2
scummvm-rg350-da75ee1f8b233cbfacfd1f18a1be970edbc0b0f2.zip
SHERLOCK: Fix display of animation cutscenes
Diffstat (limited to 'engines')
-rw-r--r--engines/sherlock/animation.cpp9
-rw-r--r--engines/sherlock/resources.cpp20
-rw-r--r--engines/sherlock/resources.h4
3 files changed, 21 insertions, 12 deletions
diff --git a/engines/sherlock/animation.cpp b/engines/sherlock/animation.cpp
index 810c0ecc34..e70bc84ff8 100644
--- a/engines/sherlock/animation.cpp
+++ b/engines/sherlock/animation.cpp
@@ -94,7 +94,7 @@ bool Animation::playPrologue(const Common::String &filename, int minDelay, int f
// Load initial image
Common::String vdaName = baseName + ".vda";
- ImageFile images(vdaName, true);
+ ImageFile images(vdaName, true, true);
events.wait(minDelay);
if (fade != 0 && fade != 255)
@@ -119,15 +119,16 @@ bool Animation::playPrologue(const Common::String &filename, int minDelay, int f
} else if (imageFrame != -1) {
// Read position from either animation stream or the sprite frame itself
if (imageFrame < 0) {
- imageFrame += 32769;
+ imageFrame += 32768;
pt.x = stream->readUint16LE();
pt.y = stream->readUint16LE();
} else {
pt = images[imageFrame]._offset;
}
- // Draw the sprite
- screen.transBlitFrom(images[imageFrame], pt);
+ // Draw the sprite. Note that we explicitly use the raw frame below, rather than the ImageFrame,
+ // since we don't want the offsets in the image file to be used, just the explicit position we specify
+ screen.transBlitFrom(images[imageFrame]._frame, pt);
} else {
// No sprite to show for this animation frame
if (fade == 255) {
diff --git a/engines/sherlock/resources.cpp b/engines/sherlock/resources.cpp
index 0d66646286..788cacf82a 100644
--- a/engines/sherlock/resources.cpp
+++ b/engines/sherlock/resources.cpp
@@ -268,18 +268,18 @@ void ImageFile::setVm(SherlockEngine *vm) {
_vm = vm;
}
-ImageFile::ImageFile(const Common::String &name, bool skipPal) {
+ImageFile::ImageFile(const Common::String &name, bool skipPal, bool animImages) {
Common::SeekableReadStream *stream = _vm->_res->load(name);
Common::fill(&_palette[0], &_palette[PALETTE_SIZE], 0);
- load(*stream, skipPal);
+ load(*stream, skipPal, animImages);
delete stream;
}
ImageFile::ImageFile(Common::SeekableReadStream &stream, bool skipPal) {
Common::fill(&_palette[0], &_palette[PALETTE_SIZE], 0);
- load(stream, skipPal);
+ load(stream, skipPal, false);
}
ImageFile::~ImageFile() {
@@ -290,7 +290,7 @@ ImageFile::~ImageFile() {
/**
* Load the data of the sprite
*/
-void ImageFile::load(Common::SeekableReadStream &stream, bool skipPalette) {
+void ImageFile::load(Common::SeekableReadStream &stream, bool skipPalette, bool animImages) {
loadPalette(stream);
while (stream.pos() < stream.size()) {
@@ -298,8 +298,16 @@ void ImageFile::load(Common::SeekableReadStream &stream, bool skipPalette) {
frame._width = stream.readUint16LE() + 1;
frame._height = stream.readUint16LE() + 1;
frame._paletteBase = stream.readByte();
- frame._rleEncoded = stream.readByte() == 1;
- frame._offset.x = stream.readByte();
+
+ if (animImages) {
+ // Animation cutscene image files use a 16-bit x offset
+ frame._offset.x = stream.readUint16LE();
+ frame._rleEncoded = (frame._offset.x & 0xff) == 1;
+ } else {
+ // Standard image files have a separate byte for the RLE flag, and an 8-bit X offset
+ frame._rleEncoded = stream.readByte() == 1;
+ frame._offset.x = stream.readByte();
+ }
frame._offset.y = stream.readByte();
frame._rleEncoded = !skipPalette && frame._rleEncoded;
diff --git a/engines/sherlock/resources.h b/engines/sherlock/resources.h
index 45fda565bc..b173884322 100644
--- a/engines/sherlock/resources.h
+++ b/engines/sherlock/resources.h
@@ -104,13 +104,13 @@ class ImageFile : public Common::Array<ImageFrame> {
private:
static SherlockEngine *_vm;
- void load(Common::SeekableReadStream &stream, bool skipPalette);
+ void load(Common::SeekableReadStream &stream, bool skipPalette, bool animImages);
void loadPalette(Common::SeekableReadStream &stream);
void decompressFrame(ImageFrame &frame, const byte *src);
public:
byte _palette[256 * 3];
public:
- ImageFile(const Common::String &name, bool skipPal = false);
+ ImageFile(const Common::String &name, bool skipPal = false, bool animImages = false);
ImageFile(Common::SeekableReadStream &stream, bool skipPal = false);
~ImageFile();
static void setVm(SherlockEngine *vm);