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

cyx at users.sourceforge.net cyx at users.sourceforge.net
Sun Dec 7 15:23:55 CET 2008


Revision: 35275
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35275&view=rev
Author:   cyx
Date:     2008-12-07 14:23:54 +0000 (Sun, 07 Dec 2008)

Log Message:
-----------
cleanup

Modified Paths:
--------------
    scummvm/trunk/graphics/flic_player.cpp
    scummvm/trunk/graphics/flic_player.h

Modified: scummvm/trunk/graphics/flic_player.cpp
===================================================================
--- scummvm/trunk/graphics/flic_player.cpp	2008-12-07 14:22:05 UTC (rev 35274)
+++ scummvm/trunk/graphics/flic_player.cpp	2008-12-07 14:23:54 UTC (rev 35275)
@@ -62,6 +62,7 @@
 
 	_offscreen = new uint8[_flicInfo.width * _flicInfo.height];
 	memset(_palette, 0, sizeof(_palette));
+	_paletteDirty = false;
 
 	// Seek to the first frame
 	_currFrame = 0;
@@ -105,19 +106,18 @@
 
 void FlicPlayer::decodeByteRun(uint8 *data) {
 	uint8 *ptr = (uint8 *)_offscreen;
-	while((ptr - _offscreen) < (_flicInfo.width * _flicInfo.height)) {
-		uint8 chunks = *data++;
+	while ((ptr - _offscreen) < (_flicInfo.width * _flicInfo.height)) {
+		int chunks = *data++;
 		while (chunks--) {
-			int8 count = *data++;
+			int count = (int8)*data++;
 			if (count > 0) {
 				memset(ptr, *data++, count);
-				ptr += count;
 			} else {
-				uint8 copyBytes = -count;
-				memcpy(ptr, data, copyBytes);
-				ptr += copyBytes;
-				data += copyBytes;
+				count = -count;
+				memcpy(ptr, data, count);
+				data += count;
 			}
+			ptr += count;
 		}
 	}
 
@@ -148,7 +148,7 @@
 			case OP_UNDEFINED:
 				break;
 			case OP_LASTPIXEL:
-				*(uint8 *)(_offscreen + (currentLine * _flicInfo.width) + (_flicInfo.width - 1)) = (opcode & 0xFF);
+				_offscreen[currentLine * _flicInfo.width + _flicInfo.width - 1] = (opcode & 0xFF);
 				_dirtyRects.push_back(Common::Rect(_flicInfo.width - 1, currentLine, _flicInfo.width, currentLine + 1));
 				break;
 			case OP_LINESKIPCOUNT:
@@ -162,23 +162,22 @@
 		// Now interpret the RLE data
 		while (packetCount--) {
 			column += *data++;
-			int8 rleCount = (int8)*data++;
+			int rleCount = (int8)*data++;
 			if (rleCount > 0) {
-				memcpy((void *)(_offscreen + (currentLine * _flicInfo.width) + column), data, rleCount * 2);
-				_dirtyRects.push_back(Common::Rect(column, currentLine, column + (rleCount * 2), currentLine + 1));
+				memcpy(_offscreen + (currentLine * _flicInfo.width) + column, data, rleCount * 2);
 				data += rleCount * 2;
-				column += rleCount * 2;
+				_dirtyRects.push_back(Common::Rect(column, currentLine, column + rleCount * 2, currentLine + 1));
 			} else if (rleCount < 0) {
+				rleCount = -rleCount;
 				uint16 dataWord = READ_UINT16(data); data += 2;
-				for (int i = 0; i < -(int16)rleCount; ++i) {
-					WRITE_UINT16(_offscreen + (currentLine * _flicInfo.width) + column + (i * 2), dataWord);
+				for (int i = 0; i < rleCount; ++i) {
+					WRITE_UINT16(_offscreen + currentLine * _flicInfo.width + column + i * 2, dataWord);
 				}
-				_dirtyRects.push_back(Common::Rect(column, currentLine, column + (-(int16)rleCount * 2), currentLine + 1));
-
-				column += (-(int16)rleCount) * 2;
+				_dirtyRects.push_back(Common::Rect(column, currentLine, column + rleCount * 2, currentLine + 1));
 			} else { // End of cutscene ?
 				return;
 			}
+			column += rleCount * 2;
 		}
 
 		currentLine++;
@@ -243,6 +242,7 @@
 }
 
 void FlicPlayer::reset() {
+	_currFrame = 0;
 	_fileStream.seek(_flicInfo.offsetFrame1);
 }
 

Modified: scummvm/trunk/graphics/flic_player.h
===================================================================
--- scummvm/trunk/graphics/flic_player.h	2008-12-07 14:22:05 UTC (rev 35274)
+++ scummvm/trunk/graphics/flic_player.h	2008-12-07 14:23:54 UTC (rev 35275)
@@ -94,7 +94,6 @@
 	uint8 _palette[256 * 4];
 	FlicHeader _flicInfo;
 	uint16 _currFrame;
-	uint32 _lastFrameTime;
 	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