aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2008-01-05 07:20:26 +0000
committerPaul Gilbert2008-01-05 07:20:26 +0000
commit610880dc674170304b4c6c550705b55a9511712e (patch)
treeba7bb15c4bc7549584131fe0e94b7d2c0f8fb4ff /engines
parentb75d196e889497edc55f39feecf64da27eae1c4e (diff)
downloadscummvm-rg350-610880dc674170304b4c6c550705b55a9511712e.tar.gz
scummvm-rg350-610880dc674170304b4c6c550705b55a9511712e.tar.bz2
scummvm-rg350-610880dc674170304b4c6c550705b55a9511712e.zip
Corrected the RGB values generated for a given EGA palette index
svn-id: r30224
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;
}
}