diff options
-rw-r--r-- | engines/kyra/screen.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/screen_lol.cpp | 11 | ||||
-rw-r--r-- | engines/kyra/script_lol.cpp | 34 |
3 files changed, 36 insertions, 11 deletions
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index a3a9e8355d..9216b5e432 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -1361,7 +1361,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int &Screen::drawShapePlotType13, // used by Kyra 1 &Screen::drawShapePlotType14, // used by Kyra 1 (invisibility) &Screen::drawShapePlotType11_15, // used by Kyra 1 (invisibility) - &Screen::drawShapePlotType16, // used by LoL PC-98/16 Colors (teleporters), + &Screen::drawShapePlotType16, // used by LoL PC-98/16 Colors (teleporters), 0, 0, 0, &Screen::drawShapePlotType20, // used by LoL (heal spell effect) &Screen::drawShapePlotType21, // used by LoL (white tower spirits) diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index 4feabffa62..284158e586 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -939,16 +939,17 @@ bool Screen_LoL::fadePaletteStep(uint8 *pal1, uint8 *pal2, uint32 elapsedTime, u } Palette **Screen_LoL::generateFadeTable(Palette **dst, Palette *src1, Palette *src2, int numTabs) { - if (!src1) + int len = _use16ColorMode ? 48 : 768; + if (!src1) src1 = _screenPalette; - + uint8 *p1 = (*dst++)->getData(); uint8 *p2 = src1->getData(); uint8 *p3 = src2->getData(); uint8 *p4 = p1; uint8 *p5 = p2; - for (int i = 0; i < 768; i++) { + for (int i = 0; i < len; i++) { int8 val = (int8)*p3++ - (int8)*p2++; *p4++ = (uint8)val; } @@ -962,13 +963,13 @@ Palette **Screen_LoL::generateFadeTable(Palette **dst, Palette *src1, Palette *s t += d; p4 = (*dst++)->getData(); - for (int ii = 0; ii < 768; ii++) { + for (int ii = 0; ii < len; ii++) { int16 val = (((int8)*p3++ * t) >> 8) + (int8)*p2++; *p4++ = (uint8)val; } } - memcpy(p1, p5, 768); + memcpy(p1, p5, len); (*dst)->copy(*src2); return ++dst; diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index 73c9577b4f..71e9b1d24f 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -2027,7 +2027,7 @@ int LoLEngine::olol_findInventoryItem(EMCState *script) { int LoLEngine::olol_restoreFadePalette(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_restoreFadePalette(%p)", (const void *)script); - _screen->getPalette(0).copy(_screen->getPalette(1), 0, 128); + _screen->getPalette(0).copy(_screen->getPalette(1), 0, _flags.use16ColorMode ? 16 : 128); _screen->fadePalette(_screen->getPalette(0), 10); _screen->_fadeFlag = 0; return 1; @@ -2210,17 +2210,41 @@ int LoLEngine::olol_restoreMagicShroud(EMCState *script) { Palette *fadeTab[28]; for (int i = 0; i < 28; i++) - fadeTab[i] = new Palette(256); + fadeTab[i] = new Palette(_flags.use16ColorMode ? 16 : 256); Palette **tpal1 = &fadeTab[0]; Palette **tpal2 = &fadeTab[1]; Palette **tpal3 = &fadeTab[2]; Palette **tpal4 = 0; - _screen->loadPalette("LITEPAL1.COL", **tpal1); + + if (_flags.use16ColorMode) { + const uint8 *s = _res->fileData("LITEPAL1.COL", 0); + (*tpal1)->copy(s, 0, 16); + delete[] s; + } else { + _screen->loadPalette("LITEPAL1.COL", **tpal1); + } + tpal2 = _screen->generateFadeTable(tpal3, 0, *tpal1, 21); - _screen->loadPalette("LITEPAL2.COL", **tpal2); + + if (_flags.use16ColorMode) { + const uint8 *s = _res->fileData("LITEPAL2.COL", 0); + (*tpal2)->copy(s, 0, 16); + delete[] s; + } else { + _screen->loadPalette("LITEPAL2.COL", **tpal2); + } + tpal4 = tpal2++; - _screen->loadPalette("LITEPAL3.COL", **tpal1); + + if (_flags.use16ColorMode) { + const uint8 *s = _res->fileData("LITEPAL3.COL", 0); + (*tpal1)->copy(s, 0, 16); + delete[] s; + } else { + _screen->loadPalette("LITEPAL3.COL", **tpal1); + } + _screen->generateFadeTable(tpal2, *tpal4, *tpal1, 4); for (int i = 0; i < 21; i++) { |