aboutsummaryrefslogtreecommitdiff
path: root/engines/mads
diff options
context:
space:
mode:
authorPaul Gilbert2014-03-11 21:48:16 -0400
committerPaul Gilbert2014-03-11 21:48:16 -0400
commitbe1a53062a21b6af27b504c64c1ddf8b33f0880a (patch)
treef8591ed79ed2aa491b875c7b1f94762d02e557d4 /engines/mads
parent41e86d553e087e1b4276748064fb5893859196b2 (diff)
downloadscummvm-rg350-be1a53062a21b6af27b504c64c1ddf8b33f0880a.tar.gz
scummvm-rg350-be1a53062a21b6af27b504c64c1ddf8b33f0880a.tar.bz2
scummvm-rg350-be1a53062a21b6af27b504c64c1ddf8b33f0880a.zip
MADS: Convert 6 bit palettes to 8 bit values
Diffstat (limited to 'engines/mads')
-rw-r--r--engines/mads/palette.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp
index e63d9c03ed..aeb97d2ff2 100644
--- a/engines/mads/palette.cpp
+++ b/engines/mads/palette.cpp
@@ -28,10 +28,12 @@
namespace MADS {
+#define VGA_COLOR_TRANS(x) (((((int)(x)) + 1) << 2) - 1)
+
void RGB6::load(Common::SeekableReadStream *f) {
- r = f->readByte();
- g = f->readByte();
- b = f->readByte();
+ r = VGA_COLOR_TRANS(f->readByte());
+ g = VGA_COLOR_TRANS(f->readByte());
+ b = VGA_COLOR_TRANS(f->readByte());
_palIndex = f->readByte();
_u2 = f->readByte();
_flags = f->readByte();
@@ -347,8 +349,6 @@ int RGBList::scan() {
/*------------------------------------------------------------------------*/
-#define VGA_COLOR_TRANS(x) (x == 0x3f ? 255 : x << 2)
-
Palette::Palette(MADSEngine *vm) : _vm(vm), _paletteUsage(vm) {
reset();
@@ -566,9 +566,9 @@ void Palette::initVGAPalette(byte *palette) {
int vcx = 0;
int var4 = vdx;
do {
- *destP++ = (var8) ? vdi & 0xFF : vbx & 0XFF;
- *destP++ = (var4) ? vdi & 0xFF : vbx & 0XFF;
- *destP++ = (vcx) ? vdi & 0xFF : vbx & 0XFF;
+ *destP++ = VGA_COLOR_TRANS((var8) ? vdi & 0xFF : vbx & 0XFF);
+ *destP++ = VGA_COLOR_TRANS((var4) ? vdi & 0xFF : vbx & 0XFF);
+ *destP++ = VGA_COLOR_TRANS((vcx) ? vdi & 0xFF : vbx & 0XFF);
} while (++vcx < 2);
var6 += 2;