[Scummvm-cvs-logs] CVS: scummvm/sword2 mouse.cpp,1.60,1.61 sword2.h,1.62,1.63

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Wed Jun 9 23:42:07 CEST 2004


Update of /cvsroot/scummvm/scummvm/sword2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29143

Modified Files:
	mouse.cpp sword2.h 
Log Message:
Some more work on the - still disabled - "right click to clear luggage"
code I added some time ago.


Index: mouse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/mouse.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- mouse.cpp	10 May 2004 07:10:28 -0000	1.60
+++ mouse.cpp	10 Jun 2004 06:41:08 -0000	1.61
@@ -117,6 +117,16 @@
 	}
 }
 
+#if RIGHT_CLICK_CLEARS_LUGGAGE
+bool Sword2Engine::heldIsInInventory(void) {
+	for (uint i = 0; i < _totalMasters; i++) {
+		if ((uint32) _masterMenuList[i].icon_resource == Logic::_scriptVars[OBJECT_HELD])
+			return true;
+	}
+	return false;
+}
+#endif
+
 int Sword2Engine::menuClick(int menu_items) {
 	if (_mouseX < RDMENU_ICONSTART)
 		return -1;
@@ -283,11 +293,8 @@
 	if (!me)
 		return;
 
-#if 0
-	// If the user right-clicks, cancel drag mode. The original code did
-	// not do this, but it feels natural to me.
-
-	if (me->buttons & RD_RIGHTBUTTONDOWN) {
+#if RIGHT_CLICK_CLEARS_LUGGAGE
+	if ((me->buttons & RD_RIGHTBUTTONDOWN) && heldIsInInventory()) {
 		Logic::_scriptVars[OBJECT_HELD] = 0;
 		_menuSelectedPos = 0;
 		_mouseMode = MOUSE_menu;
@@ -568,11 +575,8 @@
 		return;
 	}
 
-#if 0
-	// If user right-clicks while holding an object, release it. The
-	// original code did not do this, but it feels natural to me.
-
-	if (Logic::_scriptVars[OBJECT_HELD] && (me->buttons & RD_RIGHTBUTTONDOWN)) {
+#if RIGHT_CLICK_CLEARS_LUGGAGE
+	if (Logic::_scriptVars[OBJECT_HELD] && (me->buttons & RD_RIGHTBUTTONDOWN) && heldIsInInventory()) {
 		Logic::_scriptVars[OBJECT_HELD] = 0;
 		_menuSelectedPos = 0;
 		setLuggage(0);

Index: sword2.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/sword2.h,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- sword2.h	9 May 2004 13:32:04 -0000	1.62
+++ sword2.h	10 Jun 2004 06:41:08 -0000	1.63
@@ -20,6 +20,13 @@
 #ifndef	_SWORD2
 #define	_SWORD2
 
+// Enable this to make it possible to clear the mouse cursor luggage by
+// right-clicking. The original didn't do this, but it feels natural to me.
+// However, I'm afraid that it'll interfer badly with parts of the game, so
+// for now I'll keep it disabled.
+
+#define RIGHT_CLICK_CLEARS_LUGGAGE 0
+
 #include "base/engine.h"
 #include "common/util.h"
 
@@ -238,6 +245,10 @@
 
 	int32 initBackground(int32 res, int32 new_palette);
 
+#if RIGHT_CLICK_CLEARS_LUGGAGE
+	bool heldIsInInventory(void);
+#endif
+
 	int menuClick(int menu_items);
 
 	void addMenuObject(MenuObject *obj);





More information about the Scummvm-git-logs mailing list