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

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Wed Jun 3 19:35:06 CEST 2009


Revision: 41145
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41145&view=rev
Author:   athrxx
Date:     2009-06-03 17:35:06 +0000 (Wed, 03 Jun 2009)

Log Message:
-----------
LOL: implemented mist of doom spell

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

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-06-03 16:29:02 UTC (rev 41144)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-06-03 17:35:06 UTC (rev 41145)
@@ -1236,6 +1236,9 @@
 		{ 0x21, 0xA2, 0xA0, 0x00, 0x4253 }
 	};
 
+	if (charNum > 3)
+		return;
+	
 	LoLCharacter *c = &_characters[charNum];
 	if (!(c->flags & 1))
 		return;
@@ -2491,6 +2494,38 @@
 }
 
 void LoLEngine::processMagicMistOfDoom(int charNum, int spellLevel) {
+	static const uint8 mistDamage[] = { 30, 70, 110, 200 };
+	
+	_envSfxUseQueue = true;	
+	inflictMagicalDamageForBlock(calcNewBlockPosition(_currentBlock, _currentDirection), charNum, mistDamage[spellLevel], 0x80);
+	_envSfxUseQueue = false;
+
+	int cp = _screen->setCurPage(2);
+	_screen->copyPage(0, 2);
+	gui_drawScene(2);
+	_screen->copyPage(2, 12);
+
+	snd_playSoundEffect(155, -1);
+
+	char wsafile[13];
+	snprintf(wsafile, 13, "mists%0d.wsa", spellLevel + 1);
+	WSAMovie_v2 *mov = new WSAMovie_v2(this, _screen);
+	mov->open(wsafile, 1, 0);
+	if (!mov->opened())
+		error("Mist: Unable to load mists.wsa");
+
+	snd_playSoundEffect(_mistAnimData[spellLevel].sound, -1);
+	playSpellAnimation(mov, _mistAnimData[spellLevel].part1First, _mistAnimData[spellLevel].part1Last, 7, 112, 0, 0, 0, 0, 0, false);
+	playSpellAnimation(mov, _mistAnimData[spellLevel].part2First, _mistAnimData[spellLevel].part2Last, 14, 112, 0, 0, 0, 0, 0, false);
+
+	mov->close();
+	delete mov;
+
+	_screen->setCurPage(cp);
+	_screen->copyPage(12, 0);
+
+	updateDrawPage2();
+	this->snd_playQueuedEffects();	
 }
 
 void LoLEngine::processMagicLightning(int charNum, int spellLevel) {
@@ -2833,13 +2868,13 @@
 			_screen->updateScreen();
 		}
 
-		int del = delayTimer - _system->getMillis();
+		int del = (int)(delayTimer - _system->getMillis());
 		do {
-
 			int step = del > _tickLength ? _tickLength : del;
 
 			if (!pal1 || !pal2) {
-				delay(step);
+				if (del > 0)
+					delay(step);
 				del -= step;
 				continue;
 			}
@@ -2847,7 +2882,8 @@
 			if (!_screen->fadePaletteStep(pal1, pal2, _system->getMillis() - startTime, _tickLength * fadeDelay) && !mov)
 				return;
 
-			delay(step);
+			if (del > 0)
+				delay(step);
 			del -= step;
 		} while (del > 0);
 
@@ -2855,7 +2891,7 @@
 			continue;
 
 		curFrame += dir;
-		if (curFrame == lastFrame)
+		if ((dir > 0 && curFrame >= lastFrame) || (dir < 0 && curFrame < lastFrame))
 			fin = true;
 	}
 
@@ -3015,6 +3051,19 @@
 		}
 
 	} else {
+		if (target > 3) {
+			// WORKAROUND for script bug
+			int i = 0;
+			for (; i < 4; i++) {
+				if (_characters[i].id == target) {
+					target = i;
+					break;
+				}
+			}
+			if (i == 4)
+				return 0;
+		}
+
 		c = &_characters[target];
 		if (!(c->flags & 1) || (c->flags & 8))
 			return 0;

Modified: scummvm/trunk/engines/kyra/lol.h
===================================================================
--- scummvm/trunk/engines/kyra/lol.h	2009-06-03 16:29:02 UTC (rev 41144)
+++ scummvm/trunk/engines/kyra/lol.h	2009-06-03 17:35:06 UTC (rev 41145)
@@ -288,6 +288,14 @@
 	uint8 finProgress;
 };
 
+struct MistOfDoomAnimData {
+	uint8 part1First;
+	uint8 part1Last;
+	uint8 part2First;
+	uint8 part2Last;
+	uint8 sound;
+};
+
 class LoLEngine : public KyraEngine_v1 {
 friend class GUI_LoL;
 friend class TextDisplayer_LoL;
@@ -1368,6 +1376,8 @@
 	uint8 **_healiShapes;
 	int _numHealiShapes;
 
+	static const MistOfDoomAnimData _mistAnimData[];
+
 	const uint8 *_updateSpellBookCoords;
 	int _updateSpellBookCoordsSize;
 	const uint8 *_updateSpellBookAnimData;

Modified: scummvm/trunk/engines/kyra/script_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_lol.cpp	2009-06-03 16:29:02 UTC (rev 41144)
+++ scummvm/trunk/engines/kyra/script_lol.cpp	2009-06-03 17:35:06 UTC (rev 41145)
@@ -1423,7 +1423,7 @@
 	debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_checkForCertainPartyMember(%p) (%d)", (const void *)script, stackPos(0));
 	for (int i = 0; i < 4; i++) {
 		if (_characters[i].flags & 9 && _characters[i].id == stackPos(0))
-			return true;
+			return 1;
 	}
 	return 0;
 }

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2009-06-03 16:29:02 UTC (rev 41144)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2009-06-03 17:35:06 UTC (rev 41145)
@@ -3159,6 +3159,8 @@
 	0x51, 0x52, 0x08, 0x09, 0x0A
 };
 
+const uint8 LoLEngine::_numClock2Timers = ARRAYSIZE(LoLEngine::_clock2Timers);
+
 const int8 LoLEngine::_mapCoords[12][4] = {
 	{  0,  7,  0, -5 }, { -5,  0,  6,  0 }, {  7,  5,  7,  1 },
 	{  5,  6,  4,  6 }, {  0,  7,  0, -1 }, { -3,  0,  6,  0 },
@@ -3166,7 +3168,13 @@
 	{  3,  1,  3,  1 }, { -1,  6, -1, -8 }, { -7, -1,  5, -1 }
 };
 
-const uint8 LoLEngine::_numClock2Timers = ARRAYSIZE(LoLEngine::_clock2Timers);
+const MistOfDoomAnimData LoLEngine::_mistAnimData[] = {
+	{  0,   7,   7,  13, 155 },
+	{  0,  16,  16,  17, 155 },
+	{  0,  24,  24,  24, 174 },
+	{  0,  19,  19,  19, 174 },
+	{  0,  16,  16,  17, 175 },
+};
 
 const char * const LoLEngine::_outroShapeFileTable[] = {
 	"AMAZON.SHP", "ARCHRSLG.SHP", "AVIANWRM.SHP", "BANDIT.SHP", "BOAR.SHP", "CABAL.SHP",


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