From e36594dbe90c36d09e2c3c2d31b11476c5ddffbd Mon Sep 17 00:00:00 2001 From: Florian Kagerer Date: Thu, 12 Nov 2009 07:41:33 +0000 Subject: LOL: - cleanup svn-id: r45852 --- engines/kyra/lol.cpp | 19 +++++++++++++------ engines/kyra/screen_lol.cpp | 11 +++++++---- engines/kyra/screen_lol.h | 2 +- 3 files changed, 21 insertions(+), 11 deletions(-) (limited to 'engines/kyra') diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 209e112f95..7721f18cc8 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -1758,12 +1758,17 @@ void LoLEngine::createTransparencyTables() { if (_flags.isTalkie || _loadSuppFilesFlag) return; - Palette tpal(256); + uint8 *tpal = new uint8[768]; + if (_flags.use16ColorMode) { - static const uint8 colTbl[] = { 0x00, 0x00, 0x11, 0x00, 0x22, 0x00, 0x33, 0x00, 0x44, 0x00, 0x55, 0x00, 0x66, 0x00, 0x77, 0x00, 0x88, 0x00, 0x99, 0x00, 0xAA, 0x00, 0xBB, 0x00, 0xCC, 0x00, 0xDD, 0x00, 0xEE, 0x00, 0xFF, 0x00 }; - memset(tpal.getData(), 0xff, 768); + static const uint8 colTbl[] = { + 0x00, 0x00, 0x11, 0x00, 0x22, 0x00, 0x33, 0x00, 0x44, 0x00, 0x55, 0x00, 0x66, 0x00, 0x77, 0x00, + 0x88, 0x00, 0x99, 0x00, 0xAA, 0x00, 0xBB, 0x00, 0xCC, 0x00, 0xDD, 0x00, 0xEE, 0x00, 0xFF, 0x00 + }; + + memset(tpal, 0xff, 768); + _res->loadFileToBuf("LOL.NOL", tpal, 48); - _res->loadFileToBuf("LOL.NOL", tpal.getData(), 48); for (int i = 15; i > -1; i--) { int s = colTbl[i << 1] * 3; tpal[s] = tpal[i * 3]; @@ -1773,14 +1778,16 @@ void LoLEngine::createTransparencyTables() { } _screen->createTransparencyTablesIntern(colTbl, 16, tpal, tpal, _transparencyTable1, _transparencyTable2, 80); + } else { - _screen->loadPalette("fxpal.col", tpal); + _res->loadFileToBuf("fxpal.col", tpal, 768); _screen->loadBitmap("fxpal.shp", 3, 3, 0); const uint8 *shpPal = _screen->getPtrToShape(_screen->getCPagePtr(2), 0) + 11; - _screen->createTransparencyTablesIntern(shpPal, 20, tpal, _screen->getPalette(1), _transparencyTable1, _transparencyTable2, 70); + _screen->createTransparencyTablesIntern(shpPal, 20, tpal, _screen->getPalette(1).getData(), _transparencyTable1, _transparencyTable2, 70); } + delete[] tpal; _loadSuppFilesFlag = 1; } diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index 86e113ded9..63545b252b 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -245,7 +245,10 @@ uint8 *Screen_LoL::generateLevelOverlay(const Palette &srcPal, uint8 *ovl, int o return ovl; } -void Screen_LoL::createTransparencyTablesIntern(const uint8 *ovl, int a, const Palette &fxPal, const Palette &screenPal, uint8 *outTable1, uint8 *outTable2, int b) { +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); + memset(outTable1, 0xff, 256); for (int i = 0; i < a; i++) @@ -261,9 +264,9 @@ void Screen_LoL::createTransparencyTablesIntern(const uint8 *ovl, int a, const P uint16 t2 = 64 - t1; uint8 c = ovl[i]; - fcol[0] = fxPal[3 * c]; - fcol[1] = fxPal[3 * c + 1]; - fcol[2] = fxPal[3 * c + 2]; + fcol[0] = fxPal1[3 * c]; + fcol[1] = fxPal1[3 * c + 1]; + fcol[2] = fxPal1[3 * c + 2]; uint8 *o = &outTable2[i << 8]; diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h index 087793a80e..9c55b8a882 100644 --- a/engines/kyra/screen_lol.h +++ b/engines/kyra/screen_lol.h @@ -82,7 +82,7 @@ public: 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 Palette &fxPal, const Palette &screenPal, uint8 *outTable1, uint8 *outTable2, int b); + void createTransparencyTablesIntern(const uint8 *ovl, int a, const uint8 *fxPal1, const uint8 *fxPal2, uint8 *outTable1, uint8 *outTable2, int b); void copyBlockAndApplyOverlay(int page1, int x1, int y1, int page2, int x2, int y2, int w, int h, int dim, uint8 *ovl); void applyOverlaySpecial(int page1, int x1, int y1, int page2, int x2, int y2, int w, int h, int dim, int flag, uint8 *ovl); -- cgit v1.2.3