[Scummvm-cvs-logs] scummvm master -> d5af7b73ec1321a2557eed01e60f0753d9716285

dreammaster dreammaster at scummvm.org
Sun Aug 9 14:09:10 CEST 2015


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
d5af7b73ec SHERLOCK: RT: Fix drawing last frame of animations


Commit: d5af7b73ec1321a2557eed01e60f0753d9716285
    https://github.com/scummvm/scummvm/commit/d5af7b73ec1321a2557eed01e60f0753d9716285
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-08-09T08:08:03-04:00

Commit Message:
SHERLOCK: RT: Fix drawing last frame of animations

Changed paths:
    engines/sherlock/image_file.cpp
    engines/sherlock/image_file.h
    engines/sherlock/tattoo/tattoo_scene.cpp



diff --git a/engines/sherlock/image_file.cpp b/engines/sherlock/image_file.cpp
index 81087da..1ff0f4b 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 3ac0cf4..da260ab 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 20e495b..e249e0e 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();






More information about the Scummvm-git-logs mailing list