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

This commit is contained in:
md5 2011-03-07 13:23:52 +02:00
parent df1a800d01
commit 4ddc66d68e
5 changed files with 38 additions and 21 deletions

View File

@ -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
};

View File

@ -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");

View File

@ -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;

View File

@ -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;

View File

@ -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: