[Scummvm-cvs-logs] SF.net SVN: scummvm:[51516] scummvm/trunk/graphics/video

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Fri Jul 30 22:35:10 CEST 2010


Revision: 51516
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51516&view=rev
Author:   mthreepwood
Date:     2010-07-30 20:35:09 +0000 (Fri, 30 Jul 2010)

Log Message:
-----------
VIDEO: Fix FLIC looping

Thanks to salty-horse for finding this. Also, use Common::Rational directly to hold the frame rate to avoid rounding.

Modified Paths:
--------------
    scummvm/trunk/graphics/video/flic_decoder.cpp
    scummvm/trunk/graphics/video/flic_decoder.h

Modified: scummvm/trunk/graphics/video/flic_decoder.cpp
===================================================================
--- scummvm/trunk/graphics/video/flic_decoder.cpp	2010-07-30 20:10:30 UTC (rev 51515)
+++ scummvm/trunk/graphics/video/flic_decoder.cpp	2010-07-30 20:35:09 UTC (rev 51516)
@@ -71,9 +71,8 @@
 
 	_fileStream->readUint16LE();	// flags
 	// Note: The normal delay is a 32-bit integer (dword), whereas the overriden delay is a 16-bit integer (word)
-	// frameDelay is the FLIC "speed", in milliseconds. Our frameDelay is calculated in 1/100 ms, so we convert it here
-	uint32 frameDelay = 100 * _fileStream->readUint32LE();
-	_frameRate = 100 * 1000 / frameDelay;
+	// the frame delay is the FLIC "speed", in milliseconds.
+	_frameRate = Common::Rational(1000, _fileStream->readUint32LE());
 
 	_fileStream->seek(80);
 	_offsetFrame1 = _fileStream->readUint32LE();
@@ -209,10 +208,10 @@
 
 			chunkCount = _fileStream->readUint16LE();
 			// Note: The overriden delay is a 16-bit integer (word), whereas the normal delay is a 32-bit integer (dword)
-			// frameDelay is the FLIC "speed", in milliseconds. Our frameDelay is calculated in 1/100 ms, so we convert it here
+			// the frame delay is the FLIC "speed", in milliseconds.
 			uint16 newFrameDelay = _fileStream->readUint16LE();	// "speed", in milliseconds
 			if (newFrameDelay > 0)
-				_frameRate = 1000 / newFrameDelay;
+				_frameRate = Common::Rational(1000, newFrameDelay);
 
 			_fileStream->readUint16LE();	// reserved, always 0
 			uint16 newWidth = _fileStream->readUint16LE();
@@ -268,15 +267,15 @@
 
 	_curFrame++;
 
-	if (_curFrame == 0)
-		_startTime = g_system->getMillis();
-
 	// If we just processed the ring frame, set the next frame
 	if (_curFrame == (int32)_frameCount) {
 		_curFrame = 0;
 		_fileStream->seek(_offsetFrame2);
 	}
 
+	if (_curFrame == 0)
+		_startTime = g_system->getMillis();
+
 	return _surface;
 }
 

Modified: scummvm/trunk/graphics/video/flic_decoder.h
===================================================================
--- scummvm/trunk/graphics/video/flic_decoder.h	2010-07-30 20:10:30 UTC (rev 51515)
+++ scummvm/trunk/graphics/video/flic_decoder.h	2010-07-30 20:35:09 UTC (rev 51516)
@@ -91,7 +91,7 @@
 	Common::SeekableReadStream *_fileStream;
 	Surface *_surface;
 	uint32 _frameCount;
-	uint32 _frameRate;
+	Common::Rational _frameRate;
 
 	Common::List<Common::Rect> _dirtyRects;
 };


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list