2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2004-01-04 14:35:46 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2004-01-04 14:35:46 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2004-12-27 22:08:20 +00:00
|
|
|
#include "common/system.h"
|
2011-04-24 08:34:27 +00:00
|
|
|
#include "common/textconsole.h"
|
2004-01-04 14:35:46 +00:00
|
|
|
#include "common/util.h"
|
2005-04-10 12:59:17 +00:00
|
|
|
|
2011-04-24 08:34:27 +00:00
|
|
|
#include "graphics/palette.h"
|
|
|
|
|
2004-01-04 14:35:46 +00:00
|
|
|
#include "scumm/resource.h"
|
2009-03-20 16:33:58 +00:00
|
|
|
#include "scumm/scumm.h"
|
2009-03-20 22:33:45 +00:00
|
|
|
#include "scumm/scumm_v6.h"
|
2009-03-20 16:33:58 +00:00
|
|
|
#include "scumm/scumm_v8.h"
|
2005-04-10 12:59:17 +00:00
|
|
|
#include "scumm/util.h"
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
#include "scumm/charset.h"
|
2004-01-04 14:35:46 +00:00
|
|
|
|
|
|
|
namespace Scumm {
|
|
|
|
|
2009-08-16 00:20:23 +00:00
|
|
|
uint8 *ScummEngine::getHEPaletteSlot(uint16 palSlot) {
|
|
|
|
assertRange(0, palSlot, _numPalettes, "palette");
|
|
|
|
|
|
|
|
if (_game.heversion >= 99) {
|
|
|
|
if (palSlot)
|
|
|
|
return _hePalettes + palSlot * _hePaletteSlot + 768;
|
|
|
|
else
|
|
|
|
return _hePalettes + _hePaletteSlot + 768;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint16 ScummEngine::get16BitColor(uint8 r, uint8 g, uint8 b) {
|
2011-06-15 20:01:24 +00:00
|
|
|
return _outputPixelFormat.RGBToColor(r, g, b);
|
2009-08-16 00:20:23 +00:00
|
|
|
}
|
|
|
|
|
2006-04-29 16:24:39 +00:00
|
|
|
void ScummEngine::resetPalette() {
|
2009-08-24 12:39:03 +00:00
|
|
|
static const byte tableC64Palette[] = {
|
2010-08-24 12:24:23 +00:00
|
|
|
#if 1 // VICE-based palette. See bug #2847001
|
|
|
|
0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x7E, 0x35, 0x2B, 0x6E, 0xB7, 0xC1,
|
|
|
|
0x7F, 0x3B, 0xA6, 0x5C, 0xA0, 0x35, 0x33, 0x27, 0x99, 0xCB, 0xD7, 0x65,
|
|
|
|
0x85, 0x53, 0x1C, 0x50, 0x3C, 0x00, 0xB4, 0x6B, 0x61, 0x4A, 0x4A, 0x4A,
|
|
|
|
0x75, 0x75, 0x75, 0xA3, 0xE7, 0x7C, 0x70, 0x64, 0xD6, 0xA3, 0xA3, 0xA3,
|
|
|
|
#else
|
2009-08-24 12:39:03 +00:00
|
|
|
0x00, 0x00, 0x00, 0xFD, 0xFE, 0xFC, 0xBE, 0x1A, 0x24, 0x30, 0xE6, 0xC6,
|
|
|
|
0xB4, 0x1A, 0xE2, 0x1F, 0xD2, 0x1E, 0x21, 0x1B, 0xAE, 0xDF, 0xF6, 0x0A,
|
|
|
|
0xB8, 0x41, 0x04, 0x6A, 0x33, 0x04, 0xFE, 0x4A, 0x57, 0x42, 0x45, 0x40,
|
|
|
|
0x70, 0x74, 0x6F, 0x59, 0xFE, 0x59, 0x5F, 0x53, 0xFE, 0xA4, 0xA7, 0xA2,
|
2010-08-24 12:24:23 +00:00
|
|
|
#endif
|
2009-08-24 12:39:03 +00:00
|
|
|
// Use 17 color table for v1 games to allow correct color for inventory and
|
|
|
|
// sentence line. Original games used some kind of dynamic color table
|
|
|
|
// remapping between rooms.
|
2010-10-25 03:21:49 +00:00
|
|
|
0x7F, 0x3B, 0xA6
|
2009-08-24 12:39:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const byte tableNESPalette[] = {
|
|
|
|
/* 0x1D */
|
2009-08-29 19:35:06 +00:00
|
|
|
0x24, 0x24, 0x24, 0x00, 0x24, 0x92, 0x00, 0x00, 0xDB, 0x6D, 0x49, 0xDB,
|
2009-08-24 12:39:03 +00:00
|
|
|
0x92, 0x00, 0x6D, 0xB6, 0x00, 0x6D, 0xB6, 0x24, 0x00, 0x92, 0x49, 0x00,
|
|
|
|
0x6D, 0x49, 0x00, 0x24, 0x49, 0x00, 0x00, 0x6D, 0x24, 0x00, 0x92, 0x00,
|
|
|
|
0x00, 0x49, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
|
|
|
0xB6, 0xB6, 0xB6, 0x00, 0x6D, 0xDB, 0x00, 0x49, 0xFF, 0x92, 0x00, 0xFF,
|
|
|
|
0xB6, 0x00, 0xFF, 0xFF, 0x00, 0x92, 0xFF, 0x00, 0x00, 0xDB, 0x6D, 0x00,
|
|
|
|
0x92, 0x6D, 0x00, 0x24, 0x92, 0x00, 0x00, 0x92, 0x00, 0x00, 0xB6, 0x6D,
|
|
|
|
/* 0x00 */
|
|
|
|
0x00, 0x92, 0x92, 0x6D, 0x6D, 0x6D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
|
|
|
0xFF, 0xFF, 0xFF, 0x6D, 0xB6, 0xFF, 0x92, 0x92, 0xFF, 0xDB, 0x6D, 0xFF,
|
|
|
|
0xFF, 0x00, 0xFF, 0xFF, 0x6D, 0xFF, 0xFF, 0x92, 0x00, 0xFF, 0xB6, 0x00,
|
|
|
|
0xDB, 0xDB, 0x00, 0x6D, 0xDB, 0x00, 0x00, 0xFF, 0x00, 0x49, 0xFF, 0xDB,
|
|
|
|
0x00, 0xFF, 0xFF, 0x49, 0x49, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
|
|
|
0xFF, 0xFF, 0xFF, 0xB6, 0xDB, 0xFF, 0xDB, 0xB6, 0xFF, 0xFF, 0xB6, 0xFF,
|
|
|
|
0xFF, 0x92, 0xFF, 0xFF, 0xB6, 0xB6, 0xFF, 0xDB, 0x92, 0xFF, 0xFF, 0x49,
|
|
|
|
0xFF, 0xFF, 0x6D, 0xB6, 0xFF, 0x49, 0x92, 0xFF, 0x6D, 0x49, 0xFF, 0xDB,
|
|
|
|
0x92, 0xDB, 0xFF, 0x92, 0x92, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
|
|
};
|
|
|
|
|
|
|
|
static const byte tableAmigaPalette[] = {
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0xBB, 0x00, 0xBB, 0x00, 0x00, 0xBB, 0xBB,
|
|
|
|
0xBB, 0x00, 0x00, 0xBB, 0x00, 0xBB, 0xBB, 0x77, 0x00, 0xBB, 0xBB, 0xBB,
|
|
|
|
0x77, 0x77, 0x77, 0x77, 0x77, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0xFF,
|
|
|
|
0xFF, 0x88, 0x88, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF
|
|
|
|
};
|
|
|
|
|
|
|
|
static const byte tableAmigaMIPalette[] = {
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0xAA, 0x00, 0x88, 0x22, 0x00, 0x66, 0x77,
|
|
|
|
0xBB, 0x66, 0x66, 0xAA, 0x22, 0xAA, 0x88, 0x55, 0x22, 0x77, 0x77, 0x77,
|
|
|
|
0x33, 0x33, 0x33, 0x22, 0x55, 0xDD, 0x22, 0xDD, 0x44, 0x00, 0xCC, 0xFF,
|
|
|
|
0xFF, 0x99, 0x99, 0xFF, 0x55, 0xFF, 0xFF, 0xFF, 0x77, 0xFF, 0xFF, 0xFF
|
|
|
|
};
|
|
|
|
|
|
|
|
static const byte tableEGAPalette[] = {
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0xAA, 0x00, 0xAA, 0x00, 0x00, 0xAA, 0xAA,
|
|
|
|
0xAA, 0x00, 0x00, 0xAA, 0x00, 0xAA, 0xAA, 0x55, 0x00, 0xAA, 0xAA, 0xAA,
|
|
|
|
0x55, 0x55, 0x55, 0x55, 0x55, 0xFF, 0x55, 0xFF, 0x55, 0x55, 0xFF, 0xFF,
|
|
|
|
0xFF, 0x55, 0x55, 0xFF, 0x55, 0xFF, 0xFF, 0xFF, 0x55, 0xFF, 0xFF, 0xFF
|
|
|
|
};
|
|
|
|
|
|
|
|
static const byte tableV1Palette[] = {
|
|
|
|
0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xAA, 0x00, 0x00, 0x00, 0xAA, 0xAA,
|
|
|
|
0xAA, 0x00, 0xAA, 0x00, 0xAA, 0x00, 0x00, 0x00, 0xAA, 0xFF, 0xFF, 0x55,
|
|
|
|
0xFF, 0x55, 0x55, 0xAA, 0x55, 0x00, 0xFF, 0x55, 0x55, 0x55, 0x55, 0x55,
|
|
|
|
0xAA, 0xAA, 0xAA, 0x55, 0xFF, 0x55, 0x55, 0x55, 0xFF, 0x55, 0x55, 0x55,
|
|
|
|
|
|
|
|
0xFF, 0x55, 0xFF
|
|
|
|
};
|
|
|
|
|
|
|
|
static const byte tableCGAPalette[] = {
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0xA8, 0xA8, 0xA8, 0x00, 0xA8, 0xA8, 0xA8, 0xA8
|
|
|
|
};
|
|
|
|
|
|
|
|
static const byte tableHercAPalette[] = {
|
|
|
|
0x00, 0x00, 0x00, 0xAE, 0x69, 0x38
|
|
|
|
};
|
|
|
|
|
|
|
|
static const byte tableHercGPalette[] = {
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0xFF, 0x00
|
|
|
|
};
|
|
|
|
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
#ifdef USE_RGB_COLOR
|
2010-10-05 19:04:52 +00:00
|
|
|
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
static const byte tableTownsV3Palette[] = {
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0x00, 0xA0, 0xA0,
|
|
|
|
0xA0, 0x00, 0x00, 0xA0, 0x00, 0xA0, 0xA0, 0x60, 0x00, 0xA0, 0xA0, 0xA0,
|
|
|
|
0x60, 0x60, 0x60, 0x60, 0x60, 0xE0, 0x00, 0xE0, 0x00, 0x00, 0xE0, 0xE0,
|
|
|
|
0xE0, 0x80, 0x80, 0xE0, 0x00, 0xE0, 0xE0, 0xE0, 0x00, 0xE0, 0xE0, 0xE0
|
|
|
|
};
|
|
|
|
|
|
|
|
static const byte tableTownsLoomPalette[] = {
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0xAB, 0x00, 0xAB, 0x00, 0x00, 0xAB, 0xAB,
|
|
|
|
0xAB, 0x00, 0x00, 0x69, 0x29, 0x45, 0x8C, 0x4D, 0x14, 0xAB, 0xAB, 0xAB,
|
|
|
|
0x57, 0x3F, 0x57, 0x57, 0x57, 0xFF, 0x57, 0xFF, 0x57, 0x57, 0xFF, 0xFF,
|
|
|
|
0xFF, 0x57, 0x57, 0xD6, 0x94, 0x40, 0xFF, 0xFF, 0x57, 0xFF, 0xFF, 0xFF
|
|
|
|
};
|
2010-10-05 19:04:52 +00:00
|
|
|
#endif
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
#endif
|
|
|
|
|
2006-05-29 12:45:11 +00:00
|
|
|
if (_game.version <= 1) {
|
2007-02-25 07:23:52 +00:00
|
|
|
if (_game.platform == Common::kPlatformApple2GS) {
|
|
|
|
// TODO: unique palette?
|
2009-08-24 12:39:03 +00:00
|
|
|
setPaletteFromTable(tableC64Palette, sizeof(tableC64Palette) / 3);
|
2007-02-25 07:23:52 +00:00
|
|
|
} else if (_game.platform == Common::kPlatformC64) {
|
2009-08-24 12:39:03 +00:00
|
|
|
setPaletteFromTable(tableC64Palette, sizeof(tableC64Palette) / 3);
|
2006-04-29 16:24:39 +00:00
|
|
|
} else if (_game.platform == Common::kPlatformNES) {
|
2009-08-24 12:39:03 +00:00
|
|
|
setPaletteFromTable(tableNESPalette, sizeof(tableNESPalette) / 3);
|
2006-04-29 16:24:39 +00:00
|
|
|
} else {
|
2009-08-24 12:39:03 +00:00
|
|
|
setPaletteFromTable(tableV1Palette, sizeof(tableV1Palette) / 3);
|
|
|
|
if (_game.id == GID_ZAK)
|
|
|
|
setPalColor(15, 170, 170, 170);
|
2006-04-29 16:24:39 +00:00
|
|
|
}
|
|
|
|
} else if (_game.features & GF_16COLOR) {
|
2009-08-24 12:39:03 +00:00
|
|
|
bool setupCursor = false;
|
|
|
|
|
2006-04-29 16:24:39 +00:00
|
|
|
switch (_renderMode) {
|
|
|
|
case Common::kRenderEGA:
|
2009-08-24 12:39:03 +00:00
|
|
|
setPaletteFromTable(tableEGAPalette, sizeof(tableEGAPalette) / 3);
|
2006-04-29 16:24:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Common::kRenderAmiga:
|
2009-08-24 12:39:03 +00:00
|
|
|
setPaletteFromTable(tableAmigaPalette, sizeof(tableAmigaPalette) / 3);
|
2006-04-29 16:24:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Common::kRenderCGA:
|
2009-08-24 12:39:03 +00:00
|
|
|
setPaletteFromTable(tableCGAPalette, sizeof(tableCGAPalette) / 3);
|
|
|
|
setupCursor = true;
|
2006-04-29 16:24:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Common::kRenderHercA:
|
2009-08-24 12:39:03 +00:00
|
|
|
setPaletteFromTable(tableHercAPalette, sizeof(tableHercAPalette) / 3);
|
|
|
|
setupCursor = true;
|
|
|
|
break;
|
|
|
|
|
2006-04-29 16:24:39 +00:00
|
|
|
case Common::kRenderHercG:
|
2009-08-24 12:39:03 +00:00
|
|
|
setPaletteFromTable(tableHercGPalette, sizeof(tableHercGPalette) / 3);
|
|
|
|
setupCursor = true;
|
2006-04-29 16:24:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if ((_game.platform == Common::kPlatformAmiga) || (_game.platform == Common::kPlatformAtariST))
|
2009-08-24 12:39:03 +00:00
|
|
|
setPaletteFromTable(tableAmigaPalette, sizeof(tableAmigaPalette) / 3);
|
2006-04-29 16:24:39 +00:00
|
|
|
else
|
2009-08-24 12:39:03 +00:00
|
|
|
setPaletteFromTable(tableEGAPalette, sizeof(tableEGAPalette) / 3);
|
|
|
|
}
|
|
|
|
if (setupCursor) {
|
|
|
|
// Setup cursor palette
|
|
|
|
setPalColor( 7, 170, 170, 170);
|
|
|
|
setPalColor( 8, 85, 85, 85);
|
|
|
|
setPalColor(15, 255, 255, 255);
|
2006-04-29 16:24:39 +00:00
|
|
|
}
|
2005-02-20 00:17:22 +00:00
|
|
|
|
2009-08-24 12:39:03 +00:00
|
|
|
} else {
|
|
|
|
if ((_game.platform == Common::kPlatformAmiga) && _game.version == 4) {
|
|
|
|
// if rendermode is set to EGA we use the full palette from the resources
|
2011-05-25 15:17:11 +00:00
|
|
|
// else we initialize and then lock down the first 16 colors.
|
2009-08-24 12:39:03 +00:00
|
|
|
if (_renderMode != Common::kRenderEGA)
|
|
|
|
setPaletteFromTable(tableAmigaMIPalette, sizeof(tableAmigaMIPalette) / 3);
|
2010-10-05 19:04:52 +00:00
|
|
|
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
} else if (_game.platform == Common::kPlatformFMTowns) {
|
|
|
|
if (_game.id == GID_INDY4 || _game.id == GID_MONKEY2)
|
|
|
|
_townsClearLayerFlag = 0;
|
|
|
|
#ifdef USE_RGB_COLOR
|
2011-06-15 20:01:24 +00:00
|
|
|
else if (_game.id == GID_LOOM)
|
|
|
|
towns_setTextPaletteFromPtr(tableTownsLoomPalette);
|
|
|
|
else if (_game.version == 3)
|
|
|
|
towns_setTextPaletteFromPtr(tableTownsV3Palette);
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
#endif
|
2011-02-07 17:52:38 +00:00
|
|
|
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
_townsScreen->toggleLayers(_townsActiveLayerFlags);
|
2010-10-05 19:04:52 +00:00
|
|
|
#endif // DISABLE_TOWNS_DUAL_LAYER_MODE
|
2009-08-24 12:39:03 +00:00
|
|
|
}
|
|
|
|
setDirtyColors(0, 255);
|
|
|
|
}
|
2004-01-04 14:35:46 +00:00
|
|
|
}
|
|
|
|
|
2009-08-24 12:39:03 +00:00
|
|
|
void ScummEngine::setPaletteFromTable(const byte *ptr, int numcolor, int index) {
|
|
|
|
for ( ; numcolor > 0; --numcolor, ++index, ptr += 3)
|
|
|
|
setPalColor( index, ptr[0], ptr[1], ptr[2]);
|
2004-01-04 14:35:46 +00:00
|
|
|
}
|
|
|
|
|
2009-11-22 08:55:36 +00:00
|
|
|
void ScummEngine::colorPCEToRGB(uint16 color, byte *r, byte *g, byte *b) {
|
2009-10-21 12:59:10 +00:00
|
|
|
// 3 bits for each color component: 0xgggrrrbbb
|
2009-11-22 08:49:19 +00:00
|
|
|
*b = ((color) & 0x7) * 0xFF / 0x7;
|
|
|
|
*r = ((color >> 3) & 0x7) * 0xFF / 0x7;
|
|
|
|
*g = ((color >> 6) & 0x7) * 0xFF / 0x7;
|
2009-10-21 12:59:10 +00:00
|
|
|
}
|
|
|
|
|
2009-11-22 08:36:14 +00:00
|
|
|
void ScummEngine::setPCETextPalette(uint8 color) {
|
|
|
|
const uint16 CHARSET_COLORS[16] = {
|
|
|
|
0x0000, 0x0096, 0x0140, 0x0145, 0x0059, 0x002D, 0x00A8, 0x016D,
|
|
|
|
0x0092, 0x016F, 0x01CD, 0x01DF, 0x00F7, 0x00B6, 0x01B0, 0x01B6
|
|
|
|
};
|
|
|
|
|
|
|
|
byte r, g, b;
|
|
|
|
colorPCEToRGB(CHARSET_COLORS[color], &r, &g, &b);
|
|
|
|
setPalColor(15, r, g, b);
|
|
|
|
}
|
|
|
|
|
2009-10-26 12:29:57 +00:00
|
|
|
void ScummEngine::readPCEPalette(const byte **ptr, byte **dest, int numEntries) {
|
2009-10-21 12:59:10 +00:00
|
|
|
byte r, g, b;
|
|
|
|
byte msbs = 0;
|
|
|
|
|
|
|
|
for (int i = 0; i < numEntries; ++i) {
|
|
|
|
if (i % 8 == 0) {
|
|
|
|
// byte contains MSBs (bit 8) for the next 8 bytes
|
|
|
|
msbs = *(*ptr)++;
|
|
|
|
}
|
|
|
|
uint16 msb = (msbs & 0x1) << 8;
|
|
|
|
uint16 paletteEntry = msb | *(*ptr)++;
|
|
|
|
colorPCEToRGB(paletteEntry, &r, &g, &b);
|
|
|
|
*(*dest)++ = r;
|
|
|
|
*(*dest)++ = g;
|
|
|
|
*(*dest)++ = b;
|
|
|
|
msbs >>= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine::setPCEPaletteFromPtr(const byte *ptr) {
|
|
|
|
byte *dest;
|
|
|
|
byte bgSpriteR, bgSpriteG, bgSpriteB;
|
2009-11-22 08:49:19 +00:00
|
|
|
byte charsetR, charsetG, charsetB;
|
2009-10-21 12:59:10 +00:00
|
|
|
|
|
|
|
int paletteOffset = *ptr++;
|
2010-01-25 01:39:44 +00:00
|
|
|
int numPalettes = *ptr++;
|
2009-10-21 12:59:10 +00:00
|
|
|
|
|
|
|
int firstIndex = paletteOffset * 16;
|
|
|
|
int numcolor = numPalettes * 16;
|
|
|
|
|
2010-01-25 01:39:44 +00:00
|
|
|
// the only color over which a background sprite
|
2009-10-21 12:59:10 +00:00
|
|
|
// (bit 7 of the sprite attributes) will be visible
|
|
|
|
colorPCEToRGB(READ_LE_UINT16(ptr), &bgSpriteR, &bgSpriteG, &bgSpriteB);
|
|
|
|
ptr += 2;
|
|
|
|
|
2009-11-22 08:49:19 +00:00
|
|
|
// CHARSET_COLORS[_curTextColor] (unused?)
|
|
|
|
colorPCEToRGB(0x01B6, &charsetR, &charsetG, &charsetB);
|
|
|
|
|
2009-10-21 12:59:10 +00:00
|
|
|
dest = _currentPalette + firstIndex * 3;
|
|
|
|
|
|
|
|
for (int i = 0; i < numPalettes; ++i) {
|
|
|
|
// entry 0
|
|
|
|
*dest++ = bgSpriteR;
|
|
|
|
*dest++ = bgSpriteG;
|
|
|
|
*dest++ = bgSpriteB;
|
|
|
|
|
|
|
|
// entry 1 - 14
|
2009-10-26 12:29:57 +00:00
|
|
|
readPCEPalette(&ptr, &dest, 14);
|
2009-10-21 12:59:10 +00:00
|
|
|
|
2009-11-22 08:49:19 +00:00
|
|
|
// entry 15
|
|
|
|
*dest++ = charsetR;
|
|
|
|
*dest++ = charsetG;
|
|
|
|
*dest++ = charsetB;
|
2009-10-21 12:59:10 +00:00
|
|
|
}
|
|
|
|
|
2009-10-26 09:11:18 +00:00
|
|
|
if (_game.features & GF_16BIT_COLOR) {
|
2009-10-26 14:49:01 +00:00
|
|
|
for (int i = firstIndex; i < firstIndex + numcolor; ++i)
|
2009-10-26 09:11:18 +00:00
|
|
|
_16BitPalette[i] = get16BitColor(_currentPalette[i * 3 + 0], _currentPalette[i * 3 + 1], _currentPalette[i * 3 + 2]);
|
|
|
|
}
|
2009-10-21 12:59:10 +00:00
|
|
|
setDirtyColors(firstIndex, firstIndex + numcolor - 1);
|
|
|
|
}
|
|
|
|
|
2004-09-03 17:27:40 +00:00
|
|
|
void ScummEngine::setPaletteFromPtr(const byte *ptr, int numcolor) {
|
2009-08-24 12:39:03 +00:00
|
|
|
int firstIndex = 0;
|
2004-01-04 14:35:46 +00:00
|
|
|
int i;
|
|
|
|
byte *dest, r, g, b;
|
|
|
|
|
2004-09-03 17:27:40 +00:00
|
|
|
if (numcolor < 0) {
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.features & GF_SMALL_HEADER) {
|
|
|
|
if (_game.features & GF_OLD256)
|
2005-03-31 23:04:46 +00:00
|
|
|
numcolor = READ_LE_UINT16(ptr);
|
2004-09-03 17:27:40 +00:00
|
|
|
else
|
2005-03-31 23:04:46 +00:00
|
|
|
numcolor = READ_LE_UINT16(ptr) / 3;
|
|
|
|
ptr += 2;
|
2004-09-03 17:27:40 +00:00
|
|
|
} else {
|
|
|
|
numcolor = getResourceDataSize(ptr) / 3;
|
|
|
|
}
|
2004-01-04 14:35:46 +00:00
|
|
|
}
|
|
|
|
|
2006-09-16 13:38:43 +00:00
|
|
|
assertRange(0, numcolor, 256, "setPaletteFromPtr: numcolor");
|
2004-01-04 14:35:46 +00:00
|
|
|
|
|
|
|
dest = _currentPalette;
|
|
|
|
|
2009-08-24 12:39:03 +00:00
|
|
|
// Test for Amiga Monkey Island and EGA Mode unset, if true then skip the first 16 colors.
|
|
|
|
if ((_game.platform == Common::kPlatformAmiga) && _game.version == 4 && _renderMode != Common::kRenderEGA) {
|
|
|
|
firstIndex = 16;
|
|
|
|
dest += 3 * 16;
|
|
|
|
ptr += 3 * 16;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = firstIndex; i < numcolor; i++) {
|
2004-01-04 14:35:46 +00:00
|
|
|
r = *ptr++;
|
|
|
|
g = *ptr++;
|
|
|
|
b = *ptr++;
|
|
|
|
|
2005-04-19 07:42:51 +00:00
|
|
|
// Only SCUMM 5/6 games use 6/6/6 style palettes
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.version >= 5 && _game.version <= 6) {
|
2010-01-28 00:28:08 +00:00
|
|
|
if ((_game.heversion <= 74 && i < 15) || i == 15 || r < 252 || g < 252 || b < 252) {
|
2005-04-19 04:12:49 +00:00
|
|
|
*dest++ = r;
|
|
|
|
*dest++ = g;
|
|
|
|
*dest++ = b;
|
|
|
|
} else {
|
|
|
|
dest += 3;
|
|
|
|
}
|
|
|
|
} else {
|
2004-01-04 14:35:46 +00:00
|
|
|
*dest++ = r;
|
|
|
|
*dest++ = g;
|
|
|
|
*dest++ = b;
|
|
|
|
}
|
|
|
|
}
|
2005-04-19 04:12:49 +00:00
|
|
|
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.heversion >= 90 || _game.version == 8) {
|
2005-04-19 04:12:49 +00:00
|
|
|
memcpy(_darkenPalette, _currentPalette, 768);
|
|
|
|
}
|
|
|
|
|
2009-08-24 12:39:03 +00:00
|
|
|
setDirtyColors(firstIndex, numcolor - 1);
|
2004-01-04 14:35:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine::setDirtyColors(int min, int max) {
|
|
|
|
if (_palDirtyMin > min)
|
|
|
|
_palDirtyMin = min;
|
|
|
|
if (_palDirtyMax < max)
|
|
|
|
_palDirtyMax = max;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine::initCycl(const byte *ptr) {
|
|
|
|
int j;
|
|
|
|
ColorCycle *cycl;
|
|
|
|
|
|
|
|
memset(_colorCycle, 0, sizeof(_colorCycle));
|
|
|
|
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.features & GF_SMALL_HEADER) {
|
2004-01-04 14:35:46 +00:00
|
|
|
cycl = _colorCycle;
|
|
|
|
for (j = 0; j < 16; ++j, ++cycl) {
|
|
|
|
uint16 delay = READ_BE_UINT16(ptr);
|
|
|
|
ptr += 2;
|
|
|
|
byte start = *ptr++;
|
|
|
|
byte end = *ptr++;
|
|
|
|
|
|
|
|
if (!delay || delay == 0x0aaa || start >= end)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
cycl->counter = 0;
|
|
|
|
cycl->delay = 16384 / delay;
|
|
|
|
cycl->flags = 2;
|
|
|
|
cycl->start = start;
|
|
|
|
cycl->end = end;
|
|
|
|
}
|
|
|
|
} else {
|
2005-11-01 02:43:54 +00:00
|
|
|
memset(_colorUsedByCycle, 0, sizeof(_colorUsedByCycle));
|
2004-01-04 14:35:46 +00:00
|
|
|
while ((j = *ptr++) != 0) {
|
|
|
|
if (j < 1 || j > 16) {
|
|
|
|
error("Invalid color cycle index %d", j);
|
|
|
|
}
|
|
|
|
cycl = &_colorCycle[j - 1];
|
|
|
|
|
|
|
|
ptr += 2;
|
|
|
|
cycl->counter = 0;
|
|
|
|
cycl->delay = 16384 / READ_BE_UINT16(ptr);
|
|
|
|
ptr += 2;
|
|
|
|
cycl->flags = READ_BE_UINT16(ptr);
|
|
|
|
ptr += 2;
|
|
|
|
cycl->start = *ptr++;
|
|
|
|
cycl->end = *ptr++;
|
2005-11-01 02:43:54 +00:00
|
|
|
|
|
|
|
for (int i = cycl->start; i <= cycl->end; ++i) {
|
|
|
|
_colorUsedByCycle[i] = 1;
|
|
|
|
}
|
2004-01-04 14:35:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine::stopCycle(int i) {
|
|
|
|
ColorCycle *cycl;
|
|
|
|
|
2006-09-16 13:38:43 +00:00
|
|
|
assertRange(0, i, 16, "stopCycle: cycle");
|
2004-01-04 14:35:46 +00:00
|
|
|
if (i != 0) {
|
|
|
|
_colorCycle[i - 1].delay = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0, cycl = _colorCycle; i < 16; i++, cycl++)
|
|
|
|
cycl->delay = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2008-12-04 18:14:36 +00:00
|
|
|
* Cycle the colors in the given palette in the interval [cycleStart, cycleEnd]
|
2004-01-04 14:35:46 +00:00
|
|
|
* either one step forward or backward.
|
|
|
|
*/
|
|
|
|
static void doCyclePalette(byte *palette, int cycleStart, int cycleEnd, int size, bool forward) {
|
|
|
|
byte *start = palette + cycleStart * size;
|
|
|
|
byte *end = palette + cycleEnd * size;
|
|
|
|
int num = cycleEnd - cycleStart;
|
|
|
|
byte tmp[6];
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-01-04 14:35:46 +00:00
|
|
|
assert(size <= 6);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-01-04 14:35:46 +00:00
|
|
|
if (forward) {
|
|
|
|
memmove(tmp, end, size);
|
|
|
|
memmove(start + size, start, num * size);
|
|
|
|
memmove(start, tmp, size);
|
|
|
|
} else {
|
|
|
|
memmove(tmp, start, size);
|
|
|
|
memmove(start, start + size, num * size);
|
|
|
|
memmove(end, tmp, size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adjust an 'indirect' color palette for the color cycling performed on its
|
|
|
|
* master palette. An indirect palette is a palette which contains indices
|
|
|
|
* pointing into another palette - it provides a level of indirection to map
|
|
|
|
* palette colors to other colors. Now when the target palette is cycled, the
|
|
|
|
* indirect palette suddenly point at the wrong color(s). This function takes
|
|
|
|
* care of adjusting an indirect palette by searching through it and replacing
|
|
|
|
* all indices that are in the cycle range by the new (cycled) index.
|
|
|
|
*
|
|
|
|
* Finally, the palette entries still have to be cycled normally.
|
|
|
|
*/
|
|
|
|
static void doCycleIndirectPalette(byte *palette, int cycleStart, int cycleEnd, bool forward) {
|
|
|
|
int num = cycleEnd - cycleStart + 1;
|
|
|
|
int i;
|
|
|
|
int offset = forward ? 1 : num - 1;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-01-04 14:35:46 +00:00
|
|
|
for (i = 0; i < 256; i++) {
|
|
|
|
if (cycleStart <= palette[i] && palette[i] <= cycleEnd) {
|
|
|
|
palette[i] = (palette[i] - cycleStart + offset) % num + cycleStart;
|
|
|
|
}
|
|
|
|
}
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-01-04 14:35:46 +00:00
|
|
|
doCyclePalette(palette, cycleStart, cycleEnd, 1, forward);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ScummEngine::cyclePalette() {
|
|
|
|
ColorCycle *cycl;
|
|
|
|
int valueToAdd;
|
|
|
|
int i, j;
|
|
|
|
|
2010-10-05 19:04:52 +00:00
|
|
|
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
|
2010-10-18 16:00:07 +00:00
|
|
|
if (_game.platform == Common::kPlatformFMTowns && !(_townsPaletteFlags & 1))
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
return;
|
2010-10-05 19:04:52 +00:00
|
|
|
#endif
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
|
2004-07-11 03:46:32 +00:00
|
|
|
valueToAdd = VAR(VAR_TIMER);
|
|
|
|
if (valueToAdd < VAR(VAR_TIMER_NEXT))
|
2004-01-04 14:35:46 +00:00
|
|
|
valueToAdd = VAR(VAR_TIMER_NEXT);
|
|
|
|
|
|
|
|
for (i = 0, cycl = _colorCycle; i < 16; i++, cycl++) {
|
|
|
|
if (!cycl->delay || cycl->start > cycl->end)
|
|
|
|
continue;
|
|
|
|
cycl->counter += valueToAdd;
|
|
|
|
if (cycl->counter >= cycl->delay) {
|
|
|
|
cycl->counter %= cycl->delay;
|
|
|
|
|
|
|
|
setDirtyColors(cycl->start, cycl->end);
|
|
|
|
moveMemInPalRes(cycl->start, cycl->end, cycl->flags & 2);
|
|
|
|
|
2004-02-04 08:08:56 +00:00
|
|
|
doCyclePalette(_currentPalette, cycl->start, cycl->end, 3, !(cycl->flags & 2));
|
2004-01-04 14:35:46 +00:00
|
|
|
|
|
|
|
if (_shadowPalette) {
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.version >= 7) {
|
2004-01-04 14:35:46 +00:00
|
|
|
for (j = 0; j < NUM_SHADOW_PALETTE; j++)
|
|
|
|
doCycleIndirectPalette(_shadowPalette + j * 256, cycl->start, cycl->end, !(cycl->flags & 2));
|
|
|
|
} else {
|
|
|
|
doCycleIndirectPalette(_shadowPalette, cycl->start, cycl->end, !(cycl->flags & 2));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Perform color cycling on the palManipulate data, too, otherwise
|
|
|
|
* color cycling will be disturbed by the palette fade.
|
|
|
|
*/
|
|
|
|
void ScummEngine::moveMemInPalRes(int start, int end, byte direction) {
|
|
|
|
if (!_palManipCounter)
|
|
|
|
return;
|
|
|
|
|
|
|
|
doCyclePalette(_palManipPalette, start, end, 3, !direction);
|
|
|
|
doCyclePalette(_palManipIntermediatePal, start, end, 6, !direction);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine::palManipulateInit(int resID, int start, int end, int time) {
|
2010-10-05 19:04:52 +00:00
|
|
|
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
|
2010-10-18 16:00:07 +00:00
|
|
|
if (_game.platform == Common::kPlatformFMTowns && !(_townsPaletteFlags & 1))
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
return;
|
2010-10-05 19:04:52 +00:00
|
|
|
#endif
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
|
2009-07-01 20:51:34 +00:00
|
|
|
byte *string1 = getStringAddress(resID);
|
|
|
|
byte *string2 = getStringAddress(resID + 1);
|
|
|
|
byte *string3 = getStringAddress(resID + 2);
|
2004-01-04 14:35:46 +00:00
|
|
|
if (!string1 || !string2 || !string3) {
|
2005-08-14 02:04:26 +00:00
|
|
|
error("palManipulateInit(%d,%d,%d,%d): Cannot obtain string resources %d, %d and %d",
|
2004-01-04 14:35:46 +00:00
|
|
|
resID, start, end, time, resID, resID + 1, resID + 2);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
string1 += start;
|
|
|
|
string2 += start;
|
|
|
|
string3 += start;
|
|
|
|
|
|
|
|
_palManipStart = start;
|
|
|
|
_palManipEnd = end;
|
|
|
|
_palManipCounter = 0;
|
|
|
|
|
|
|
|
if (!_palManipPalette)
|
|
|
|
_palManipPalette = (byte *)calloc(0x300, 1);
|
|
|
|
if (!_palManipIntermediatePal)
|
|
|
|
_palManipIntermediatePal = (byte *)calloc(0x600, 1);
|
|
|
|
|
2009-07-01 20:51:34 +00:00
|
|
|
byte *pal = _currentPalette + start * 3;
|
|
|
|
byte *target = _palManipPalette + start * 3;
|
|
|
|
uint16 *between = (uint16 *)(_palManipIntermediatePal + start * 6);
|
2004-01-04 14:35:46 +00:00
|
|
|
|
2009-07-01 20:51:34 +00:00
|
|
|
for (int i = start; i < end; ++i) {
|
2004-01-04 14:35:46 +00:00
|
|
|
*target++ = *string1++;
|
|
|
|
*target++ = *string2++;
|
|
|
|
*target++ = *string3++;
|
2009-07-01 20:51:34 +00:00
|
|
|
*between++ = ((uint16) *pal++) << 8;
|
|
|
|
*between++ = ((uint16) *pal++) << 8;
|
|
|
|
*between++ = ((uint16) *pal++) << 8;
|
2004-01-04 14:35:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_palManipCounter = time;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine_v6::palManipulateInit(int resID, int start, int end, int time) {
|
|
|
|
const byte *new_pal;
|
|
|
|
|
2004-10-04 04:04:37 +00:00
|
|
|
new_pal = getPalettePtr(resID, _roomResource);
|
2004-01-04 14:35:46 +00:00
|
|
|
|
|
|
|
new_pal += start*3;
|
|
|
|
|
|
|
|
_palManipStart = start;
|
|
|
|
_palManipEnd = end;
|
|
|
|
_palManipCounter = 0;
|
|
|
|
|
|
|
|
if (!_palManipPalette)
|
|
|
|
_palManipPalette = (byte *)calloc(0x300, 1);
|
|
|
|
if (!_palManipIntermediatePal)
|
|
|
|
_palManipIntermediatePal = (byte *)calloc(0x600, 1);
|
|
|
|
|
2009-07-01 20:51:34 +00:00
|
|
|
byte *pal = _currentPalette + start * 3;
|
|
|
|
byte *target = _palManipPalette + start * 3;
|
|
|
|
uint16 *between = (uint16 *)(_palManipIntermediatePal + start * 6);
|
2004-01-04 14:35:46 +00:00
|
|
|
|
2009-07-01 20:51:34 +00:00
|
|
|
for (int i = start; i < end; ++i) {
|
2004-01-04 14:35:46 +00:00
|
|
|
*target++ = *new_pal++;
|
|
|
|
*target++ = *new_pal++;
|
|
|
|
*target++ = *new_pal++;
|
2009-07-01 20:51:34 +00:00
|
|
|
*between++ = ((uint16) *pal++) << 8;
|
|
|
|
*between++ = ((uint16) *pal++) << 8;
|
|
|
|
*between++ = ((uint16) *pal++) << 8;
|
2004-01-04 14:35:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_palManipCounter = time;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ScummEngine::palManipulate() {
|
|
|
|
if (!_palManipCounter || !_palManipPalette || !_palManipIntermediatePal)
|
|
|
|
return;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2009-07-01 20:51:34 +00:00
|
|
|
byte *target = _palManipPalette + _palManipStart * 3;
|
|
|
|
byte *pal = _currentPalette + _palManipStart * 3;
|
|
|
|
uint16 *between = (uint16 *)(_palManipIntermediatePal + _palManipStart * 6);
|
2004-01-04 14:35:46 +00:00
|
|
|
|
2009-07-01 20:51:34 +00:00
|
|
|
for (int i = _palManipStart; i < _palManipEnd; ++i) {
|
|
|
|
int j;
|
|
|
|
j = (*between += ((*target++ << 8) - *between) / _palManipCounter);
|
2004-01-04 14:35:46 +00:00
|
|
|
*pal++ = j >> 8;
|
2009-07-01 20:51:34 +00:00
|
|
|
between++;
|
|
|
|
j = (*between += ((*target++ << 8) - *between) / _palManipCounter);
|
2004-01-04 14:35:46 +00:00
|
|
|
*pal++ = j >> 8;
|
2009-07-01 20:51:34 +00:00
|
|
|
between++;
|
|
|
|
j = (*between += ((*target++ << 8) - *between) / _palManipCounter);
|
2004-01-04 14:35:46 +00:00
|
|
|
*pal++ = j >> 8;
|
2009-07-01 20:51:34 +00:00
|
|
|
between++;
|
2004-01-04 14:35:46 +00:00
|
|
|
}
|
|
|
|
setDirtyColors(_palManipStart, _palManipEnd);
|
|
|
|
_palManipCounter--;
|
|
|
|
}
|
|
|
|
|
2006-04-29 16:24:39 +00:00
|
|
|
void ScummEngine::setShadowPalette(int slot, int redScale, int greenScale, int blueScale, int startColor, int endColor) {
|
2004-01-04 14:35:46 +00:00
|
|
|
byte *table;
|
|
|
|
int i;
|
|
|
|
byte *curpal;
|
|
|
|
|
|
|
|
if (slot < 0 || slot >= NUM_SHADOW_PALETTE)
|
2006-04-29 16:24:39 +00:00
|
|
|
error("setShadowPalette: invalid slot %d", slot);
|
2004-01-04 14:35:46 +00:00
|
|
|
|
|
|
|
if (startColor < 0 || startColor > 255 || endColor < 0 || startColor > 255 || endColor < startColor)
|
2006-04-29 16:24:39 +00:00
|
|
|
error("setShadowPalette: invalid range from %d to %d", startColor, endColor);
|
2004-01-04 14:35:46 +00:00
|
|
|
|
|
|
|
table = _shadowPalette + slot * 256;
|
|
|
|
for (i = 0; i < 256; i++)
|
|
|
|
table[i] = i;
|
|
|
|
|
|
|
|
table += startColor;
|
|
|
|
curpal = _currentPalette + startColor * 3;
|
|
|
|
for (i = startColor; i <= endColor; i++) {
|
|
|
|
*table++ = remapPaletteColor((curpal[0] * redScale) >> 8,
|
|
|
|
(curpal[1] * greenScale) >> 8,
|
|
|
|
(curpal[2] * blueScale) >> 8,
|
2004-09-21 13:54:30 +00:00
|
|
|
-1);
|
2004-01-04 14:35:46 +00:00
|
|
|
curpal += 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint colorWeight(int red, int green, int blue) {
|
|
|
|
return 3 * red * red + 6 * green * green + 2 * blue * blue;
|
|
|
|
}
|
|
|
|
|
2006-04-29 16:24:39 +00:00
|
|
|
void ScummEngine::setShadowPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor, int start, int end) {
|
2004-10-04 04:04:37 +00:00
|
|
|
const byte *basepal = getPalettePtr(_curPalIndex, _roomResource);
|
2004-01-04 14:35:46 +00:00
|
|
|
const byte *compareptr;
|
2004-07-26 14:10:42 +00:00
|
|
|
const byte *pal = basepal + start * 3;
|
2004-07-26 14:11:27 +00:00
|
|
|
byte *table = _shadowPalette + start;
|
2004-01-04 14:35:46 +00:00
|
|
|
int i;
|
|
|
|
|
2005-05-25 09:11:38 +00:00
|
|
|
// This is an implementation based on the original games code.
|
|
|
|
//
|
2006-04-29 16:24:39 +00:00
|
|
|
// The four known rooms where setShadowPalette is used in atlantis are:
|
2004-01-04 14:35:46 +00:00
|
|
|
//
|
|
|
|
// 1) FOA Room 53: subway departing Knossos for Atlantis.
|
|
|
|
// 2) FOA Room 48: subway crashing into the Atlantis entrance area
|
|
|
|
// 3) FOA Room 82: boat/sub shadows while diving near Thera
|
|
|
|
// 4) FOA Room 23: the big machine room inside Atlantis
|
|
|
|
//
|
|
|
|
// There seems to be no explanation for why this function is called
|
|
|
|
// from within Room 23 (the big machine), as it has no shadow effects
|
|
|
|
// and thus doesn't result in any visual differences.
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.id == GID_SAMNMAX) {
|
2004-07-25 11:29:38 +00:00
|
|
|
for (i = 0; i < 256; i++)
|
|
|
|
_shadowPalette[i] = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = start; i < end; i++) {
|
2005-05-25 01:35:32 +00:00
|
|
|
int r = (int) ((pal[0] >> 2) * redScale) >> 8;
|
|
|
|
int g = (int) ((pal[1] >> 2) * greenScale) >> 8;
|
|
|
|
int b = (int) ((pal[2] >> 2) * blueScale) >> 8;
|
|
|
|
pal += 3;
|
2004-01-04 14:35:46 +00:00
|
|
|
|
2005-05-25 01:35:32 +00:00
|
|
|
uint8 bestitem = 0;
|
|
|
|
uint bestsum = 32000;
|
2004-01-04 14:35:46 +00:00
|
|
|
|
2005-05-25 01:35:32 +00:00
|
|
|
compareptr = basepal + startColor * 3;
|
|
|
|
for (int j = startColor; j <= endColor; j++, compareptr += 3) {
|
|
|
|
int ar = compareptr[0] >> 2;
|
|
|
|
int ag = compareptr[1] >> 2;
|
|
|
|
int ab = compareptr[2] >> 2;
|
2005-05-25 09:25:27 +00:00
|
|
|
|
|
|
|
uint sum = ABS(ar - r) + ABS(ag - g) + ABS(ab - b);
|
2004-01-04 14:35:46 +00:00
|
|
|
|
|
|
|
if (sum < bestsum) {
|
|
|
|
bestsum = sum;
|
|
|
|
bestitem = j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*table++ = bestitem;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine::darkenPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor) {
|
2005-04-19 06:44:54 +00:00
|
|
|
int max;
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.version >= 5 && _game.version <= 6 && _game.heversion <= 60) {
|
2005-04-19 07:06:05 +00:00
|
|
|
max = 252;
|
2005-04-19 06:44:54 +00:00
|
|
|
} else {
|
|
|
|
max = 255;
|
|
|
|
}
|
|
|
|
|
2004-01-04 14:35:46 +00:00
|
|
|
if (startColor <= endColor) {
|
|
|
|
const byte *cptr;
|
2004-07-13 10:18:06 +00:00
|
|
|
const byte *palptr;
|
2004-07-13 09:59:13 +00:00
|
|
|
int color, idx, j;
|
2004-01-04 14:35:46 +00:00
|
|
|
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.heversion >= 90 || _game.version == 8) {
|
2005-04-19 04:12:49 +00:00
|
|
|
palptr = _darkenPalette;
|
|
|
|
} else {
|
|
|
|
palptr = getPalettePtr(_curPalIndex, _roomResource);
|
|
|
|
}
|
2004-01-04 14:35:46 +00:00
|
|
|
for (j = startColor; j <= endColor; j++) {
|
2006-02-20 16:51:30 +00:00
|
|
|
idx = (_game.heversion == 70) ? _HEV7ActorPalette[j] : j;
|
2004-07-13 10:18:06 +00:00
|
|
|
cptr = palptr + idx * 3;
|
2004-07-13 09:59:13 +00:00
|
|
|
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.heversion == 70)
|
2004-07-13 09:59:13 +00:00
|
|
|
setDirtyColors(idx, idx);
|
2004-01-04 14:35:46 +00:00
|
|
|
|
2008-01-02 12:58:18 +00:00
|
|
|
// Original FOA Amiga version skips these colors
|
|
|
|
// Fixes bug #1206994: "FOA AMIGA: Black cursor and text in Dig Site"
|
2008-01-02 13:11:26 +00:00
|
|
|
if (_game.platform == Common::kPlatformAmiga && _game.id == GID_INDY4) {
|
2008-01-02 12:58:18 +00:00
|
|
|
if (j < 16) {
|
|
|
|
cptr += 3;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-04 14:35:46 +00:00
|
|
|
color = *cptr++;
|
|
|
|
color = color * redScale / 0xFF;
|
2005-04-19 06:44:54 +00:00
|
|
|
if (color > max)
|
|
|
|
color = max;
|
2004-07-13 09:59:13 +00:00
|
|
|
_currentPalette[idx * 3 + 0] = color;
|
2004-01-04 14:35:46 +00:00
|
|
|
|
|
|
|
color = *cptr++;
|
|
|
|
color = color * greenScale / 0xFF;
|
2005-04-19 06:44:54 +00:00
|
|
|
if (color > max)
|
|
|
|
color = max;
|
2004-07-13 09:59:13 +00:00
|
|
|
_currentPalette[idx * 3 + 1] = color;
|
2004-01-04 14:35:46 +00:00
|
|
|
|
|
|
|
color = *cptr++;
|
|
|
|
color = color * blueScale / 0xFF;
|
2005-04-19 06:44:54 +00:00
|
|
|
if (color > max)
|
|
|
|
color = max;
|
2004-07-13 09:59:13 +00:00
|
|
|
_currentPalette[idx * 3 + 2] = color;
|
2009-10-26 09:11:18 +00:00
|
|
|
|
|
|
|
if (_game.features & GF_16BIT_COLOR)
|
|
|
|
_16BitPalette[idx] = get16BitColor(_currentPalette[idx * 3 + 0], _currentPalette[idx * 3 + 1], _currentPalette[idx * 3 + 2]);
|
2004-01-04 14:35:46 +00:00
|
|
|
}
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.heversion != 70)
|
2004-07-13 09:59:13 +00:00
|
|
|
setDirtyColors(startColor, endColor);
|
2004-01-04 14:35:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-06 03:00:26 +00:00
|
|
|
#ifdef ENABLE_SCUMM_7_8
|
2004-01-04 14:35:46 +00:00
|
|
|
static int HSL2RGBHelper(int n1, int n2, int hue) {
|
|
|
|
if (hue > 360)
|
|
|
|
hue = hue - 360;
|
|
|
|
else if (hue < 0)
|
|
|
|
hue = hue + 360;
|
|
|
|
|
|
|
|
if (hue < 60)
|
|
|
|
return n1 + (n2 - n1) * hue / 60;
|
|
|
|
if (hue < 180)
|
|
|
|
return n2;
|
|
|
|
if (hue < 240)
|
|
|
|
return n1 + (n2 - n1) * (240 - hue) / 60;
|
|
|
|
return n1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This function scales the HSL (Hue, Saturation and Lightness)
|
|
|
|
* components of the palette colors. It's used in CMI when Guybrush
|
|
|
|
* walks from the beach towards the swamp.
|
|
|
|
*/
|
2005-04-26 15:42:35 +00:00
|
|
|
void ScummEngine_v8::desaturatePalette(int hueScale, int satScale, int lightScale, int startColor, int endColor) {
|
2004-01-04 14:35:46 +00:00
|
|
|
|
|
|
|
if (startColor <= endColor) {
|
|
|
|
const byte *cptr;
|
|
|
|
byte *cur;
|
|
|
|
int j;
|
|
|
|
|
2005-05-21 15:45:09 +00:00
|
|
|
cptr = _darkenPalette + startColor * 3;
|
2004-01-04 14:35:46 +00:00
|
|
|
cur = _currentPalette + startColor * 3;
|
|
|
|
|
|
|
|
for (j = startColor; j <= endColor; j++) {
|
|
|
|
int R = *cptr++;
|
|
|
|
int G = *cptr++;
|
|
|
|
int B = *cptr++;
|
|
|
|
|
|
|
|
// RGB to HLS (Foley and VanDam)
|
|
|
|
|
|
|
|
const int min = MIN(R, MIN(G, B));
|
|
|
|
const int max = MAX(R, MAX(G, B));
|
|
|
|
const int diff = (max - min);
|
|
|
|
const int sum = (max + min);
|
|
|
|
|
|
|
|
if (diff != 0) {
|
|
|
|
int H, S, L;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-01-04 14:35:46 +00:00
|
|
|
if (sum <= 255)
|
|
|
|
S = 255 * diff / sum;
|
|
|
|
else
|
|
|
|
S = 255 * diff / (255 * 2 - sum);
|
|
|
|
|
|
|
|
if (R == max)
|
|
|
|
H = 60 * (G - B) / diff;
|
|
|
|
else if (G == max)
|
|
|
|
H = 120 + 60 * (B - R) / diff;
|
|
|
|
else
|
|
|
|
H = 240 + 60 * (R - G) / diff;
|
|
|
|
|
|
|
|
if (H < 0)
|
|
|
|
H = H + 360;
|
|
|
|
|
|
|
|
// Scale the result
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-01-04 14:35:46 +00:00
|
|
|
H = (H * hueScale) / 255;
|
|
|
|
S = (S * satScale) / 255;
|
|
|
|
L = (sum * lightScale) / 255;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-01-04 14:35:46 +00:00
|
|
|
// HLS to RGB (Foley and VanDam)
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-01-04 14:35:46 +00:00
|
|
|
int m1, m2;
|
|
|
|
if (L <= 255)
|
|
|
|
m2 = L * (255 + S) / (255 * 2);
|
|
|
|
else
|
|
|
|
m2 = L * (255 - S) / (255 * 2) + S;
|
|
|
|
|
|
|
|
m1 = L - m2;
|
|
|
|
|
|
|
|
R = HSL2RGBHelper(m1, m2, H + 120);
|
|
|
|
G = HSL2RGBHelper(m1, m2, H);
|
|
|
|
B = HSL2RGBHelper(m1, m2, H - 120);
|
|
|
|
} else {
|
|
|
|
// Maximal color = minimal color -> R=G=B -> it's a grayscale.
|
|
|
|
R = G = B = (R * lightScale) / 255;
|
|
|
|
}
|
|
|
|
|
|
|
|
*cur++ = R;
|
|
|
|
*cur++ = G;
|
|
|
|
*cur++ = B;
|
|
|
|
}
|
|
|
|
|
|
|
|
setDirtyColors(startColor, endColor);
|
|
|
|
}
|
|
|
|
}
|
2005-05-14 22:56:41 +00:00
|
|
|
#endif
|
2004-01-04 14:35:46 +00:00
|
|
|
|
|
|
|
|
2004-09-21 13:54:30 +00:00
|
|
|
int ScummEngine::remapPaletteColor(int r, int g, int b, int threshold) {
|
2009-01-04 00:58:45 +00:00
|
|
|
byte *pal;
|
|
|
|
int ar, ag, ab, i;
|
2004-01-04 14:35:46 +00:00
|
|
|
uint sum, bestsum, bestitem = 0;
|
2005-05-21 15:45:09 +00:00
|
|
|
|
2006-02-20 16:51:30 +00:00
|
|
|
int startColor = (_game.version == 8) ? 24 : 1;
|
2009-05-24 15:17:42 +00:00
|
|
|
|
2009-01-04 00:58:45 +00:00
|
|
|
if (_game.heversion >= 99)
|
|
|
|
pal = _hePalettes + 1024 + startColor * 3;
|
|
|
|
else
|
|
|
|
pal = _currentPalette + startColor * 3;
|
2004-01-04 14:35:46 +00:00
|
|
|
|
|
|
|
if (r > 255)
|
|
|
|
r = 255;
|
|
|
|
if (g > 255)
|
|
|
|
g = 255;
|
|
|
|
if (b > 255)
|
|
|
|
b = 255;
|
|
|
|
|
2004-08-15 07:44:57 +00:00
|
|
|
bestsum = 0x7FFFFFFF;
|
2004-01-04 14:35:46 +00:00
|
|
|
|
|
|
|
r &= ~3;
|
|
|
|
g &= ~3;
|
|
|
|
b &= ~3;
|
|
|
|
|
2005-11-01 02:43:54 +00:00
|
|
|
for (i = startColor; i < 255; i++, pal += 3) {
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.version == 7 && _colorUsedByCycle[i])
|
2005-11-01 02:43:54 +00:00
|
|
|
continue;
|
|
|
|
|
2004-01-04 14:35:46 +00:00
|
|
|
ar = pal[0] & ~3;
|
|
|
|
ag = pal[1] & ~3;
|
|
|
|
ab = pal[2] & ~3;
|
|
|
|
if (ar == r && ag == g && ab == b)
|
|
|
|
return i;
|
|
|
|
|
|
|
|
sum = colorWeight(ar - r, ag - g, ab - b);
|
|
|
|
|
|
|
|
if (sum < bestsum) {
|
|
|
|
bestsum = sum;
|
|
|
|
bestitem = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-21 13:54:30 +00:00
|
|
|
if (threshold != -1 && bestsum > colorWeight(threshold, threshold, threshold)) {
|
2004-01-04 14:35:46 +00:00
|
|
|
// Best match exceeded threshold. Try to find an unused palette entry and
|
|
|
|
// use it for our purpose.
|
|
|
|
pal = _currentPalette + (256 - 2) * 3;
|
|
|
|
for (i = 254; i > 48; i--, pal -= 3) {
|
|
|
|
if (pal[0] >= 252 && pal[1] >= 252 && pal[2] >= 252) {
|
|
|
|
setPalColor(i, r, g, b);
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return bestitem;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine::swapPalColors(int a, int b) {
|
|
|
|
byte *ap, *bp;
|
|
|
|
byte t;
|
|
|
|
|
|
|
|
if ((uint) a >= 256 || (uint) b >= 256)
|
|
|
|
error("swapPalColors: invalid values, %d, %d", a, b);
|
|
|
|
|
|
|
|
ap = &_currentPalette[a * 3];
|
|
|
|
bp = &_currentPalette[b * 3];
|
|
|
|
|
|
|
|
t = ap[0];
|
|
|
|
ap[0] = bp[0];
|
|
|
|
bp[0] = t;
|
|
|
|
t = ap[1];
|
|
|
|
ap[1] = bp[1];
|
|
|
|
bp[1] = t;
|
|
|
|
t = ap[2];
|
|
|
|
ap[2] = bp[2];
|
|
|
|
bp[2] = t;
|
|
|
|
|
2009-10-26 09:11:18 +00:00
|
|
|
if (_game.features & GF_16BIT_COLOR) {
|
|
|
|
_16BitPalette[a] = get16BitColor(ap[0], ap[1], ap[2]);
|
|
|
|
_16BitPalette[b] = get16BitColor(bp[0], bp[1], bp[2]);
|
|
|
|
}
|
|
|
|
|
2004-01-04 14:35:46 +00:00
|
|
|
setDirtyColors(a, a);
|
|
|
|
setDirtyColors(b, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine::copyPalColor(int dst, int src) {
|
|
|
|
byte *dp, *sp;
|
|
|
|
|
|
|
|
if ((uint) dst >= 256 || (uint) src >= 256)
|
|
|
|
error("copyPalColor: invalid values, %d, %d", dst, src);
|
|
|
|
|
|
|
|
dp = &_currentPalette[dst * 3];
|
|
|
|
sp = &_currentPalette[src * 3];
|
|
|
|
|
|
|
|
dp[0] = sp[0];
|
|
|
|
dp[1] = sp[1];
|
|
|
|
dp[2] = sp[2];
|
|
|
|
|
2009-10-26 09:11:18 +00:00
|
|
|
if (_game.features & GF_16BIT_COLOR)
|
|
|
|
_16BitPalette[dst] = get16BitColor(sp[0], sp[1], sp[2]);
|
|
|
|
|
2004-01-04 14:35:46 +00:00
|
|
|
setDirtyColors(dst, dst);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine::setPalColor(int idx, int r, int g, int b) {
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.heversion == 70)
|
2004-07-13 09:59:13 +00:00
|
|
|
idx = _HEV7ActorPalette[idx];
|
|
|
|
|
2004-01-04 14:35:46 +00:00
|
|
|
_currentPalette[idx * 3 + 0] = r;
|
|
|
|
_currentPalette[idx * 3 + 1] = g;
|
|
|
|
_currentPalette[idx * 3 + 2] = b;
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.version == 8) {
|
2005-05-21 15:45:09 +00:00
|
|
|
_darkenPalette[idx * 3 + 0] = r;
|
|
|
|
_darkenPalette[idx * 3 + 1] = g;
|
|
|
|
_darkenPalette[idx * 3 + 2] = b;
|
|
|
|
}
|
2009-10-26 09:11:18 +00:00
|
|
|
|
|
|
|
if (_game.features & GF_16BIT_COLOR)
|
|
|
|
_16BitPalette[idx] = get16BitColor(r, g, b);
|
|
|
|
|
2004-01-04 14:35:46 +00:00
|
|
|
setDirtyColors(idx, idx);
|
|
|
|
}
|
|
|
|
|
2006-11-04 22:59:56 +00:00
|
|
|
void ScummEngine::setCurrentPalette(int palindex) {
|
2004-01-04 14:35:46 +00:00
|
|
|
const byte *pals;
|
|
|
|
|
|
|
|
_curPalIndex = palindex;
|
2005-04-17 12:55:42 +00:00
|
|
|
pals = getPalettePtr(_curPalIndex, _roomResource);
|
2009-10-21 12:59:10 +00:00
|
|
|
if (_game.id == GID_LOOM && _game.platform == Common::kPlatformPCEngine) {
|
|
|
|
setPCEPaletteFromPtr(pals);
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
#ifdef USE_RGB_COLOR
|
2010-10-05 19:04:52 +00:00
|
|
|
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
|
2011-06-15 20:01:24 +00:00
|
|
|
} else if (_game.platform == Common::kPlatformFMTowns) {
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
towns_setPaletteFromPtr(pals);
|
2010-10-05 19:04:52 +00:00
|
|
|
#endif
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
#endif
|
2009-10-21 12:59:10 +00:00
|
|
|
} else {
|
|
|
|
setPaletteFromPtr(pals);
|
|
|
|
}
|
2004-01-04 14:35:46 +00:00
|
|
|
}
|
|
|
|
|
2005-04-17 12:55:42 +00:00
|
|
|
void ScummEngine::setRoomPalette(int palindex, int room) {
|
|
|
|
const byte *roomptr = getResourceAddress(rtRoom, room);
|
|
|
|
assert(roomptr);
|
2011-04-12 14:53:15 +00:00
|
|
|
const byte *pals = findResource(MKTAG('P','A','L','S'), roomptr);
|
2005-04-17 12:55:42 +00:00
|
|
|
assert(pals);
|
|
|
|
const byte *rgbs = findPalInPals(pals, palindex);
|
|
|
|
assert(rgbs);
|
|
|
|
setPaletteFromPtr(rgbs);
|
|
|
|
}
|
|
|
|
|
2004-01-04 14:35:46 +00:00
|
|
|
const byte *ScummEngine::findPalInPals(const byte *pal, int idx) {
|
|
|
|
const byte *offs;
|
|
|
|
uint32 size;
|
|
|
|
|
2011-04-12 14:53:15 +00:00
|
|
|
pal = findResource(MKTAG('W','R','A','P'), pal);
|
2004-01-04 14:35:46 +00:00
|
|
|
if (pal == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
2011-04-12 14:53:15 +00:00
|
|
|
offs = findResourceData(MKTAG('O','F','F','S'), pal);
|
2004-01-04 14:35:46 +00:00
|
|
|
if (offs == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
size = getResourceDataSize(offs) / 4;
|
|
|
|
if ((uint32)idx >= (uint32)size)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return offs + READ_LE_UINT32(offs + idx * sizeof(uint32));
|
|
|
|
}
|
|
|
|
|
2004-10-04 04:04:37 +00:00
|
|
|
const byte *ScummEngine::getPalettePtr(int palindex, int room) {
|
2004-01-04 14:35:46 +00:00
|
|
|
const byte *cptr;
|
|
|
|
|
2004-10-04 04:04:37 +00:00
|
|
|
cptr = getResourceAddress(rtRoom, room);
|
2004-01-04 14:35:46 +00:00
|
|
|
assert(cptr);
|
|
|
|
if (_CLUT_offs) {
|
|
|
|
cptr += _CLUT_offs;
|
|
|
|
} else {
|
|
|
|
cptr = findPalInPals(cptr + _PALS_offs, palindex);
|
2005-04-26 15:42:35 +00:00
|
|
|
assert(cptr);
|
2004-01-04 14:35:46 +00:00
|
|
|
}
|
|
|
|
return cptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScummEngine::updatePalette() {
|
2009-10-26 09:11:18 +00:00
|
|
|
if (_game.features & GF_16BIT_COLOR)
|
|
|
|
return;
|
|
|
|
|
2004-01-04 14:35:46 +00:00
|
|
|
if (_palDirtyMax == -1)
|
|
|
|
return;
|
|
|
|
|
2006-02-20 16:51:30 +00:00
|
|
|
bool noir_mode = (_game.id == GID_SAMNMAX && readVar(0x8000));
|
2004-01-04 14:35:46 +00:00
|
|
|
int first = _palDirtyMin;
|
|
|
|
int num = _palDirtyMax - first + 1;
|
|
|
|
int i;
|
|
|
|
|
2011-02-13 19:10:34 +00:00
|
|
|
byte palette_colors[3 * 256];
|
2004-01-04 14:35:46 +00:00
|
|
|
byte *p = palette_colors;
|
|
|
|
|
|
|
|
for (i = _palDirtyMin; i <= _palDirtyMax; i++) {
|
|
|
|
byte *data;
|
|
|
|
|
2006-02-20 16:51:30 +00:00
|
|
|
if (_game.features & GF_SMALL_HEADER && _game.version > 2)
|
2004-01-04 14:35:46 +00:00
|
|
|
data = _currentPalette + _shadowPalette[i] * 3;
|
|
|
|
else
|
|
|
|
data = _currentPalette + i * 3;
|
|
|
|
|
2010-11-17 12:22:08 +00:00
|
|
|
// Sam & Max film noir mode. Convert the colors to grayscale
|
2004-01-04 14:35:46 +00:00
|
|
|
// before uploading them to the backend.
|
|
|
|
|
|
|
|
if (noir_mode) {
|
|
|
|
int r, g, b;
|
|
|
|
byte brightness;
|
|
|
|
|
|
|
|
r = data[0];
|
|
|
|
g = data[1];
|
|
|
|
b = data[2];
|
|
|
|
|
|
|
|
brightness = (byte)((0.299 * r + 0.587 * g + 0.114 * b) + 0.5);
|
|
|
|
|
|
|
|
*p++ = brightness;
|
|
|
|
*p++ = brightness;
|
|
|
|
*p++ = brightness;
|
|
|
|
} else {
|
|
|
|
*p++ = data[0];
|
|
|
|
*p++ = data[1];
|
|
|
|
*p++ = data[2];
|
|
|
|
}
|
|
|
|
}
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-01-04 14:35:46 +00:00
|
|
|
_palDirtyMax = -1;
|
|
|
|
_palDirtyMin = 256;
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
|
|
|
|
#ifdef USE_RGB_COLOR
|
2010-10-05 19:04:52 +00:00
|
|
|
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
|
2011-06-15 20:01:24 +00:00
|
|
|
if (_game.platform == Common::kPlatformFMTowns) {
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
p = palette_colors;
|
|
|
|
for (i = first; i < first + num; ++i) {
|
|
|
|
_16BitPalette[i] = get16BitColor(p[0], p[1], p[2]);
|
2011-02-13 19:10:34 +00:00
|
|
|
p += 3;
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2010-10-05 19:04:52 +00:00
|
|
|
#endif
|
SCUMM/FM-TOWNS: fix palette and other graphics issues
This commit should fix at least the following bugs/feature requests: #1032859, #1252088, #1055391, #1315968, #1315938, #1742106, #812891.
The FM-Towns version of Scumm games use a mixed graphics mode with 2 layers (one with 32767 colors and one with 16 colors). Among other things I have added a screen output class which emulates this dual layer approach which allows specific hardware effects like enabling and disabling layers (e.g. in the voodoo priestess scene in MI1).
Old savegames (saved before this update) will load, but you’ll encounter palette glitches in the verb/inventory screen, since the 16 color palette for layer 2 is not contained in your savegame. This will be true at least for version 5 games. Certain scene change actions (which require the verb/inventory part to be redrawn) might correct this (e.g. try looking at the treasure map in MI1 and closing it). Version 3 games should be okay, since they use a static text palette which is never changed and which will be reset after loading a savegame.
This update requires a USE_RGB_COLORS setting for proper operation. 8 bit users will get a warning that they’ll have to expect palette glitches . Apart from that the engine in 8 bit mode should not only still work okay, but also benefit from some of the other (non palette related) improvements (e.g. bug #1032859 should be fixed even in 8 bit mode).
Japanese font drawing hasn’t been improved much yet. This will be a separate task.
svn-id: r52966
2010-10-01 19:24:52 +00:00
|
|
|
#endif
|
|
|
|
|
2011-02-07 17:52:38 +00:00
|
|
|
_system->getPaletteManager()->setPalette(palette_colors, first, num);
|
2004-01-04 14:35:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // End of namespace Scumm
|