[Scummvm-cvs-logs] scummvm master -> 4ddc66d68ef1439ceb669658ea2651a6a5a06597

bluegr md5 at scummvm.org
Mon Mar 7 12:24:50 CET 2011


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:
4ddc66d68e SCI: Initial handling of the views in Longbow Amiga. Still not right


Commit: 4ddc66d68ef1439ceb669658ea2651a6a5a06597
    https://github.com/scummvm/scummvm/commit/4ddc66d68ef1439ceb669658ea2651a6a5a06597
Author: md5 (md5 at scummvm.org)
Date: 2011-03-07T03:23:52-08:00

Commit Message:
SCI: Initial handling of the views in Longbow Amiga. Still not right

Changed paths:
    engines/sci/graphics/helpers.h
    engines/sci/graphics/palette.cpp
    engines/sci/graphics/picture.cpp
    engines/sci/graphics/view.cpp
    engines/sci/resource.cpp



diff --git a/engines/sci/graphics/helpers.h b/engines/sci/graphics/helpers.h
index 1a87e56..343f3c7 100644
--- a/engines/sci/graphics/helpers.h
+++ b/engines/sci/graphics/helpers.h
@@ -143,7 +143,8 @@ enum ViewType {
 	kViewUnknown,   // uninitialized, or non-SCI
 	kViewEga,       // EGA SCI0/SCI1 and Amiga SCI0/SCI1 ECS 16 colors
 	kViewAmiga,     // Amiga SCI1 ECS 32 colors
-	kViewVga,       // VGA SCI1 256 colors or Amiga SCI1 AGA 64 colors (i.e. Longbow)
+	kViewAmiga64,   // Amiga SCI1 AGA 64 colors (i.e. Longbow)
+	kViewVga,       // VGA SCI1 256 colors
 	kViewVga11      // VGA SCI1.1 and newer 256 colors
 };
 
diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp
index 3b3596a..5a6b185 100644
--- a/engines/sci/graphics/palette.cpp
+++ b/engines/sci/graphics/palette.cpp
@@ -78,18 +78,18 @@ GfxPalette::GfxPalette(ResourceManager *resMan, GfxScreen *screen, bool useMergi
 #endif
 
 	switch (_resMan->getViewType()) {
-	case kViewVga:
-	case kViewVga11:
-		if (g_sci->getPlatform() == Common::kPlatformAmiga)
-			_totalScreenColors = 64;	// Longbow Amiga
-		else
-			_totalScreenColors = 256;
+	case kViewEga:
+		_totalScreenColors = 16;
 		break;
 	case kViewAmiga:
 		_totalScreenColors = 32;
 		break;
-	case kViewEga:
-		_totalScreenColors = 16;
+	case kViewAmiga64:
+		_totalScreenColors = 64;
+		break;
+	case kViewVga:
+	case kViewVga11:
+			_totalScreenColors = 256;
 		break;
 	default:
 		error("GfxPalette: Unknown view type");
diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp
index 6a3767a..e60a62e 100644
--- a/engines/sci/graphics/picture.cpp
+++ b/engines/sci/graphics/picture.cpp
@@ -712,9 +712,7 @@ void GfxPicture::drawVectorData(byte *data, int dataSize) {
 					}
 					break;
 				case PIC_OPX_VGA_SET_PALETTE:
-					if (_resMan->getViewType() == kViewAmiga ||
-						(_resMan->getViewType() == kViewVga && g_sci->getPlatform() == Common::kPlatformAmiga)	// Longbow Amiga
-						) {
+					if (_resMan->getViewType() == kViewAmiga || _resMan->getViewType() == kViewAmiga64) {
 						if ((data[curPos] == 0x00) && (data[curPos + 1] == 0x01) && ((data[curPos + 32] & 0xF0) != 0xF0)) {
 							// Left-Over VGA palette, we simply ignore it
 							curPos += 256 + 4 + 1024;
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index a6c0805..fd74714 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -106,7 +106,8 @@ void GfxView::initData(GuiResourceId resourceId) {
 	switch (curViewType) {
 	case kViewEga: // SCI0 (and Amiga 16 colors)
 		isEGA = true;
-	case kViewAmiga: // Amiga (32 colors)
+	case kViewAmiga: // Amiga ECS (32 colors)
+	case kViewAmiga64: // Amiga AGA (64 colors)
 	case kViewVga: // View-format SCI1
 		// LoopCount:WORD MirrorMask:WORD Version:WORD PaletteOffset:WORD LoopOffset0:WORD LoopOffset1:WORD...
 
@@ -396,15 +397,23 @@ void unpackCelData(byte *inBuffer, byte *celBitmap, byte clearColor, int pixelCo
 				if (curByte & 0x07) { // fill with color
 					runLength = curByte & 0x07;
 					curByte = curByte >> 3;
-					while (runLength-- && pixelNr < pixelCount) {
+					while (runLength-- && pixelNr < pixelCount)
 						outPtr[pixelNr++] = curByte;
-					}
 				} else { // fill with transparent
 					runLength = curByte >> 3;
 					pixelNr += runLength;
 				}
 			}
 			break;
+		case kViewAmiga64:
+			// TODO: This isn't 100% right. Implement it fully.
+			while (pixelNr < pixelCount) {
+				curByte = *rlePtr++;
+				runLength = curByte >> 6;
+				memset(outPtr + pixelNr, curByte & 0x3F, MIN<uint16>(runLength, pixelCount - pixelNr));
+				pixelNr += runLength;
+			}
+			break;
 		case kViewVga:
 		case kViewVga11:
 			while (pixelNr < pixelCount) {
@@ -432,6 +441,7 @@ void unpackCelData(byte *inBuffer, byte *celBitmap, byte clearColor, int pixelCo
 			error("Unsupported picture viewtype");
 		}
 	} else {
+		// decompression for data that has two separate streams (probably a SCI 1.1 view)
 		if (isMacSci11ViewData) {
 			// KQ6/Freddy Pharkas use byte lengths, all others use uint16
 			// The SCI devs must have realized that a max of 255 pixels wide
@@ -457,7 +467,6 @@ void unpackCelData(byte *inBuffer, byte *celBitmap, byte clearColor, int pixelCo
 				pixelNr = pixelLine + width;
 			}
 		} else {
-			// decompression for data that has two separate streams (probably SCI 1.1 view)
 			while (pixelNr < pixelCount) {
 				curByte = *rlePtr++;
 				runLength = curByte & 0x3F;
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 002f520..7a4534d 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -948,15 +948,18 @@ void ResourceManager::init(bool initFromFallbackDetector) {
 	case kViewEga:
 		debugC(1, kDebugLevelResMan, "resMan: Detected EGA graphic resources");
 		break;
+	case kViewAmiga:
+		debugC(1, kDebugLevelResMan, "resMan: Detected Amiga ECS graphic resources");
+		break;
+	case kViewAmiga64:
+		debugC(1, kDebugLevelResMan, "resMan: Detected Amiga AGA graphic resources");
+		break;
 	case kViewVga:
 		debugC(1, kDebugLevelResMan, "resMan: Detected VGA graphic resources");
 		break;
 	case kViewVga11:
 		debugC(1, kDebugLevelResMan, "resMan: Detected SCI1.1 VGA graphic resources");
 		break;
-	case kViewAmiga:
-		debugC(1, kDebugLevelResMan, "resMan: Detected Amiga graphic resources");
-		break;
 	default:
 #ifdef ENABLE_SCI32
 		error("resMan: Couldn't determine view type");
@@ -2057,7 +2060,13 @@ ViewType ResourceManager::detectViewType() {
 
 			switch (res->data[1]) {
 			case 128:
-				// If the 2nd byte is 128, it's a VGA game
+				// If the 2nd byte is 128, it's a VGA game.
+				// However, Longbow Amiga (AGA, 64 colors), also sets this byte
+				// to 128, but it's a mixed VGA/Amiga format. Detect this from
+				// the platform here.
+				if (g_sci && g_sci->getPlatform() == Common::kPlatformAmiga)
+					return kViewAmiga64;
+
 				return kViewVga;
 			case 0:
 				// EGA or Amiga, try to read as Amiga view
@@ -2264,7 +2273,7 @@ void ResourceManager::detectSciVersion() {
 	case kResVersionKQ5FMT:
 		s_sciVersion = SCI_VERSION_1_MIDDLE;
 		// Amiga SCI1 middle games are actually SCI1 late
-		if (_viewType == kViewAmiga)
+		if (_viewType == kViewAmiga || _viewType == kViewAmiga64)
 			s_sciVersion = SCI_VERSION_1_LATE;
 		return;
 	case kResVersionSci1Late:






More information about the Scummvm-git-logs mailing list