LOL: Minor adjustment to latest generateOverlay changes.

svn-id: r51705
This commit is contained in:
Johannes Schickel 2010-08-03 16:43:57 +00:00
parent 64585b40eb
commit 13824582d1
3 changed files with 15 additions and 5 deletions

View File

@ -810,8 +810,8 @@ void LoLEngine::startup() {
pal.fill(0, 1, 0x3F);
pal.fill(2, 126, 0x3F);
pal.fill(192, 4, 0x3F);
_screen->generateOverlay(pal, _screen->_paletteOverlay1, 1, 96);
_screen->generateOverlay(pal, _screen->_paletteOverlay2, 144, 65);
_screen->generateOverlay(pal, _screen->_paletteOverlay1, 1, 96, 254);
_screen->generateOverlay(pal, _screen->_paletteOverlay2, 144, 65, 254);
_screen->copyPalette(0, 1);
}

View File

@ -38,7 +38,7 @@ Screen_v2::~Screen_v2() {
delete[] _wsaFrameAnimBuffer;
}
uint8 *Screen_v2::generateOverlay(const Palette &pal, uint8 *buffer, int opColor, uint weight) {
uint8 *Screen_v2::generateOverlay(const Palette &pal, uint8 *buffer, int opColor, uint weight, int maxColor) {
if (!buffer)
return buffer;
@ -51,7 +51,17 @@ uint8 *Screen_v2::generateOverlay(const Palette &pal, uint8 *buffer, int opColor
uint8 *dst = buffer;
*dst++ = 0;
const int maxIndex = (_vm->gameFlags().gameID == GI_LOL) ? (_use16ColorMode ? 255 : 127) : 255;
int maxIndex = maxColor;
if (maxIndex == -1) {
if (_vm->gameFlags().gameID == GI_LOL) {
if (_use16ColorMode)
maxIndex = 255;
else
maxIndex = 127;
} else {
maxIndex = 255;
}
}
for (int i = 1; i != 256; ++i) {
const byte curR = pal[i * 3 + 0] - ((((pal[i * 3 + 0] - opR) * weight) >> 7) & 0x7F);

View File

@ -40,7 +40,7 @@ public:
void checkedPageUpdate(int srcPage, int dstPage);
// palette handling
uint8 *generateOverlay(const Palette &pal, uint8 *buffer, int color, uint weight);
uint8 *generateOverlay(const Palette &pal, uint8 *buffer, int color, uint weight, int maxColor = -1);
void applyOverlay(int x, int y, int w, int h, int pageNum, const uint8 *overlay);
int findLeastDifferentColor(const uint8 *paletteEntry, const Palette &pal, uint8 firstColor, uint16 numColors, bool skipSpecialColors = false);