diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sherlock/image_file.cpp | 13 | ||||
-rw-r--r-- | engines/sherlock/image_file.h | 7 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_scene.cpp | 5 |
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(); |