From 64585b40ebd8fac26d151aa12e6c6a22f631c20c Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 3 Aug 2010 16:22:12 +0000 Subject: KYRA: Get rid of Screen_LoL::generateLevelOverlay. This function is actually exactly the same as Screen_v2::generateOverlay, after I fixed the implementation of the latter last commit. svn-id: r51704 --- engines/kyra/scene_lol.cpp | 2 +- engines/kyra/screen_lol.cpp | 62 --------------------------------------------- engines/kyra/screen_lol.h | 1 - 3 files changed, 1 insertion(+), 64 deletions(-) diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp index ddc6e41bec..bf3320486a 100644 --- a/engines/kyra/scene_lol.cpp +++ b/engines/kyra/scene_lol.cpp @@ -468,7 +468,7 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight for (int i = 0; i < 7; i++) { weight = 100 - (i * _lastSpecialColorWeight); weight = (weight > 0) ? (weight * 255) / 100 : 0; - _screen->generateLevelOverlay(tpal, _screen->getLevelOverlay(i), _lastSpecialColor, weight); + _screen->generateOverlay(tpal, _screen->getLevelOverlay(i), _lastSpecialColor, weight); int l = _flags.use16ColorMode ? 256 : 128; uint8 *levelOverlay = _screen->getLevelOverlay(i); diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index e350d2c977..be3dbe5b21 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -183,68 +183,6 @@ void Screen_LoL::generateGrayOverlay(const Palette &srcPal, uint8 *grayOverlay, grayOverlay[i] = findLeastDifferentColor(tmpPal.getData() + 3 * i, srcPal, 0, lastColor, skipSpecialColors); } -uint8 *Screen_LoL::generateLevelOverlay(const Palette &srcPal, uint8 *ovl, int opColor, int weight) { - if (!ovl) - return ovl; - - if (weight > 255) - weight = 255; - - const uint8 *srt = srcPal.getData(); - - uint16 r = srt[opColor * 3]; - uint16 g = srt[opColor * 3 + 1]; - uint16 b = srt[opColor * 3 + 2]; - - uint8 *d = ovl; - *d++ = 0; - - for (int i = 1; i != 256; i++) { - uint16 a = srt[i * 3]; - uint8 dr = a - ((((a - r) * (weight >> 1)) << 1) >> 8); - a = srt[i * 3 + 1]; - uint8 dg = a - ((((a - g) * (weight >> 1)) << 1) >> 8); - a = srt[i * 3 + 2]; - uint8 db = a - ((((a - b) * (weight >> 1)) << 1) >> 8); - - int l = opColor; - int m = _use16ColorMode ? 0xffff : 0x7fff; - int ii = _use16ColorMode ? 255 : 127; - int x = 1; - const uint8 *s = srt + 3; - - do { - if (!_use16ColorMode && i == x) { - s += 3; - } else { - int t = *s++ - dr; - int c = t * t; - t = *s++ - dg; - c += (t * t); - t = *s++ - db; - c += (t * t); - - if (!c) { - l = x; - break; - } - - if (c <= m) { - if (!_use16ColorMode || (x == opColor || i != x)) { - m = c; - l = x; - } - } - } - x++; - } while (--ii); - - *d++ = l & 0xff; - } - - return ovl; -} - void Screen_LoL::createTransparencyTablesIntern(const uint8 *ovl, int a, const uint8 *fxPal1, const uint8 *fxPal2, uint8 *outTable1, uint8 *outTable2, int b) { Palette screenPal(256); screenPal.copy(fxPal2, 0, 256); diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h index cdd18f98f6..52e66df1ec 100644 --- a/engines/kyra/screen_lol.h +++ b/engines/kyra/screen_lol.h @@ -79,7 +79,6 @@ public: Palette **generateFadeTable(Palette **dst, Palette *src1, Palette *src2, int numTabs); void generateGrayOverlay(const Palette &Pal, uint8 *grayOverlay, int factor, int addR, int addG, int addB, int lastColor, bool skipSpecialColors); - uint8 *generateLevelOverlay(const Palette &Pal, uint8 *ovl, int opColor, int weight); uint8 *getLevelOverlay(int index) { return _levelOverlays[index]; } void createTransparencyTablesIntern(const uint8 *ovl, int a, const uint8 *fxPal1, const uint8 *fxPal2, uint8 *outTable1, uint8 *outTable2, int b); -- cgit v1.2.3