aboutsummaryrefslogtreecommitdiff
path: root/sword2
diff options
context:
space:
mode:
authorTorbjörn Andersson2004-06-10 06:41:08 +0000
committerTorbjörn Andersson2004-06-10 06:41:08 +0000
commitdabb32ce1ac3ffd961c2cb222d6f48e4e29f6356 (patch)
treef5104967273db0b86f676c20748ca599bf05c023 /sword2
parent0d193e87ce9fd590ab6e87e098776b8caac77635 (diff)
downloadscummvm-rg350-dabb32ce1ac3ffd961c2cb222d6f48e4e29f6356.tar.gz
scummvm-rg350-dabb32ce1ac3ffd961c2cb222d6f48e4e29f6356.tar.bz2
scummvm-rg350-dabb32ce1ac3ffd961c2cb222d6f48e4e29f6356.zip
Some more work on the - still disabled - "right click to clear luggage"
code I added some time ago. svn-id: r13952
Diffstat (limited to 'sword2')
-rw-r--r--sword2/mouse.cpp24
-rw-r--r--sword2/sword2.h11
2 files changed, 25 insertions, 10 deletions
diff --git a/sword2/mouse.cpp b/sword2/mouse.cpp
index 0f6f15004c..1e7a42718f 100644
--- a/sword2/mouse.cpp
+++ b/sword2/mouse.cpp
@@ -117,6 +117,16 @@ void Sword2Engine::mouseEngine(void) {
}
}
+#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 @@ void Sword2Engine::dragMouse(void) {
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 @@ void Sword2Engine::normalMouse(void) {
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);
diff --git a/sword2/sword2.h b/sword2/sword2.h
index da50953151..29f4267c0b 100644
--- a/sword2/sword2.h
+++ b/sword2/sword2.h
@@ -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 @@ public:
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);