[Scummvm-cvs-logs] SF.net SVN: scummvm:[41314] scummvm/trunk/engines/kyra

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Sun Jun 7 02:37:30 CEST 2009


Revision: 41314
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41314&view=rev
Author:   athrxx
Date:     2009-06-07 00:37:30 +0000 (Sun, 07 Jun 2009)

Log Message:
-----------
LOL: implemented king richard healing sequence

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/lol.h
    scummvm/trunk/engines/kyra/screen_lol.cpp
    scummvm/trunk/engines/kyra/screen_lol.h
    scummvm/trunk/engines/kyra/script_lol.cpp

Modified: scummvm/trunk/engines/kyra/lol.h
===================================================================
--- scummvm/trunk/engines/kyra/lol.h	2009-06-06 23:40:11 UTC (rev 41313)
+++ scummvm/trunk/engines/kyra/lol.h	2009-06-07 00:37:30 UTC (rev 41314)
@@ -782,6 +782,7 @@
 	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);

Modified: scummvm/trunk/engines/kyra/screen_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen_lol.cpp	2009-06-06 23:40:11 UTC (rev 41313)
+++ scummvm/trunk/engines/kyra/screen_lol.cpp	2009-06-07 00:37:30 UTC (rev 41314)
@@ -934,6 +934,40 @@
 	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];
 }

Modified: scummvm/trunk/engines/kyra/screen_lol.h
===================================================================
--- scummvm/trunk/engines/kyra/screen_lol.h	2009-06-06 23:40:11 UTC (rev 41313)
+++ scummvm/trunk/engines/kyra/screen_lol.h	2009-06-07 00:37:30 UTC (rev 41314)
@@ -74,6 +74,7 @@
 	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);

Modified: scummvm/trunk/engines/kyra/script_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_lol.cpp	2009-06-06 23:40:11 UTC (rev 41313)
+++ scummvm/trunk/engines/kyra/script_lol.cpp	2009-06-07 00:37:30 UTC (rev 41314)
@@ -2099,6 +2099,65 @@
 	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 @@
 
 	// 0xB0
 	Opcode(olol_paletteFlash);
-	OpcodeUnImpl();
+	Opcode(olol_restoreMagicShroud);
 	Opcode(olol_dummy1); // anim buffer select?
 	Opcode(olol_disableControls);
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list