From 94b328fa7fc0b4f2cc5bb9e8b20ca8a771b3f7f4 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 12 Apr 2013 06:46:34 +0300 Subject: TINSEL: Fix black/white colors in the Mac version of DW1 --- engines/tinsel/palette.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'engines/tinsel') diff --git a/engines/tinsel/palette.cpp b/engines/tinsel/palette.cpp index 04018172c0..c2ba40b26d 100644 --- a/engines/tinsel/palette.cpp +++ b/engines/tinsel/palette.cpp @@ -170,10 +170,14 @@ void PalettesToVideoDAC() { pal[i * 3 + 2] = TINSEL_GetBValue(pColors[i]); } - // In DW1 Mac, color 254 should be black, like in the PC version. - // We fix it here. + // Swap black/white colors in the Mac version. + // We need to swap the current black/white values so that screen fade + // in/out is done correctly. if (TinselV1Mac) { - pal[254 * 3 + 0] = pal[254 * 3 + 1] = pal[254 * 3 + 2] = 0; + byte macWhite = pal[ 0 * 3 + 0]; + byte macBlack = pal[254 * 3 + 0]; + pal[254 * 3 + 0] = pal[254 * 3 + 1] = pal[254 * 3 + 2] = macWhite; + pal[ 0 * 3 + 0] = pal[ 0 * 3 + 1] = pal[ 0 * 3 + 2] = macBlack; } // update the system palette @@ -552,7 +556,8 @@ void CreateTranslucentPalette(SCNHANDLE hPalette) { // leave background color alone g_transPalette[0] = 0; - for (uint i = 0; i < FROM_32(pPal->numColors); i++) { + int32 numColors = FROM_32(pPal->numColors); + for (int32 i = 0; i < numColors; i++) { // get the RGB color model values uint8 red = TINSEL_GetRValue(pPal->palRGB[i]); uint8 green = TINSEL_GetGValue(pPal->palRGB[i]); @@ -564,7 +569,8 @@ void CreateTranslucentPalette(SCNHANDLE hPalette) { // map the Value field to one of the 4 colors reserved for the translucent palette val /= 63; - g_transPalette[i + 1] = (uint8)((val == 0) ? 0 : val + + byte blackColorIndex = (!TinselV1Mac) ? 0 : 255; + g_transPalette[i + 1] = (uint8)((val == 0) ? blackColorIndex : val + (TinselV2 ? TranslucentColor() : COL_HILIGHT) - 1); } } @@ -575,12 +581,12 @@ void CreateTranslucentPalette(SCNHANDLE hPalette) { void CreateGhostPalette(SCNHANDLE hPalette) { // get a pointer to the palette PALETTE *pPal = (PALETTE *)LockMem(hPalette); - int i; // leave background color alone g_ghostPalette[0] = 0; - for (i = 0; i < (int)FROM_32(pPal->numColors); i++) { + int32 numColors = FROM_32(pPal->numColors); + for (int32 i = 0; i < numColors; i++) { // get the RGB color model values uint8 red = TINSEL_GetRValue(pPal->palRGB[i]); uint8 green = TINSEL_GetGValue(pPal->palRGB[i]); -- cgit v1.2.3