TINSEL: Fix black/white colors in the Mac version of DW1

This commit is contained in:
Filippos Karapetis 2013-04-12 06:46:34 +03:00
parent 53e82436e6
commit 94b328fa7f

View File

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