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

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Sat Apr 4 02:19:34 CEST 2009


Revision: 39823
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39823&view=rev
Author:   athrxx
Date:     2009-04-04 00:19:34 +0000 (Sat, 04 Apr 2009)

Log Message:
-----------
LOL: - reverted last commit which would break map shape drawing (I have now changed the map shape coordinates to decimal numbers though since some compiler seems to complain about signed hex numbers)
- added support for placing items in wall niches (like that one in the thugs' cave)

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/staticres.cpp

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-04-03 23:27:38 UTC (rev 39822)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-04-04 00:19:34 UTC (rev 39823)
@@ -1916,8 +1916,8 @@
 		if (!(_characters[i].flags & 1) || _characters[i].hitPointsCur <= 0)
 			continue;
 
-		int16 charX = 0;
-		int16 charY = 0;
+		uint16 charX = 0;
+		uint16 charY = 0;
 		calcCoordinatesForSingleCharacter(i, charX, charY);
 
 		int d = ABS(x - charX) + ABS(y - charY);

Modified: scummvm/trunk/engines/kyra/lol.h
===================================================================
--- scummvm/trunk/engines/kyra/lol.h	2009-04-03 23:27:38 UTC (rev 39822)
+++ scummvm/trunk/engines/kyra/lol.h	2009-04-04 00:19:34 UTC (rev 39823)
@@ -851,8 +851,8 @@
 	uint16 calcNewBlockPosition(uint16 curBlock, uint16 direction);
 	uint16 calcBlockIndex(uint16 x, uint16 y);
 	void calcCoordinates(uint16 &x, uint16 &y, int block, uint16 xOffs, uint16 yOffs);
-	void calcCoordinatesForSingleCharacter(int charNum, int16 &x, int16 &y);
-	void calcCoordinatesAddDirectionOffset(int16 &x, int16 &y, int direction);
+	void calcCoordinatesForSingleCharacter(int charNum, uint16 &x, uint16 &y);
+	void calcCoordinatesAddDirectionOffset(uint16 &x, uint16 &y, int direction);
 
 	int clickedWallShape(uint16 block, uint16 direction);
 	int clickedLeverOn(uint16 block, uint16 direction);
@@ -1205,7 +1205,7 @@
 	uint8 *_mapCursorOverlay;
 	uint8 _automapTopLeftX;
 	uint8 _automapTopLeftY;
-	static const uint8 _mapCoords[12][4];
+	static const int8 _mapCoords[12][4];
 	bool _mapUpdateNeeded;
 };
 

Modified: scummvm/trunk/engines/kyra/scene_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene_lol.cpp	2009-04-03 23:27:38 UTC (rev 39822)
+++ scummvm/trunk/engines/kyra/scene_lol.cpp	2009-04-04 00:19:34 UTC (rev 39823)
@@ -662,7 +662,7 @@
 	y = ((block & 0xffe0) << 3) | yOffs;
 }
 
-void LoLEngine::calcCoordinatesForSingleCharacter(int charNum, int16 &x, int16 &y) {
+void LoLEngine::calcCoordinatesForSingleCharacter(int charNum, uint16 &x, uint16 &y) {
 	static const uint8 xOffsets[] = {  0x80, 0x00, 0x00, 0x40, 0xC0, 0x00, 0x40, 0x80, 0xC0 };
 	int c = countActiveCharacters();
 	if (!c)
@@ -679,19 +679,25 @@
 	y |= (_partyPosY & 0xff00);
 }
 
-void LoLEngine::calcCoordinatesAddDirectionOffset(int16 &x, int16 &y, int direction) {
+void LoLEngine::calcCoordinatesAddDirectionOffset(uint16 &x, uint16 &y, int direction) {
 	if (!direction)
 		return;
 
+	int tx = x;
+	int ty = y;
+
 	if (direction & 1)
-		SWAP(x, y);
+		SWAP(tx, ty);
 
-	if (direction == 1)
-		y = (y - 256) * -1;
+	if (direction != 1)
+		ty = (ty - 256) * -1;
 
-	if (direction == 3) {
-		x = (x - 256) * -1;
+	if (direction != 3) {
+		tx = (tx - 256) * -1;
 	}
+
+	x = tx;
+	y = ty;
 }
 
 bool LoLEngine::checkBlockPassability(uint16 block, uint16 direction) {
@@ -781,6 +787,16 @@
 }
 
 int LoLEngine::clickedNiche(uint16 block, uint16 direction) {
+	uint8 v = _wllShapeMap[_levelBlockProperties[block].walls[direction]];
+	if (!clickedShape(v) || !_itemInHand)
+		return 0;
+
+	uint16 x = 0x80;
+	uint16 y = 0xff;
+	calcCoordinatesAddDirectionOffset(x, y, _currentDirection);
+	calcCoordinates(x, y, block, x, y);
+	setItemPosition(_itemInHand, x, y, 8, 1);
+	setHandItem(0);
 	return 1;
 }
 
@@ -1878,7 +1894,7 @@
 }
 
 void LoLEngine::drawBlockEffects(int index, int type) {
-	static const int16 yOffs[] = { 0xff, 0xff, 0x80, 0x80 };
+	static const uint16 yOffs[] = { 0xff, 0xff, 0x80, 0x80 };
 	uint8 flg = _visibleBlocks[index]->flags;
 	// flags: 0x10 = ice wall, 0x20 = teleporter, 0x40 = blue slime spot, 0x80 = blood spot
 	if (!(flg & 0xf0))
@@ -1890,8 +1906,8 @@
 		if (!((0x10 << type) & flg))
 			continue;
 
-		int16 x = 0x80;
-		int16 y = yOffs[type];
+		uint16 x = 0x80;
+		uint16 y = yOffs[type];
 		uint16 drawFlag = (type == 3) ? 0x80 : 0x20;
 		uint8 *ovl = (type == 3) ? _screen->_grayOverlay : 0;
 		

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2009-04-03 23:27:38 UTC (rev 39822)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2009-04-04 00:19:34 UTC (rev 39823)
@@ -3063,11 +3063,11 @@
 	0x51, 0x52, 0x08, 0x09, 0x0A
 };
 
-const uint8 LoLEngine::_mapCoords[12][4] = {
-	{ 0x00, 0x07, 0x00, 0xFB }, { 0xFB, 0x00, 0x06, 0x00 }, { 0x07, 0x05, 0x07, 0x01 },
-	{ 0x05, 0x06, 0x04, 0x06 }, { 0x00, 0x07, 0x00, 0xFF }, { 0xFD, 0x00, 0x06, 0x00 },
-	{ 0x06, 0x07, 0x06, 0xFD }, { 0xFD, 0x05, 0x06, 0x05 }, { 0x01, 0x05, 0x01, 0x01 },
-	{ 0x03, 0x01, 0x03, 0x01 }, { 0xFF, 0x06, 0xFF, 0xF8 }, { 0xF9, 0xFF, 0x05, 0xFF }
+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 },
+	{  6,  7,  6, -3 }, { -3,  5,  6,  5 }, {  1,  5,  1,  1 },
+	{  3,  1,  3,  1 }, { -1,  6, -1, -8 }, { -7, -1,  5, -1 }
 };
 
 const uint8 LoLEngine::_numClock2Timers = ARRAYSIZE(LoLEngine::_clock2Timers);


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