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

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Mon May 11 22:44:44 CEST 2009


Revision: 40466
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40466&view=rev
Author:   athrxx
Date:     2009-05-11 20:44:43 +0000 (Mon, 11 May 2009)

Log Message:
-----------
LOL: - implemented olol_paletteFlash()

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

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-05-11 19:31:55 UTC (rev 40465)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-05-11 20:44:43 UTC (rev 40466)
@@ -1611,6 +1611,28 @@
 	}
 }
 
+void LoLEngine::generateFlashPalette(uint8 *src, uint8 *dst, int colorFlags) {
+	if (!src || !dst)
+		return;
+
+	memcpy(dst, src, 6);
+
+	uint8 *s = src + 6;
+	uint8 *d = dst + 6;
+
+	for (int i = 2; i < 128; i++) {
+		for (int ii = 0; ii < 3; ii++) {
+			uint8 t = *s++ & 0x3f;
+			if (colorFlags & (1 << ii))
+				t += ((0x3f - t) >> 1);
+			else
+				t -= (t >> 1);
+			*d++ = t;
+		}
+	}
+	memcpy(d, s, 384);
+}
+
 void LoLEngine::updateSequenceBackgroundAnimations() {
 	if (_updateFlags & 8)
 		return;
@@ -2111,7 +2133,7 @@
 		if (_activeSpell.p->hpRequired[spellLevel] >= _characters[charNum].hitPointsCur)
 			return 0;
 
-		setCharacterMagicOrHitPoints(charNum, 1, -_activeSpell.p->mpRequired[spellLevel], 1);
+		//setCharacterMagicOrHitPoints(charNum, 1, -_activeSpell.p->mpRequired[spellLevel], 1);
 		setCharacterMagicOrHitPoints(charNum, 0, -_activeSpell.p[1].hpRequired[spellLevel], 1);
 		gui_drawCharPortraitWithStats(charNum);
 

Modified: scummvm/trunk/engines/kyra/lol.h
===================================================================
--- scummvm/trunk/engines/kyra/lol.h	2009-05-11 19:31:55 UTC (rev 40465)
+++ scummvm/trunk/engines/kyra/lol.h	2009-05-11 20:44:43 UTC (rev 40466)
@@ -694,6 +694,7 @@
 	int olol_enableSysTimer(EMCState *script);
 	int olol_checkNeedSceneRestore(EMCState *script);
 	int olol_castSpell(EMCState *script);
+	int olol_paletteFlash(EMCState *script);
 	int olol_disableControls(EMCState *script);
 	int olol_enableControls(EMCState *script);
 	int olol_characterSays(EMCState *script);
@@ -759,6 +760,7 @@
 	void fadeText();
 	void setPaletteBrightness(uint8 *palette, int brightness, int modifier);
 	void generateBrightnessPalette(uint8 *src, uint8 *dst, int brightness, int modifier);
+	void generateFlashPalette(uint8 *src, uint8 *dst, int colorFlags);
 	void updateSequenceBackgroundAnimations();
 	void savePage5();
 	void restorePage5();

Modified: scummvm/trunk/engines/kyra/script_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_lol.cpp	2009-05-11 19:31:55 UTC (rev 40465)
+++ scummvm/trunk/engines/kyra/script_lol.cpp	2009-05-11 20:44:43 UTC (rev 40466)
@@ -1663,6 +1663,39 @@
 	return castSpell(stackPos(0), stackPos(1), stackPos(2));
 }
 
+int LoLEngine::olol_paletteFlash(EMCState *script) {
+	debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_paletteFlash(%p) (%d)", (const void *)script, stackPos(0));
+	uint8 *s = _screen->getPalette(1);
+	uint8 *d = _screen->getPalette(3);
+	uint8 ovl[256];
+	generateFlashPalette(s, d, stackPos(0));
+	_screen->loadSpecialColors(s);
+	_screen->loadSpecialColors(d);
+
+	if (_smoothScrollModeNormal) {
+		for (int i = 0; i < 256; i++)
+			ovl[i] = i;
+		ovl[1] = 6;
+		_screen->copyRegion(112, 0, 112, 0, 176, 120, 0, 2);
+		_screen->applyOverlay(112, 0, 176, 120, 0, ovl);
+	}
+
+	_screen->setScreenPalette(d);
+	_screen->updateScreen();
+
+	delay(2 * _tickLength);
+
+	_screen->setScreenPalette(s);
+	_screen->updateScreen();
+
+	if (_smoothScrollModeNormal) {
+		_screen->copyRegion(112, 0, 112, 0, 176, 120, 2, 0);
+		_screen->updateScreen();
+	}
+	
+	return 0;
+}
+
 int LoLEngine::olol_disableControls(EMCState *script) {
 	debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_disableControls(%p) (%d)", (const void *)script, stackPos(0));
 	return gui_disableControls(stackPos(0));
@@ -2218,8 +2251,8 @@
 	OpcodeUnImpl();
 
 	// 0xB0
+	Opcode(olol_paletteFlash);
 	OpcodeUnImpl();
-	OpcodeUnImpl();
 	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