diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp index e958302d96c..b371b4f99ee 100644 --- a/engines/kyra/gui_lol.cpp +++ b/engines/kyra/gui_lol.cpp @@ -1706,7 +1706,7 @@ int LoLEngine::clickedRestParty(Button *button) { removeInputTop(); if (needHealingFlags || needMagicGainFlags) { - _screen->fillRect(112, 0, 288, 120, 1); + _screen->fillRect(112, 0, 288, 120, _flags.use16ColorMode ? 0x44 : 1); gui_drawAllCharPortraitsWithStats(); _txt->printMessage(0x8000, "%s", getLangString(0x4057)); diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index c28ea6a35c3..fae220e77d1 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -1329,10 +1329,13 @@ int LoLEngine::calculateProtection(int index) { } void LoLEngine::setCharacterMagicOrHitPoints(int charNum, int type, int points, int mode) { - static const uint16 barData[2][5] = { + static const uint16 barData[4][5] = { // xPos, bar color, text color, flag, string id { 0x27, 0x9A, 0x98, 0x01, 0x4254 }, - { 0x21, 0xA2, 0xA0, 0x00, 0x4253 } + { 0x21, 0xA2, 0xA0, 0x00, 0x4253 }, + // 16 color mode + { 0x27, 0x66, 0x55, 0x01, 0x4254 }, + { 0x21, 0xAA, 0x99, 0x00, 0x4253 } }; if (charNum > 3) @@ -1371,6 +1374,9 @@ void LoLEngine::setCharacterMagicOrHitPoints(int charNum, int type, int points, int step = (newVal > pointsCur) ? 2 : -2; newVal = CLIP(newVal + step, 0, pointsMax); + if (_flags.use16ColorMode) + type += 2; + if (newVal != pointsCur) { step = (newVal >= pointsCur) ? 2 : -2; @@ -1705,7 +1711,7 @@ void LoLEngine::generateBrightnessPalette(const Palette &src, Palette &dst, int if (_flags.use16ColorMode) { if (!brightness) modifier = 0; - else if (modifier < 0 || modifier > 7 || (_flagsTable[31] & 0x08)) + else if (modifier < 0 || modifier > 7 || !(_flagsTable[31] & 0x08)) modifier = 8; modifier >>= 1; @@ -2139,7 +2145,21 @@ int LoLEngine::processMagicHealSelectTarget() { int LoLEngine::processMagicHeal(int charNum, int spellLevel) { if (!_healOverlay) { _healOverlay = new uint8[256]; - _screen->generateGrayOverlay(_screen->getPalette(1), _healOverlay, 52, 22, 20, 0, 256, true); + Palette tpal(256); + tpal.copy(_screen->getPalette(1)); + + if (_flags.use16ColorMode) { + tpal.fill(16, 240, 0xff); + uint8 *dst = tpal.getData(); + for (int i = 1; i < 16; i++) { + int s = ((i << 4) | i) * 3; + SWAP(dst[s], dst[i]); + SWAP(dst[s + 1], dst[i + 1]); + SWAP(dst[s + 2], dst[i + 2]); + } + } + + _screen->generateGrayOverlay(tpal, _healOverlay, 52, 22, 20, 0, 256, true); } const uint8 *healShpFrames = 0; diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp index 0860b141a7d..4b6e1dedef1 100644 --- a/engines/kyra/scene_lol.cpp +++ b/engines/kyra/scene_lol.cpp @@ -358,7 +358,9 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight } if (_flags.use16ColorMode) { - if (_lastSpecialColor == 0x66) + if (_lastSpecialColor == 1) + _lastSpecialColor = 0x44; + else if (_lastSpecialColor == 0x66) _lastSpecialColor = scumm_stricmp(file, "YVEL2") ? 0xcc : 0x44; else if (_lastSpecialColor == 0x6b) _lastSpecialColor = 0xcc; @@ -400,11 +402,6 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight if (_flags.use16ColorMode) { _screen->loadPalette("LOL.NOL", _screen->getPalette(0)); - /*static const uint8 colTable[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF }; - Palette &pl = _screen->getPalette(0); - for (int i = 15; i >= 0; i--) - pl.copy(pl, i, 1, i);*/ - } else { if (_vcnShift) delete[] _vcnShift; @@ -457,11 +454,21 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight Palette tpal(256); tpal.copy(_screen->getPalette(0)); - tpal.fill(16, 240, 0xff); + if (_flags.use16ColorMode) { + tpal.fill(16, 240, 0xff); + uint8 *dst = tpal.getData(); + for (int i = 1; i < 16; i++) { + int s = ((i << 4) | i) * 3; + SWAP(dst[s], dst[i * 3]); + SWAP(dst[s + 1], dst[i * 3 + 1]); + SWAP(dst[s + 2], dst[i * 3 + 2]); + } + } + for (int i = 0; i < 7; i++) { weight = 100 - (i * _lastSpecialColorWeight); weight = (weight > 0) ? (weight * 255) / 100 : 0; - _screen->generateLevelOverlay(tpal/*_screen->getPalette(0)*/, _screen->getLevelOverlay(i), _lastSpecialColor >> 4, weight); + _screen->generateLevelOverlay(tpal, _screen->getLevelOverlay(i), _lastSpecialColor, weight); int l = _flags.use16ColorMode ? 256 : 128; uint8 *levelOverlay = _screen->getLevelOverlay(i); @@ -488,12 +495,10 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight _screen->loadPalette("LOL.NOL", _screen->getPalette(0)); - static const uint8 colTable[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF }; - for (int i = 0; i < 8; i++) { uint8 *pl = _screen->getLevelOverlay(7 - i); for (int ii = 0; ii < 16; ii++) - _vcnExpTable[(i << 4) + ii] = pl[colTable[ii]]; + _vcnExpTable[(i << 4) + ii] = pl[(ii << 4) | ii]; } } @@ -2099,7 +2104,7 @@ void LoLEngine::drawDecorations(int index) { uint8 bb = _blockBrightness >> 4; if (ov > bb) ov -= bb; - else + else ov = 0; } ovl = _screen->getLevelOverlay(ov); @@ -2110,7 +2115,7 @@ void LoLEngine::drawDecorations(int index) { uint8 bb = _blockBrightness >> 4; if (ov > bb) ov -= bb; - else + else ov = 0; } ovl = _screen->getLevelOverlay(ov); diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index 624f8d57df4..dea5df38831 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -190,9 +190,7 @@ uint8 *Screen_LoL::generateLevelOverlay(const Palette &srcPal, uint8 *ovl, int o if (weight > 255) weight = 255; - uint8 *srt = new uint8[768]; - memset(srt, 0x3f, 768); - memcpy(srt, srcPal.getData(), srcPal.getNumColors() * 3); + const uint8 *srt = srcPal.getData(); uint16 r = srt[opColor * 3]; uint16 g = srt[opColor * 3 + 1]; @@ -244,7 +242,6 @@ uint8 *Screen_LoL::generateLevelOverlay(const Palette &srcPal, uint8 *ovl, int o *d++ = l & 0xff; } - delete []srt; return ovl; } diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp index 0caa84dc227..5d9b5a97092 100644 --- a/engines/kyra/sound_towns.cpp +++ b/engines/kyra/sound_towns.cpp @@ -42,7 +42,7 @@ enum EnvelopeState { s_ready, s_attacking, s_decaying, s_sustaining, s_releasing class Towns_EuphonyChannel : public MidiChannel { public: Towns_EuphonyChannel() {} - ~Towns_EuphonyChannel() {} + virtual ~Towns_EuphonyChannel() {} virtual void nextTick(int32 *outbuf, int buflen) = 0; virtual void rate(uint16 r) = 0;