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

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Sat Mar 21 21:24:36 CET 2009


Revision: 39599
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39599&view=rev
Author:   athrxx
Date:     2009-03-21 20:24:36 +0000 (Sat, 21 Mar 2009)

Log Message:
-----------
LOL: - added drawing code for certain gfx (blood and slime spots on the floor, teleporters, ice walls)

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

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-03-21 19:57:54 UTC (rev 39598)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-03-21 20:24:36 UTC (rev 39599)
@@ -89,7 +89,7 @@
 	_hideControls = 0;
 	_lastCharInventory = -1;
 
-	_itemIconShapes = _itemShapes = _gameShapes = _thrownShapes = _iceShapes = _fireballShapes = 0;
+	_itemIconShapes = _itemShapes = _gameShapes = _thrownShapes = _effectShapes = _fireballShapes = 0;
 	_levelShpList = _levelDatList = 0;
 	_monsterShapes = _monsterPalettes = 0;
 	_monsterShapesEx = 0;
@@ -254,10 +254,10 @@
 			delete[]  _thrownShapes[i];
 		delete[] _thrownShapes;
 	}
-	if (_iceShapes) {
-		for (int i = 0; i < _numIceShapes; i++)
-			delete[]  _iceShapes[i];
-		delete[] _iceShapes;
+	if (_effectShapes) {
+		for (int i = 0; i < _numEffectShapes; i++)
+			delete[]  _effectShapes[i];
+		delete[] _effectShapes;
 	}
 	if (_fireballShapes) {
 		for (int i = 0; i < _numFireballShapes; i++)
@@ -695,10 +695,10 @@
 
 	_screen->loadBitmap("ICE.SHP", 3, 3, 0);
 	shp = _screen->getCPagePtr(3);
-	_numIceShapes = READ_LE_UINT16(shp);
-	_iceShapes = new uint8*[_numIceShapes];
-	for (int i = 0; i < _numIceShapes; i++)
-		_iceShapes[i] = _screen->makeShapeCopy(shp, i);
+	_numEffectShapes = READ_LE_UINT16(shp);
+	_effectShapes = new uint8*[_numEffectShapes];
+	for (int i = 0; i < _numEffectShapes; i++)
+		_effectShapes[i] = _screen->makeShapeCopy(shp, i);
 
 	_screen->loadBitmap("FIREBALL.SHP", 3, 3, 0);
 	shp = _screen->getCPagePtr(3);

Modified: scummvm/trunk/engines/kyra/lol.h
===================================================================
--- scummvm/trunk/engines/kyra/lol.h	2009-03-21 19:57:54 UTC (rev 39598)
+++ scummvm/trunk/engines/kyra/lol.h	2009-03-21 20:24:36 UTC (rev 39599)
@@ -685,8 +685,8 @@
 	int _numGameShapes;
 	uint8 **_thrownShapes;
 	int _numThrownShapes;
-	uint8 **_iceShapes;
-	int _numIceShapes;
+	uint8 **_effectShapes;
+	int _numEffectShapes;
 	uint8 **_fireballShapes;
 	int _numFireballShapes;
 
@@ -793,7 +793,7 @@
 	void scaleLevelShapesDim(int index, int16 &y1, int16 &y2, int dim);
 	void drawLevelModifyScreenDim(int dim, int16 x1, int16 y1, int16 x2, int16 y2);
 	void drawDecorations(int index);
-	void drawIceShapes(int index, int iceShapeIndex);
+	void drawBlockEffects(int index, int type);
 	void drawScriptShapes(int pageNum);
 	void setWallType(int block, int wall, int val);
 	void updateSceneWindow();

Modified: scummvm/trunk/engines/kyra/scene_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene_lol.cpp	2009-03-21 19:57:54 UTC (rev 39598)
+++ scummvm/trunk/engines/kyra/scene_lol.cpp	2009-03-21 20:24:36 UTC (rev 39599)
@@ -86,7 +86,7 @@
 	addLevelItems();
 	disableMonstersForBlock(_currentBlock);
 
-	_screen->generateGrayOverlay(_screen->_currentPalette, _screen->_grayOverlay,32, 16, 0, 0, 128, true);
+	_screen->generateGrayOverlay(_screen->_currentPalette, _screen->_grayOverlay, 32, 16, 0, 0, 128, true);
 
 	_sceneDefaultUpdate = 0;
 	if (_screen->_fadeFlag == 3)
@@ -1525,12 +1525,12 @@
 		if (i == 16)
 			w |= 0x80;
 
-		drawIceShapes(t, 0);
+		drawBlockEffects(t, 0);
 
 		if (_curBlockCaps[t]->assignedObjects && (w & 0x80))
 			drawBlockObjects(t);
 
-		drawIceShapes(t, 1);
+		drawBlockEffects(t, 1);
 
 		if (!(w & 8))
 			continue;
@@ -1714,10 +1714,31 @@
 	}
 }
 
-void LoLEngine::drawIceShapes(int index, int iceShapeIndex) {
-	uint8 f = _curBlockCaps[index]->flags;
-	if (!(f & 0xf0))
+void LoLEngine::drawBlockEffects(int index, int type) {
+	static const int16 yOffs[] = { 0xff, 0xff, 0x80, 0x80 };
+	uint8 flg = _curBlockCaps[index]->flags;
+	// flags: 0x10 = ice wall, 0x20 = teleporter, 0x40 = blue slime spot, 0x80 = blood spot
+	if (!(flg & 0xf0))
 		return;
+	
+	type = (type == 0) ? 2 : 0;
+	
+	for (int i = 0; i < 2; i++, type++) {
+		if (!((0x10 << type) & flg))
+			continue;
+
+		int16 x = 0x80;
+		int16 y = yOffs[type];
+		uint16 drawFlag = (type == 3) ? 0x80 : 0x20;
+		uint8 *ovl = (type == 3) ? _screen->_grayOverlay : 0;
+		
+		calcCoordinatesAddDirectionOffset(x, y, _currentDirection);
+
+		x |= ((_currentBlockPropertyIndex[index] & 0x1f) << 8);
+		y |= ((_currentBlockPropertyIndex[index] & 0xffe0) << 3);
+
+		drawItemOrMonster(_effectShapes[type], ovl, x, y, 0, (type == 1) ? -20 : 0, drawFlag, -1, false);
+	}
 }
 
 void LoLEngine::drawScriptShapes(int pageNum) {

Modified: scummvm/trunk/engines/kyra/screen.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen.cpp	2009-03-21 19:57:54 UTC (rev 39598)
+++ scummvm/trunk/engines/kyra/screen.cpp	2009-03-21 20:24:36 UTC (rev 39599)
@@ -1248,12 +1248,14 @@
 		&Screen::drawShapePlotType14,		// used by Kyra 1 (invisibility)
 		&Screen::drawShapePlotType11_15,	// used by Kyra 1 (invisibility)
 		0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-		0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-		0,
+		0, 0, 0, 0, 0, 0, 0,
+		&Screen::drawShapePlotType33,		// used by LoL (blood spots on the floor)
+		0, 0, 0,
 		&Screen::drawShapePlotType37,		// used by LoL (monsters)
 		0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-		0, 0, 0, 0, 
-		&Screen::drawShapePlotType52,
+		&Screen::drawShapePlotType48,		// used by LoL (slime spots on the floor)
+		0, 0, 0, 
+		&Screen::drawShapePlotType52,		// used by LoL (projectiles)
 		0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 		0
 	};
@@ -1815,6 +1817,17 @@
 	*dst = cmd;
 }
 
+void Screen::drawShapePlotType33(uint8 *dst, uint8 cmd) {
+	if (cmd == 255) {
+		*dst = _dsTable5[*dst];
+	} else {
+		for (int i = 0; i < _dsTableLoopCount; ++i)
+			cmd = _dsTable[cmd];
+		if (cmd)
+			*dst = cmd;
+	}
+}
+
 void Screen::drawShapePlotType37(uint8 *dst, uint8 cmd) {
 	cmd = _dsTable2[cmd];
 	
@@ -1829,6 +1842,13 @@
 		*dst = cmd;
 }
 
+void Screen::drawShapePlotType48(uint8 *dst, uint8 cmd) {
+	uint8 offs = _dsTable3[cmd];
+	if (!(offs & 0x80))
+		cmd = _dsTable4[(offs << 8) | *dst];
+	*dst = cmd;
+}
+
 void Screen::drawShapePlotType52(uint8 *dst, uint8 cmd) {
 	cmd = _dsTable2[cmd];
 	uint8 offs = _dsTable3[cmd];

Modified: scummvm/trunk/engines/kyra/screen.h
===================================================================
--- scummvm/trunk/engines/kyra/screen.h	2009-03-21 19:57:54 UTC (rev 39598)
+++ scummvm/trunk/engines/kyra/screen.h	2009-03-21 20:24:36 UTC (rev 39599)
@@ -332,7 +332,9 @@
 	void drawShapePlotType12(uint8 *dst, uint8 cmd);
 	void drawShapePlotType13(uint8 *dst, uint8 cmd);
 	void drawShapePlotType14(uint8 *dst, uint8 cmd);
+	void drawShapePlotType33(uint8 *dst, uint8 cmd);
 	void drawShapePlotType37(uint8 *dst, uint8 cmd);
+	void drawShapePlotType48(uint8 *dst, uint8 cmd);
 	void drawShapePlotType52(uint8 *dst, uint8 cmd);
 
 	typedef int (Screen::*DsMarginSkipFunc)(uint8 *&dst, const uint8 *&src, int &cnt);

Modified: scummvm/trunk/engines/kyra/sprites_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sprites_lol.cpp	2009-03-21 19:57:54 UTC (rev 39598)
+++ scummvm/trunk/engines/kyra/sprites_lol.cpp	2009-03-21 20:24:36 UTC (rev 39599)
@@ -989,8 +989,7 @@
 	int l = y1 >> 5;
 	y2 = _monsterScaleY[l];
 	x2 = ((_monsterScaleX[l] * x1) >> 8) + 200;
-	assert (_shpDmY - 56 < 66);
-	w = h = _monsterScaleWH[_shpDmY - 56];
+	w = h = (_shpDmY > 120) ? 0x100 : _monsterScaleWH[_shpDmY - 56];
 
 	if (flip)
 		y2 = ((120 - y2) >> 1) + _screen->getShapeScaledHeight(shape, _dmScaleH);


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