Skip to content

Commit

Permalink
TINSEL: Fix black/white colors in the Mac version of DW1
Browse files Browse the repository at this point in the history
  • Loading branch information
bluegr committed Apr 12, 2013
1 parent 53e8243 commit 94b328f
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions engines/tinsel/palette.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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]);
Expand All @@ -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);
}
}
Expand All @@ -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]);
Expand Down

0 comments on commit 94b328f

Please sign in to comment.