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

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Mon Jun 1 18:29:13 CEST 2009


Revision: 41103
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41103&view=rev
Author:   athrxx
Date:     2009-06-01 16:29:13 +0000 (Mon, 01 Jun 2009)

Log Message:
-----------
LOL: implemented hand of fate spell

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

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-06-01 15:34:33 UTC (rev 41102)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-06-01 16:29:13 UTC (rev 41103)
@@ -1887,7 +1887,7 @@
 }
 
 int LoLEngine::castHandOfFate(ActiveSpell *a) {
-	processMagicHandOfFate(a->charNum, a->level);
+	processMagicHandOfFate(a->level);
 	return 1;
 }
 
@@ -2415,7 +2415,83 @@
 	runLevelScriptCustom(bl, 0x20, charNum, 3, 0, 0);
 }
 
-void LoLEngine::processMagicHandOfFate(int charNum, int spellLevel) {
+void LoLEngine::processMagicHandOfFate(int spellLevel) {
+	int cp = _screen->setCurPage(2);
+	_screen->copyPage(0, 12);
+
+	WSAMovie_v2 *mov = new WSAMovie_v2(this, _screen);
+	mov->open("hand.wsa", 1, 0);
+	if (!mov->opened())
+		error("Hand: Unable to load HAND.WSA");
+
+	static const uint8 frames[] = { 17, 26, 11, 16, 27, 35, 27, 35, 0, 75 };
+
+	snd_playSoundEffect(173, -1);
+	playSpellAnimation(mov, 0, 10, 3, 112, 0, 0, 0, 0, 0, false);
+	snd_playSoundEffect(151, -1);
+	playSpellAnimation(mov, frames[spellLevel * 2] , frames[spellLevel * 2 + 1], 3, 112, 0, 0, 0, 0, 0, false);
+	snd_playSoundEffect(18, -1);
+	playSpellAnimation(mov, 10, 0, 3, 112, 0, 0, 0, 0, 0, false);
+
+	mov->close();
+	delete mov;
+
+	_screen->setCurPage(cp);
+	_screen->copyPage(12, 2);
+	gui_drawScene(2);
+
+	if (spellLevel < 2) {
+		uint16 b1 = calcNewBlockPosition(_currentBlock, _currentDirection);
+		uint16 b2 = calcNewBlockPosition(b1, _currentDirection);
+		
+		if (!testWallFlag(b2, 0, 4)) {
+			if (!(_levelBlockProperties[b2].assignedObjects & 0x8000)) {
+				checkSceneUpdateNeed(b1);
+				
+				uint16 dir = (_currentDirection << 1);
+				uint16 o = _levelBlockProperties[b1].assignedObjects;
+				while (o & 0x8000) {
+					uint16 o2 = o;
+					MonsterInPlay *m = &_monsters[o & 0x7fff];
+					o = findObject(o)->nextAssignedObject;
+					int nX = 0;
+					int nY = 0;
+
+					getNextStepCoords(m->x, m->y, nX, nY, dir);
+					for (int i = 0; i < 7; i++)
+						getNextStepCoords(nX, nY, nX, nY, dir);
+
+					placeMonster(m, nX, nY);
+					runLevelScriptCustom(b2, 0x800, -1, o2, 0, 0);
+				}
+			}
+		}
+
+	} else {
+		uint16 b1 = calcNewBlockPosition(_currentBlock, _currentDirection);
+		checkSceneUpdateNeed(b1);
+
+		static const uint16 damage[] = { 75, 125, 175 };
+		uint16 o = _levelBlockProperties[b1].assignedObjects;
+
+		while (o & 0x8000) {
+			uint16 t = o;
+			o = findObject(o)->nextAssignedObject;
+			// This might be a bug in the original code, but using
+			// the hand of fate spell won't give any experience points
+			int dmg = calcInflictableDamagePerItem(-1, t, damage[spellLevel - 2], 0x80, 1);
+			inflictDamage(t, dmg, -1, 3, 0x80);
+		}
+	}
+
+	if (_currentLevel == 29)
+		_screen->copyPage(12, 2);
+
+	_screen->copyPage(2, 0);
+	_screen->updateScreen();
+
+	gui_drawScene(2);
+	updateDrawPage2();
 }
 
 void LoLEngine::processMagicMistOfDoom(int charNum, int spellLevel) {
@@ -2906,7 +2982,7 @@
 	return res;
 }
 
-int LoLEngine::inflictDamage(uint16 target, int damage, uint16 attacker, int skill, int deathFlag) {
+int LoLEngine::inflictDamage(int16 target, int damage, int16 attacker, int skill, int deathFlag) {
 	MonsterInPlay *m = 0;
 	LoLCharacter *c = 0;
 

Modified: scummvm/trunk/engines/kyra/lol.h
===================================================================
--- scummvm/trunk/engines/kyra/lol.h	2009-06-01 15:34:33 UTC (rev 41102)
+++ scummvm/trunk/engines/kyra/lol.h	2009-06-01 16:29:13 UTC (rev 41103)
@@ -1327,7 +1327,7 @@
 	void processMagicHeal(int charNum, int spellLevel);
 	void processMagicIce(int charNum, int spellLevel);
 	void processMagicFireball(int charNum, int spellLevel);
-	void processMagicHandOfFate(int charNum, int spellLevel);
+	void processMagicHandOfFate(int spellLevel);
 	void processMagicMistOfDoom(int charNum, int spellLevel);
 	void processMagicLightning(int charNum, int spellLevel);
 	void processMagicFog();
@@ -1381,7 +1381,7 @@
 	// fight
 	int battleHitSkillTest(int16 attacker, int16 target, int skill);
 	int calcInflictableDamage(int16 attacker, int16 target, int hitType);
-	int inflictDamage(uint16 target, int damage, uint16 attacker, int skill, int deathFlag);
+	int inflictDamage(int16 target, int damage, int16 attacker, int skill, int deathFlag);
 	void characterHitpointsZero(int16 charNum, int a);
 	void removeCharacterEffects(LoLCharacter *c, int first, int last);
 	int calcInflictableDamagePerItem(int16 attacker, int16 target, uint16 itemMight, int index, int hitType);


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