diff options
author | Florian Kagerer | 2009-06-07 00:37:30 +0000 |
---|---|---|
committer | Florian Kagerer | 2009-06-07 00:37:30 +0000 |
commit | 4416881c0770e4a287cc64fff5c4f91337aa0696 (patch) | |
tree | a59fef3a63b1913e4d773b70c753b25698ee88f8 /engines/kyra | |
parent | f5edbba804d506941f0bf8ec44003b166ba02935 (diff) | |
download | scummvm-rg350-4416881c0770e4a287cc64fff5c4f91337aa0696.tar.gz scummvm-rg350-4416881c0770e4a287cc64fff5c4f91337aa0696.tar.bz2 scummvm-rg350-4416881c0770e4a287cc64fff5c4f91337aa0696.zip |
LOL: implemented king richard healing sequence
svn-id: r41314
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/lol.h | 1 | ||||
-rw-r--r-- | engines/kyra/screen_lol.cpp | 34 | ||||
-rw-r--r-- | engines/kyra/screen_lol.h | 1 | ||||
-rw-r--r-- | engines/kyra/script_lol.cpp | 61 |
4 files changed, 96 insertions, 1 deletions
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index 8cb4cf5241..a26af64b05 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -782,6 +782,7 @@ private: int olol_pitDrop(EMCState *script); int olol_increaseSkill(EMCState *script); int olol_paletteFlash(EMCState *script); + int olol_restoreMagicShroud(EMCState *script); int olol_disableControls(EMCState *script); int olol_enableControls(EMCState *script); int olol_shakeScene(EMCState *script); diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index 5f64a1cddd..3f3aef72fe 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -934,6 +934,40 @@ bool Screen_LoL::fadePaletteStep(uint8 *pal1, uint8 *pal2, uint32 elapsedTime, u return res; } +uint8 *Screen_LoL::generateFadeTable(uint8 *dst, uint8 *src1, uint8 *src2, int numTabs) { + if (!src1) + src1 = _screenPalette; + + uint8 *p1 = dst; + uint8 *p2 = src1; + uint8 *p3 = src2; + + for (int i = 0; i < 768; i++) { + int8 val = (int8)*p3++ - (int8)*p2++; + *dst++ = (uint8)val; + } + + int16 t = 0; + int16 d = 256 / numTabs; + + for (int i = 1; i < numTabs - 1; i++) { + p2 = src1; + p3 = p1; + t += d; + + for (int ii = 0; ii < 768; ii++) { + int val = (((int8)*p3++ * t) >> 8) + (int8)*p2++; + *dst++ = (uint8)val; + } + } + + memcpy(p1, src1, 768); + memcpy(dst, src2, 768); + + dst += 768; + return dst; +} + uint8 Screen_LoL::getShapePaletteSize(const uint8 *shp) { return shp[10]; } diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h index 1ad5379d29..017af4ba48 100644 --- a/engines/kyra/screen_lol.h +++ b/engines/kyra/screen_lol.h @@ -74,6 +74,7 @@ public: void copyColor(int dstColorIndex, int srcColorIndex); bool fadeColor(int dstColorIndex, int srcColorIndex, uint32 elapsedTime, uint32 targetTime); bool fadePaletteStep(uint8 *pal1, uint8 *pal2, uint32 elapsedTime, uint32 targetTime); + uint8 *generateFadeTable(uint8 *dst, uint8 *src1, uint8 *src2, int numTabs); void generateGrayOverlay(const uint8 *srcPal, uint8 *grayOverlay, int factor, int addR, int addG, int addB, int lastColor, bool skipSpecialColors); uint8 *generateLevelOverlay(const uint8 *srcPal, uint8 *ovl, int opColor, int weight); diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index 33edfa0e24..549b88773d 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -2099,6 +2099,65 @@ int LoLEngine::olol_paletteFlash(EMCState *script) { return 0; } +int LoLEngine::olol_restoreMagicShroud(EMCState *script) { + debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_restoreMagicShroud(%p)", (const void *)script); + + WSAMovie_v2 *mov = new WSAMovie_v2(this, _screen); + mov->open("DARKLITE.WSA", 2, 0); + if (!mov->opened()) + return 0; + + _screen->hideMouse(); + + uint8 *fadeTab = new uint8[21504]; + uint8 *tpal1 = fadeTab; + uint8 *tpal2 = tpal1 + 768; + uint8 *tpal3 = tpal2 + 768; + uint8 *tpal4 = 0; + _screen->loadPalette("LITEPAL1.COL", tpal1); + tpal2 = _screen->generateFadeTable(tpal3, 0, tpal1, 21); + _screen->loadPalette("LITEPAL2.COL", tpal2); + tpal4 = tpal2; + tpal2 += 768; + _screen->loadPalette("LITEPAL3.COL", tpal1); + _screen->generateFadeTable(tpal2, tpal4, tpal1, 4); + + for (int i = 0; i < 21; i++) { + uint32 etime = _system->getMillis() + 20 * _tickLength; + mov->displayFrame(i, 0, 0, 0, 0); + _screen->updateScreen(); + _screen->setScreenPalette(tpal3); + tpal3 += 768; + if (i == 2 || i == 5 || i == 8 || i == 11 || i == 13 || i == 15 || i == 17 || i == 19) + snd_playSoundEffect(95, -1); + delayUntil(etime); + } + + snd_playSoundEffect(91, -1); + _screen->fadePalette(tpal3, 300); + tpal3 += 768; + + for (int i = 22; i < 38; i++) { + uint32 etime = _system->getMillis() + 12 * _tickLength; + mov->displayFrame(i, 0, 0, 0, 0); + _screen->updateScreen(); + if (i == 22 || i == 24 || i == 28 || i == 32) { + snd_playSoundEffect(131, -1); + _screen->setScreenPalette(tpal3); + tpal3 += 768; + } + delayUntil(etime); + } + + mov->close(); + delete mov; + delete[] fadeTab; + + _screen->showMouse(); + + return 1; +} + int LoLEngine::olol_disableControls(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_disableControls(%p) (%d)", (const void *)script, stackPos(0)); return gui_disableControls(stackPos(0)); @@ -2780,7 +2839,7 @@ void LoLEngine::setupOpcodeTable() { // 0xB0 Opcode(olol_paletteFlash); - OpcodeUnImpl(); + Opcode(olol_restoreMagicShroud); Opcode(olol_dummy1); // anim buffer select? Opcode(olol_disableControls); |