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

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Fri Jun 5 00:12:13 CEST 2009


Revision: 41179
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41179&view=rev
Author:   athrxx
Date:     2009-06-04 22:12:13 +0000 (Thu, 04 Jun 2009)

Log Message:
-----------
LOL: implemented Vaelan's cube

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

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-06-04 21:53:45 UTC (rev 41178)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-06-04 22:12:13 UTC (rev 41179)
@@ -536,7 +536,7 @@
 	_spellProcs.push_back(new SpellProc(this, &LoLEngine::castSwarm));
 	_spellProcs.push_back(new SpellProc(this, 0));
 	_spellProcs.push_back(new SpellProc(this, 0));
-	_spellProcs.push_back(new SpellProc(this, &LoLEngine::castUnk));
+	_spellProcs.push_back(new SpellProc(this, &LoLEngine::castVaelansCube));
 	_spellProcs.push_back(new SpellProc(this, 0));
 	_spellProcs.push_back(new SpellProc(this, 0));
 	_spellProcs.push_back(new SpellProc(this, 0));
@@ -1910,13 +1910,12 @@
 	return 1;
 }
 
-int LoLEngine::castUnk(ActiveSpell *a) {
-	return 1;
+int LoLEngine::castVaelansCube(ActiveSpell *a) {
+	return processMagicVaelansCube();
 }
 
 int LoLEngine::castGuardian(ActiveSpell *a) {
-	processMagicGuardian(a->charNum);
-	return 1;
+	return processMagicGuardian(a->charNum);
 }
 
 int LoLEngine::castHealOnSingleCharacter(ActiveSpell *a) {
@@ -1924,7 +1923,7 @@
 	return 1;
 }
 
-void LoLEngine::processMagicSpark(int charNum, int spellLevel) {
+int LoLEngine::processMagicSpark(int charNum, int spellLevel) {
 	WSAMovie_v2 *mov = new WSAMovie_v2(this, _screen);
 	_screen->copyPage(0, 12);
 
@@ -1994,16 +1993,18 @@
 	_sceneUpdateRequired = true;
 
 	delete mov;
+	return 1;
 }
 
-void LoLEngine::processMagicHealSelectTarget() {
+int LoLEngine::processMagicHealSelectTarget() {
 	_txt->printMessage(0, getLangString(0x4040));
 	gui_resetButtonList();
 	gui_setFaceFramesControlButtons(81, 0);
 	gui_initButtonsFromList(_buttonList8);
+	return 1;
 }
 
-void LoLEngine::processMagicHeal(int charNum, int spellLevel) {
+int LoLEngine::processMagicHeal(int charNum, int spellLevel) {
 	if (!_healOverlay) {
 		_healOverlay = new uint8[256];
 		_screen->generateGrayOverlay(_screen->getPalette(1), _healOverlay, 52, 22, 20, 0, 256, true);
@@ -2113,9 +2114,10 @@
 
 	_screen->setCurPage(cp);
 	updateDrawPage2();
+	return 1;
 }
 
-void LoLEngine::processMagicIce(int charNum, int spellLevel) {
+int LoLEngine::processMagicIce(int charNum, int spellLevel) {
 	int cp = _screen->setCurPage(2);
 
 	disableSysTimer(2);
@@ -2261,9 +2263,10 @@
 	delete[] swampCol;
 	delete[] tpal;
 	_screen->setCurPage(cp);
+	return 1;
 }
 
-void LoLEngine::processMagicFireball(int charNum, int spellLevel) {
+int LoLEngine::processMagicFireball(int charNum, int spellLevel) {
 	int fbCnt = 0;
 	int d = 1;
 
@@ -2412,9 +2415,10 @@
 	updateDrawPage2();
 	snd_playQueuedEffects();
 	runLevelScriptCustom(bl, 0x20, charNum, 3, 0, 0);
+	return 1;
 }
 
-void LoLEngine::processMagicHandOfFate(int spellLevel) {
+int LoLEngine::processMagicHandOfFate(int spellLevel) {
 	int cp = _screen->setCurPage(2);
 	_screen->copyPage(0, 12);
 
@@ -2491,9 +2495,10 @@
 
 	gui_drawScene(2);
 	updateDrawPage2();
+	return 1;
 }
 
-void LoLEngine::processMagicMistOfDoom(int charNum, int spellLevel) {
+int LoLEngine::processMagicMistOfDoom(int charNum, int spellLevel) {
 	static const uint8 mistDamage[] = { 30, 70, 110, 200 };
 	
 	_envSfxUseQueue = true;	
@@ -2525,10 +2530,11 @@
 	_screen->copyPage(12, 0);
 
 	updateDrawPage2();
-	this->snd_playQueuedEffects();	
+	this->snd_playQueuedEffects();
+	return 1;
 }
 
-void LoLEngine::processMagicLightning(int charNum, int spellLevel) {
+int LoLEngine::processMagicLightning(int charNum, int spellLevel) {
 	_screen->hideMouse();
 	_screen->copyPage(0, 2);
 	gui_drawScene(2);
@@ -2562,9 +2568,10 @@
 	_sceneUpdateRequired = true;
 	gui_drawScene(0);
 	_screen->showMouse();
+	return 1;
 }
 
-void LoLEngine::processMagicFog() {
+int LoLEngine::processMagicFog() {
 	int cp = _screen->setCurPage(2);
 	_screen->copyPage(0, 12);
 
@@ -2598,9 +2605,10 @@
 	}
 
 	gui_drawScene(0);
+	return 1;
 }
 
-void LoLEngine::processMagicSwarm(int charNum, int damage) {
+int LoLEngine::processMagicSwarm(int charNum, int damage) {
 	int cp = _screen->setCurPage(2);
 	_screen->copyPage(0, 12);
 	snd_playSoundEffect(74, -1);
@@ -2662,12 +2670,71 @@
 
 	_screen->setCurPage(cp);
 	delete mov;
+	return 1;
 }
 
-void LoLEngine::processMagicGuardian(int charNum) {
-	//uint16 targetBlock = 0;
-	//int dist = getSpellTargetBlock(_currentBlock, _currentDirection, 3, targetBlock);
+int LoLEngine::processMagicVaelansCube() {
+	uint8 *tmpPal1 = new uint8[768];
+	uint8 *tmpPal2 = new uint8[768];
+	uint8 *sp1 = _screen->getPalette(1);
 
+	memcpy(tmpPal1, sp1, 768);
+	memcpy(tmpPal2, sp1, 768);
+
+	for (int i = 0; i < 128; i++) {
+		uint16 a = sp1[i * 3] + 16;
+		tmpPal2[i * 3] = (a > 60) ? 60 : a;
+		tmpPal2[i * 3 + 1] = sp1[i * 3 + 1];
+		a = sp1[i * 3 + 2] + 19;
+		tmpPal2[i * 3 + 2] = (a > 60) ? 60 : a;
+	}
+
+	snd_playSoundEffect(146, -1);
+
+	uint32 ctime = _system->getMillis();
+	uint32 endTime = _system->getMillis() + 70 * _tickLength;
+
+	while (_system->getMillis() < endTime) {
+		_screen->fadePaletteStep(tmpPal1, tmpPal2, _system->getMillis() - ctime, 70 * _tickLength);
+		updateInput();
+	}
+
+	uint16 bl = calcNewBlockPosition(_currentBlock, _currentDirection);
+	uint8 s = _levelBlockProperties[bl].walls[_currentDirection ^ 2];
+	uint8 flg = _wllWallFlags[s];
+
+	int v = (s == 47 && (_currentLevel == 17 || _currentLevel == 24)) ? 1 : 0;
+	if ((_wllVmpMap[s] == 1 || _wllVmpMap[s] == 2) && (flg & 1) && (_currentLevel == 22)) {
+		memset(_levelBlockProperties[bl].walls, 0, 4);
+		gui_drawScene(0);
+		v = 1;
+	}
+
+	uint16 o = _levelBlockProperties[bl].assignedObjects;
+	while (o & 0x8000) {
+		MonsterInPlay *m = &_monsters[o & 0x7fff];
+		o = m->nextAssignedObject;
+		if (m->properties->flags & 0x1000) {
+			inflictDamage(o, 100, 0xffff, 0, 0x80);
+			v = 1;
+		}
+	}
+
+	ctime = _system->getMillis();
+	endTime = _system->getMillis() + 70 * _tickLength;
+
+	while (_system->getMillis() < endTime) {
+		_screen->fadePaletteStep(tmpPal2, tmpPal1, _system->getMillis() - ctime, 70 * _tickLength);
+		updateInput();
+	}
+
+	delete[] tmpPal1;
+	delete[] tmpPal2;
+
+	return v;
+}
+
+int LoLEngine::processMagicGuardian(int charNum) {
 	int cp = _screen->setCurPage(2);
 	_screen->copyPage(0, 2);
 	_screen->copyPage(2, 12);
@@ -2682,7 +2749,7 @@
 	_screen->copyPage(2, 12);
 	
 	uint16 bl = calcNewBlockPosition(_currentBlock, _currentDirection);
-	//bool a = (_levelBlockProperties[bl].assignedObjects & 0x8000) ? true : false;
+	int res = (_levelBlockProperties[bl].assignedObjects & 0x8000) ? 1 : 0;
 	inflictMagicalDamageForBlock(bl, charNum, 200, 0x80);
 
 	_screen->copyPage(12, 2);
@@ -2699,6 +2766,7 @@
 	_screen->setCurPage(cp);
 	gui_drawPlayField();
 	updateDrawPage2();
+	return res;
 }
 
 void LoLEngine::callbackProcessMagicSwarm(WSAMovie_v2 *mov, int x, int y) {

Modified: scummvm/trunk/engines/kyra/lol.h
===================================================================
--- scummvm/trunk/engines/kyra/lol.h	2009-06-04 21:53:45 UTC (rev 41178)
+++ scummvm/trunk/engines/kyra/lol.h	2009-06-04 22:12:13 UTC (rev 41179)
@@ -1326,21 +1326,22 @@
 	int castLightning(ActiveSpell *a);
 	int castFog(ActiveSpell *a);
 	int castSwarm(ActiveSpell *a);
-	int castUnk(ActiveSpell *a);
+	int castVaelansCube(ActiveSpell *a);
 	int castGuardian(ActiveSpell *a);
 	int castHealOnSingleCharacter(ActiveSpell *a);
 
-	void processMagicSpark(int charNum, int spellLevel);
-	void processMagicHealSelectTarget();
-	void processMagicHeal(int charNum, int spellLevel);
-	void processMagicIce(int charNum, int spellLevel);
-	void processMagicFireball(int charNum, int spellLevel);
-	void processMagicHandOfFate(int spellLevel);
-	void processMagicMistOfDoom(int charNum, int spellLevel);
-	void processMagicLightning(int charNum, int spellLevel);
-	void processMagicFog();
-	void processMagicSwarm(int charNum, int damage);
-	void processMagicGuardian(int charNum);
+	int processMagicSpark(int charNum, int spellLevel);
+	int processMagicHealSelectTarget();
+	int processMagicHeal(int charNum, int spellLevel);
+	int processMagicIce(int charNum, int spellLevel);
+	int processMagicFireball(int charNum, int spellLevel);
+	int processMagicHandOfFate(int spellLevel);
+	int processMagicMistOfDoom(int charNum, int spellLevel);
+	int processMagicLightning(int charNum, int spellLevel);
+	int processMagicFog();
+	int processMagicSwarm(int charNum, int damage);
+	int processMagicVaelansCube();
+	int processMagicGuardian(int charNum);
 
 	void callbackProcessMagicSwarm(WSAMovie_v2 *mov, int x, int y);
 	void callbackProcessMagicLightning(WSAMovie_v2 *mov, int x, int y);

Modified: scummvm/trunk/engines/kyra/screen_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen_lol.cpp	2009-06-04 21:53:45 UTC (rev 41178)
+++ scummvm/trunk/engines/kyra/screen_lol.cpp	2009-06-04 22:12:13 UTC (rev 41179)
@@ -589,6 +589,16 @@
 		va_end(args);
 	}
 
+	//		_internDimH: h0
+//		_internDimW: w0
+//		_internDimDstX: x1
+//		_internDimDstY: y1
+//		_internBlockWidth: w1
+//		_internBlockHeight: h1
+//		_internDimU5: x2
+//		_internDimU6: y2
+//		_internBlockWidth2: w2
+
 	_internDimX = _internDimY = 0;
 	_internDimW = w1;
 	_internDimH = h1;


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