From 2502038e73e19dd5cf819834369fffa6e86caa7d Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Tue, 25 May 2010 12:53:35 +0000 Subject: SCI: sci1.1 uses hardcoded white for picture cel data instead of the value specified in header - fixes pixel glitches in island of dr. brain title, sq4 title and qfg3 room during intro svn-id: r49213 --- engines/sci/graphics/picture.cpp | 19 ++++++++++++------- engines/sci/graphics/picture.h | 8 +++++++- 2 files changed, 19 insertions(+), 8 deletions(-) (limited to 'engines/sci/graphics') diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp index e08547c4d9..f186e09545 100644 --- a/engines/sci/graphics/picture.cpp +++ b/engines/sci/graphics/picture.cpp @@ -111,7 +111,7 @@ void GfxPicture::drawSci11Vga() { // display Cel-data if (has_cel) - drawCelData(inbuffer, size, cel_headerPos, cel_RlePos, cel_LiteralPos, 0, 0, false); + drawCelData(inbuffer, size, cel_headerPos, cel_RlePos, cel_LiteralPos, 0, 0, SCI_PICTURE_CELTYPE_SCI11); // process vector data drawVectorData(inbuffer + vector_dataPos, vector_size); @@ -156,14 +156,14 @@ void GfxPicture::drawSci32Vga(int16 celNo) { cel_LiteralPos = READ_LE_UINT32(inbuffer + cel_headerPos + 28); cel_relXpos = READ_LE_UINT16(inbuffer + cel_headerPos + 38); cel_relYpos = READ_LE_UINT16(inbuffer + cel_headerPos + 40); - drawCelData(inbuffer, size, cel_headerPos, cel_RlePos, cel_LiteralPos, cel_relXpos, cel_relYpos, true); + drawCelData(inbuffer, size, cel_headerPos, cel_RlePos, cel_LiteralPos, cel_relXpos, cel_relYpos, SCI_PICTURE_CELTYPE_SCI32); cel_headerPos += 42; celCount--; } } #endif -void GfxPicture::drawCelData(byte *inbuffer, int size, int headerPos, int rlePos, int literalPos, int16 callerX, int16 callerY, bool hasSci32Header) { +void GfxPicture::drawCelData(byte *inbuffer, int size, int headerPos, int rlePos, int literalPos, int16 callerX, int16 callerY, int celType) { byte *celBitmap = NULL; byte *ptr = NULL; byte *headerPtr = inbuffer + headerPos; @@ -180,11 +180,16 @@ void GfxPicture::drawCelData(byte *inbuffer, int size, int headerPos, int rlePos int pixelNr, pixelCount; #ifdef ENABLE_SCI32 - if (!hasSci32Header) { + if (celType != SCI_PICTURE_CELTYPE_SCI32) { #endif displaceX = (signed char)headerPtr[4]; displaceY = (unsigned char)headerPtr[5]; - clearColor = headerPtr[6]; + if (celType == SCI_PICTURE_CELTYPE_SCI11) { + // SCI1.1 uses hardcoded clearcolor for pictures, even if cel header specifies otherwise + clearColor = _screen->getColorWhite(); + } else { + clearColor = headerPtr[6]; + } #ifdef ENABLE_SCI32 } else { displaceX = READ_LE_UINT16(headerPtr + 4); // probably signed?!? @@ -586,7 +591,7 @@ void GfxPicture::drawVectorData(byte *data, int dataSize) { vectorGetAbsCoordsNoMirror(data, curPos, x, y); size = READ_LE_UINT16(data + curPos); curPos += 2; _priority = pic_priority; // set global priority so the cel gets drawn using current priority as well - drawCelData(data, _resource->size, curPos, curPos + 8, 0, x, y, false); + drawCelData(data, _resource->size, curPos, curPos + 8, 0, x, y, SCI_PICTURE_CELTYPE_REGULAR); curPos += size; break; case PIC_OPX_EGA_SET_PRIORITY_TABLE: @@ -628,7 +633,7 @@ void GfxPicture::drawVectorData(byte *data, int dataSize) { _priority = pic_priority; // set global priority so the cel gets drawn using current priority as well if (pic_priority == 255) _priority = 0; // if priority not set, use priority 0 - drawCelData(data, _resource->size, curPos, curPos + 8, 0, x, y, false); + drawCelData(data, _resource->size, curPos, curPos + 8, 0, x, y, SCI_PICTURE_CELTYPE_REGULAR); curPos += size; break; case PIC_OPX_VGA_PRIORITY_TABLE_EQDIST: diff --git a/engines/sci/graphics/picture.h b/engines/sci/graphics/picture.h index 3374c33b52..ba6052b059 100644 --- a/engines/sci/graphics/picture.h +++ b/engines/sci/graphics/picture.h @@ -32,6 +32,12 @@ namespace Sci { #define SCI_PATTERN_CODE_USE_TEXTURE 0x20 #define SCI_PATTERN_CODE_PENSIZE 0x07 +enum { + SCI_PICTURE_CELTYPE_REGULAR = 0, + SCI_PICTURE_CELTYPE_SCI11 = 1, + SCI_PICTURE_CELTYPE_SCI32 = 2 +}; + class GfxPorts; class GfxScreen; class GfxPalette; @@ -57,7 +63,7 @@ private: void initData(GuiResourceId resourceId); void reset(); void drawSci11Vga(); - void drawCelData(byte *inbuffer, int size, int headerPos, int rlePos, int literalPos, int16 callerX, int16 callerY, bool hasSci32Header); + void drawCelData(byte *inbuffer, int size, int headerPos, int rlePos, int literalPos, int16 callerX, int16 callerY, int celType); void drawVectorData(byte *data, int size); bool vectorIsNonOpcode(byte pixel); void vectorGetAbsCoords(byte *data, int &curPos, int16 &x, int16 &y); -- cgit v1.2.3