aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authormd52011-03-07 13:23:52 +0200
committermd52011-03-07 13:23:52 +0200
commit4ddc66d68ef1439ceb669658ea2651a6a5a06597 (patch)
tree18ad30cacc91ec7d224e4b559893f2b5b9b7f8a4 /engines/sci
parentdf1a800d01918ddda9159e3b9f42e8ef8d701456 (diff)
downloadscummvm-rg350-4ddc66d68ef1439ceb669658ea2651a6a5a06597.tar.gz
scummvm-rg350-4ddc66d68ef1439ceb669658ea2651a6a5a06597.tar.bz2
scummvm-rg350-4ddc66d68ef1439ceb669658ea2651a6a5a06597.zip
SCI: Initial handling of the views in Longbow Amiga. Still not right
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/graphics/helpers.h3
-rw-r--r--engines/sci/graphics/palette.cpp16
-rw-r--r--engines/sci/graphics/picture.cpp4
-rw-r--r--engines/sci/graphics/view.cpp17
-rw-r--r--engines/sci/resource.cpp19
5 files changed, 38 insertions, 21 deletions
diff --git a/engines/sci/graphics/helpers.h b/engines/sci/graphics/helpers.h
index 1a87e566d5..343f3c7e6e 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 3b3596a336..5a6b1859cd 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 6a3767a0c8..e60a62e423 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 a6c0805f65..fd74714495 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 002f520935..7a4534d3ac 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: