[Scummvm-cvs-logs] SF.net SVN: scummvm:[46743] scummvm/trunk/engines/sci/gui/gui_view.cpp

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Wed Dec 30 15:13:25 CET 2009


Revision: 46743
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46743&view=rev
Author:   m_kiewitz
Date:     2009-12-30 14:13:25 +0000 (Wed, 30 Dec 2009)

Log Message:
-----------
SCI: support for uncompressed sci1 views (fixes qfg3 demo)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/gui/gui_view.cpp

Modified: scummvm/trunk/engines/sci/gui/gui_view.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_view.cpp	2009-12-30 14:00:30 UTC (rev 46742)
+++ scummvm/trunk/engines/sci/gui/gui_view.cpp	2009-12-30 14:13:25 UTC (rev 46743)
@@ -73,7 +73,8 @@
 	uint16 loopSize = 0, celSize = 0;
 	int loopNo, celNo, EGAmapNr;
 	byte seekEntry;
-	bool IsEGA = false;
+	bool isEGA = false;
+	bool isCompressed = true;
 
 	_loopCount = 0;
 	_embeddedPal = false;
@@ -81,13 +82,15 @@
 
 	switch (_resMan->getViewType()) {
 	case kViewEga: // View-format SCI0 (and Amiga 16 colors)
-		IsEGA = true;
+		isEGA = true;
 	case kViewAmiga: // View-format Amiga (32 colors)
 	case kViewVga: // View-format SCI1
 		// LoopCount:WORD MirrorMask:WORD Version:WORD PaletteOffset:WORD LoopOffset0:WORD LoopOffset1:WORD...
 		
+		_loopCount = _resourceData[0];
 		// bit 0x8000 of _resourceData[1] means palette is set
-		_loopCount = _resourceData[0];
+		if (_resourceData[1] & 0x40)
+			isCompressed = false;
 		mirrorBits = READ_LE_UINT16(_resourceData + 2);
 		palOffset = READ_LE_UINT16(_resourceData + 6);
 
@@ -96,7 +99,7 @@
 			//  but on those games using that mapping will actually screw things up.
 			// On the other side: vga sci1 games have this pointing to a VGA palette
 			//  and ega sci1 games have this pointing to a 8x16 byte mapping table that needs to get applied then
-			if (!IsEGA) {
+			if (!isEGA) {
 				_palette->createFromData(&_resourceData[palOffset], &_viewPalette);
 				_embeddedPal = true;
 			} else {
@@ -143,14 +146,20 @@
 				cel->displaceX = celData[4];
 				cel->displaceY = celData[5];
 				cel->clearKey = celData[6];
-				if (IsEGA) {
+				if (isEGA) {
 					cel->offsetEGA = celOffset + 7;
 					cel->offsetRLE = 0;
+					cel->offsetLiteral = 0;
 				} else {
 					cel->offsetEGA = 0;
-					cel->offsetRLE = celOffset + 8;
+					if (isCompressed) {
+						cel->offsetRLE = celOffset + 8;
+						cel->offsetLiteral = 0;
+					} else {
+						cel->offsetRLE = 0;
+						cel->offsetLiteral = celOffset + 8;
+					}
 				}
-				cel->offsetLiteral = 0;
 				cel->rawBitmap = 0;
 				if (_loop[loopNo].mirrorFlag)
 					cel->displaceX = -cel->displaceX;
@@ -316,24 +325,29 @@
 			return;
 		}
 	} else {
-		// decompression for data that has separate rle and literal streams
 		literalPtr = _resourceData + celInfo->offsetLiteral;
-		while (pixelNo < pixelCount) {
-			pixel = *rlePtr++;
-			runLength = pixel & 0x3F;
-			switch (pixel & 0xC0) {
-			case 0: // copy bytes as-is
-				while (runLength-- && pixelNo < pixelCount)
-					outPtr[pixelNo++] = *literalPtr++;
-				break;
-			case 0x80: // fill with color
-				memset(outPtr + pixelNo, *literalPtr++, MIN<uint16>(runLength, pixelCount - pixelNo));
-				pixelNo += runLength;
-				break;
-			case 0xC0: // fill with transparent
-				pixelNo += runLength;
-				break;
+		if (celInfo->offsetRLE) {
+			// decompression for data that has separate rle and literal streams
+			while (pixelNo < pixelCount) {
+				pixel = *rlePtr++;
+				runLength = pixel & 0x3F;
+				switch (pixel & 0xC0) {
+				case 0: // copy bytes as-is
+					while (runLength-- && pixelNo < pixelCount)
+						outPtr[pixelNo++] = *literalPtr++;
+					break;
+				case 0x80: // fill with color
+					memset(outPtr + pixelNo, *literalPtr++, MIN<uint16>(runLength, pixelCount - pixelNo));
+					pixelNo += runLength;
+					break;
+				case 0xC0: // fill with transparent
+					pixelNo += runLength;
+					break;
+				}
 			}
+		} else {
+			// literal stream only, so no compression
+			memcpy(outPtr, literalPtr, pixelCount);
 		}
 		return;
 	}


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