aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock
diff options
context:
space:
mode:
authorPaul Gilbert2015-08-09 08:08:03 -0400
committerPaul Gilbert2015-08-09 08:08:03 -0400
commitd5af7b73ec1321a2557eed01e60f0753d9716285 (patch)
treed7e8bb3d53f4e9ed574ea70270388fb832a68667 /engines/sherlock
parent41e1320d83b4333cbf4353790f1a0c05bd6deecc (diff)
downloadscummvm-rg350-d5af7b73ec1321a2557eed01e60f0753d9716285.tar.gz
scummvm-rg350-d5af7b73ec1321a2557eed01e60f0753d9716285.tar.bz2
scummvm-rg350-d5af7b73ec1321a2557eed01e60f0753d9716285.zip
SHERLOCK: RT: Fix drawing last frame of animations
Diffstat (limited to 'engines/sherlock')
-rw-r--r--engines/sherlock/image_file.cpp13
-rw-r--r--engines/sherlock/image_file.h7
-rw-r--r--engines/sherlock/tattoo/tattoo_scene.cpp5
3 files changed, 17 insertions, 8 deletions
diff --git a/engines/sherlock/image_file.cpp b/engines/sherlock/image_file.cpp
index 81087dae8b..1ff0f4b054 100644
--- a/engines/sherlock/image_file.cpp
+++ b/engines/sherlock/image_file.cpp
@@ -1026,6 +1026,7 @@ StreamingImageFile::StreamingImageFile() {
_scaleVal = 0;
_zPlacement = 0;
_compressed = false;
+ _active = false;
}
StreamingImageFile::~StreamingImageFile() {
@@ -1036,18 +1037,22 @@ void StreamingImageFile::load(Common::SeekableReadStream *stream, bool compresse
_stream = stream;
_compressed = compressed;
_frameNumber = -1;
+ _active = true;
}
void StreamingImageFile::close() {
delete _stream;
_stream = nullptr;
_frameNumber = -1;
+ _active = false;
}
-void StreamingImageFile::getNextFrame() {
+bool StreamingImageFile::getNextFrame() {
// Don't proceed if we're already at the end of the stream
- if (_stream->pos() >= _stream->size())
- return;
+ if (_stream->pos() >= _stream->size()) {
+ _active = false;
+ return false;
+ }
// Increment frame number
++_frameNumber;
@@ -1080,6 +1085,8 @@ void StreamingImageFile::getNextFrame() {
_imageFrame.decompressFrame(_buffer + 11, true);
delete[] data;
}
+
+ return true;
}
} // End of namespace Sherlock
diff --git a/engines/sherlock/image_file.h b/engines/sherlock/image_file.h
index 3ac0cf4b5f..da260ab30b 100644
--- a/engines/sherlock/image_file.h
+++ b/engines/sherlock/image_file.h
@@ -160,8 +160,9 @@ class StreamingImageFile {
private:
int _frameNumber;
Common::SeekableReadStream *_stream;
- bool _compressed;
byte _buffer[STREAMING_BUFFER_SIZE];
+ bool _compressed;
+ bool _active;
public:
ImageFrame _imageFrame;
@@ -189,12 +190,12 @@ public:
/**
* Get the next frame of the file
*/
- void getNextFrame();
+ bool getNextFrame();
/**
* Returns whether there are any remaining frames or not
*/
- bool active() const { return _stream != nullptr && _stream->pos() < _stream->size(); }
+ bool active() const { return _active; }
/**
* Return the current frame number
diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp
index 20e495bb01..e249e0eaac 100644
--- a/engines/sherlock/tattoo/tattoo_scene.cpp
+++ b/engines/sherlock/tattoo/tattoo_scene.cpp
@@ -663,9 +663,10 @@ int TattooScene::startCAnim(int cAnimNum, int playRate) {
_activeCAnim.load(animStream, _compressed);
- while (_activeCAnim.active() && !_vm->shouldQuit()) {
+ while (!_vm->shouldQuit()) {
// Get the next frame
- _activeCAnim.getNextFrame();
+ if (!_activeCAnim.getNextFrame())
+ break;
// Draw the frame
doBgAnim();