aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/lure/palette.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/engines/lure/palette.cpp b/engines/lure/palette.cpp
index 64bc38da76..bf862d5ab4 100644
--- a/engines/lure/palette.cpp
+++ b/engines/lure/palette.cpp
@@ -119,14 +119,30 @@ void Palette::convertRgb64Palette(const byte *srcPalette, uint16 srcNumEntries)
}
}
+// EGA palette definition copied from DOSBox 0.72
+static byte ega_palette[64][3] =
+{
+ {0x00,0x00,0x00}, {0x00,0x00,0x2a}, {0x00,0x2a,0x00}, {0x00,0x2a,0x2a}, {0x2a,0x00,0x00}, {0x2a,0x00,0x2a}, {0x2a,0x15,0x00}, {0x2a,0x2a,0x2a},
+ {0x00,0x00,0x00}, {0x00,0x00,0x2a}, {0x00,0x2a,0x00}, {0x00,0x2a,0x2a}, {0x2a,0x00,0x00}, {0x2a,0x00,0x2a}, {0x2a,0x15,0x00}, {0x2a,0x2a,0x2a},
+ {0x15,0x15,0x15}, {0x15,0x15,0x3f}, {0x15,0x3f,0x15}, {0x15,0x3f,0x3f}, {0x3f,0x15,0x15}, {0x3f,0x15,0x3f}, {0x3f,0x3f,0x15}, {0x3f,0x3f,0x3f},
+ {0x15,0x15,0x15}, {0x15,0x15,0x3f}, {0x15,0x3f,0x15}, {0x15,0x3f,0x3f}, {0x3f,0x15,0x15}, {0x3f,0x15,0x3f}, {0x3f,0x3f,0x15}, {0x3f,0x3f,0x3f},
+ {0x00,0x00,0x00}, {0x00,0x00,0x2a}, {0x00,0x2a,0x00}, {0x00,0x2a,0x2a}, {0x2a,0x00,0x00}, {0x2a,0x00,0x2a}, {0x2a,0x15,0x00}, {0x2a,0x2a,0x2a},
+ {0x00,0x00,0x00}, {0x00,0x00,0x2a}, {0x00,0x2a,0x00}, {0x00,0x2a,0x2a}, {0x2a,0x00,0x00}, {0x2a,0x00,0x2a}, {0x2a,0x15,0x00}, {0x2a,0x2a,0x2a},
+ {0x15,0x15,0x15}, {0x15,0x15,0x3f}, {0x15,0x3f,0x15}, {0x15,0x3f,0x3f}, {0x3f,0x15,0x15}, {0x3f,0x15,0x3f}, {0x3f,0x3f,0x15}, {0x3f,0x3f,0x3f},
+ {0x15,0x15,0x15}, {0x15,0x15,0x3f}, {0x15,0x3f,0x15}, {0x15,0x3f,0x3f}, {0x3f,0x15,0x15}, {0x3f,0x15,0x3f}, {0x3f,0x3f,0x15}, {0x3f,0x3f,0x3f}
+};
+
void Palette::convertEGAPalette(const byte *srcPalette) {
byte *pDest = _palette->data();
const byte *pSrc = srcPalette;
for (int index = 0; index < 16; ++index, ++pSrc) {
- *pDest++ = (((*pSrc >> 5) & 1) | ((*pSrc >> 1) & 2)) * 0x55;
- *pDest++ = (((*pSrc >> 4) & 1) | (*pSrc & 2)) * 0x55;
- *pDest++ = (((*pSrc >> 3) & 1) | ((*pSrc << 1) & 2)) * 0x55;
+ // Handle RGB components of entry
+ assert(*pSrc < 64);
+ byte *v = &ega_palette[*pSrc][0];
+ *pDest++ = *v++ * 4;
+ *pDest++ = *v++ * 4;
+ *pDest++ = *v++ * 4;
*pDest++ = 0;
}
}