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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Thu Apr 24 15:14:39 CEST 2008


Revision: 31687
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31687&view=rev
Author:   lordhoto
Date:     2008-04-24 06:14:39 -0700 (Thu, 24 Apr 2008)

Log Message:
-----------
Fixed bug in checkCharCollision.

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

Modified: scummvm/trunk/engines/kyra/items_v3.cpp
===================================================================
--- scummvm/trunk/engines/kyra/items_v3.cpp	2008-04-24 13:12:08 UTC (rev 31686)
+++ scummvm/trunk/engines/kyra/items_v3.cpp	2008-04-24 13:14:39 UTC (rev 31687)
@@ -422,6 +422,38 @@
 		runSceneScript6();
 }
 
+bool KyraEngine_v3::pickUpItem(int x, int y, int runScript) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v3::pickUpItem(%d, %d, %d)", x, y, runScript);
+	int itemPos = checkItemCollision(x, y);
+
+	if (itemPos <= -1)
+		return false;
+
+	if (_itemInHand >= 0) {
+		exchangeMouseItem(itemPos, runScript);
+	} else {
+		_screen->hideMouse();
+		deleteItemAnimEntry(itemPos);
+		int itemId = _itemList[itemPos].id;
+		_itemList[itemPos].id = 0xFFFF;
+		playSoundEffect(0x0B, 0xC8);
+		setMouseCursor(itemId);
+		int str2 = 7;
+
+		//if (_lang == 1)
+		//	str2 = getItemCommandStringPickUp(itemId);
+
+		updateItemCommand(itemId, str2, 0xFF);
+		_itemInHand = itemId;
+		_screen->showMouse();
+
+		if (runScript)
+			runSceneScript6();
+	}
+
+	return true;
+}
+
 bool KyraEngine_v3::isDropable(int x, int y) {
 	debugC(9, kDebugLevelMain, "KyraEngine_v3::isDropable(%d, %d)", x, y);
 	if (y < 14 || y > 187)

Modified: scummvm/trunk/engines/kyra/kyra_v3.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v3.cpp	2008-04-24 13:12:08 UTC (rev 31686)
+++ scummvm/trunk/engines/kyra/kyra_v3.cpp	2008-04-24 13:14:39 UTC (rev 31687)
@@ -967,9 +967,9 @@
 	int height = (scale * 76) >> 8;
 
 	int x1 = _mainCharacter.x1 - width/2;
-	int x2 = _mainCharacter.x2 + width/2;
+	int x2 = _mainCharacter.x1 + width/2;
 	int y1 = _mainCharacter.y1 - height;
-	int y2 = _mainCharacter.y2;
+	int y2 = _mainCharacter.y1;
 
 	if (x >= x1 && x <= x2 && y >= y1 && y <= y2)
 		return true;
@@ -1029,7 +1029,7 @@
 
 	if (checkCharCollision(x, y) && _unk3 >= -1 && runSceneScript2()) {
 		return;
-	} else if (_itemInHand == 27) {
+	} else if (_itemInHand != 27 && pickUpItem(x, y, 1)) {
 		return;
 	} else if (checkItemCollision(x, y) == -1) {
 		resetGameFlag(1);

Modified: scummvm/trunk/engines/kyra/kyra_v3.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v3.h	2008-04-24 13:12:08 UTC (rev 31686)
+++ scummvm/trunk/engines/kyra/kyra_v3.h	2008-04-24 13:14:39 UTC (rev 31687)
@@ -320,7 +320,7 @@
 	bool processItemDrop(uint16 sceneId, uint16 item, int x, int y, int unk1, int unk2);
 	void itemDropDown(int startX, int startY, int dstX, int dstY, int itemSlot, uint16 item, int remove);
 	void exchangeMouseItem(int itemPos, int runScript);
-	bool pickUpItem(int x, int y);
+	bool pickUpItem(int x, int y, int runScript);
 
 	bool isDropable(int x, int y);
 


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