From d92dbac6726d1beb8a9986021e702f76cd6aff8e Mon Sep 17 00:00:00 2001 From: Kari Salminen Date: Wed, 30 Jan 2008 01:58:43 +0000 Subject: Fix for bug #1881170 (AGI: palette-related glitches reported). Made AGIPAL use only the lowest 6 bits of each color component (This should be the way the original AGIPAL-hack behaves too). svn-id: r30708 --- engines/agi/graphics.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'engines') diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp index 3cef23bfa1..a4554919de 100644 --- a/engines/agi/graphics.cpp +++ b/engines/agi/graphics.cpp @@ -864,18 +864,20 @@ void GfxMgr::setAGIPal(int p0) { return; } - // Check that all components are maximum 6 bits (VGA used 6 bits per color component). - // Makes at least Naturette 2's colors not be messed up anymore (Naturette 2 provides - // AGIPAL-files that use 8 bits per color component. Haven't seen any other game that - // provides such files and don't know of *any* AGI interpreter that supports such files. - // So I presume they have been left over to Naturette 2's release file by accident). + // Use only the lowest 6 bits of each color component (Red, Green and Blue) + // because VGA used only 6 bits per color component (i.e. VGA had 18-bit colors). + // This should now be identical to the original AGIPAL-hack's behaviour. + bool validVgaPalette = true; for (int i = 0; i < 16 * 3; i++) { if (_agipalPalette[i] >= (1 << 6)) { - warning("Invalid AGIPAL palette (Over 6 bits per color component) in '%s'. Not changing palette", filename); - return; + _agipalPalette[i] &= 0x3F; // Leave only the lowest 6 bits of each color component + validVgaPalette = false; } } + if (!validVgaPalette) + warning("Invalid AGIPAL palette (Over 6 bits per color component) in '%s'. Using only the lowest 6 bits per color component", filename); + _agipalFileNum = p0; initPalette(_agipalPalette); -- cgit v1.2.3