[Scummvm-git-logs] scummvm master -> 4fee9a492ea9db7fd3c7830e2e07b7d79808bbdc

dreammaster dreammaster at scummvm.org
Sun Jul 30 17:41:17 CEST 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4fee9a492e TITANIC: Remap right mouse click to be a left click with Shift held.


Commit: 4fee9a492ea9db7fd3c7830e2e07b7d79808bbdc
    https://github.com/scummvm/scummvm/commit/4fee9a492ea9db7fd3c7830e2e07b7d79808bbdc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-07-30T11:39:40-04:00

Commit Message:
TITANIC: Remap right mouse click to be a left click with Shift held.

This was a suggestion by dafioram; holding down Shift allows you
to skip scene transitions and edit the fragments of room glyphs.
Now with this remapping, you can alternatively just use right clicks.

Changed paths:
    engines/titanic/continue_save_dialog.cpp
    engines/titanic/continue_save_dialog.h
    engines/titanic/events.cpp
    engines/titanic/events.h
    engines/titanic/input_translator.cpp
    engines/titanic/input_translator.h
    engines/titanic/main_game_window.cpp
    engines/titanic/main_game_window.h


diff --git a/engines/titanic/continue_save_dialog.cpp b/engines/titanic/continue_save_dialog.cpp
index f4c7780..c74e1c7 100644
--- a/engines/titanic/continue_save_dialog.cpp
+++ b/engines/titanic/continue_save_dialog.cpp
@@ -176,8 +176,18 @@ void CContinueSaveDialog::mouseMove(const Point &mousePos) {
 }
 
 void CContinueSaveDialog::leftButtonDown(const Point &mousePos) {
-	_mouseDown = true;
-	mouseMove(mousePos);
+	Rect eye1(188, 190, 192, 195), eye2(209, 192, 213, 197);
+
+	if (g_vm->_events->isSpecialPressed(MK_SHIFT) &&		
+			(eye1.contains(mousePos) || eye2.contains(mousePos))) {
+		// Show the Easter Egg "Evil Twin"
+		_evilTwinShown = true;
+		render();
+	} else {
+		// Standard mouse handling
+		_mouseDown = true;
+		mouseMove(mousePos);
+	}
 }
 
 void CContinueSaveDialog::leftButtonUp(const Point &mousePos) {
@@ -185,6 +195,12 @@ void CContinueSaveDialog::leftButtonUp(const Point &mousePos) {
 	Rect startRect(START_X, START_Y, START_X + _startU.w, START_Y + _startU.h);
 	_mouseDown = false;
 
+	if (_evilTwinShown) {
+		_evilTwinShown = false;
+		render();
+		return;
+	}
+
 	if (restoreRect.contains(mousePos)) {
 		// Flag to exit dialog and load highlighted slot. If no slot was
 		// selected explicitly, then fall back on loading the first slot
@@ -205,22 +221,6 @@ void CContinueSaveDialog::leftButtonUp(const Point &mousePos) {
 	}
 }
 
-void CContinueSaveDialog::rightButtonDown(const Point &mousePos) {
-	Rect eye1(188, 190, 192, 195), eye2(209, 192, 213, 197);
-
-	if (eye1.contains(mousePos) || eye2.contains(mousePos)) {
-		_evilTwinShown = true;
-		render();
-	}
-}
-
-void CContinueSaveDialog::rightButtonUp(const Point &mousePos) {
-	if (_evilTwinShown) {
-		_evilTwinShown = false;
-		render();
-	}
-}
-
 void CContinueSaveDialog::keyDown(Common::KeyState keyState) {
 	if (keyState.keycode == Common::KEYCODE_ESCAPE)
 		_selectedSlot = EXIT_GAME;
diff --git a/engines/titanic/continue_save_dialog.h b/engines/titanic/continue_save_dialog.h
index b6d9aeb..29a4bf4 100644
--- a/engines/titanic/continue_save_dialog.h
+++ b/engines/titanic/continue_save_dialog.h
@@ -85,8 +85,6 @@ public:
 	virtual void mouseMove(const Point &mousePos);
 	virtual void leftButtonDown(const Point &mousePos);
 	virtual void leftButtonUp(const Point &mousePos);
-	virtual void rightButtonDown(const Point &mousePos);
-	virtual void rightButtonUp(const Point &mousePos);
 	virtual void keyDown(Common::KeyState keyState);
 
 	/**
diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp
index cb46f8c..f554796 100644
--- a/engines/titanic/events.cpp
+++ b/engines/titanic/events.cpp
@@ -72,14 +72,14 @@ void Events::pollEvents() {
 			eventTarget()->middleButtonUp(_mousePos);
 			return;
 		case Common::EVENT_RBUTTONDOWN:
-			_specialButtons |= MK_RBUTTON;
+			_specialButtons |= MK_LBUTTON | MK_SHIFT;
 			_mousePos = event.mouse;
-			eventTarget()->rightButtonDown(_mousePos);
+			eventTarget()->leftButtonDown(_mousePos);
 			return;
 		case Common::EVENT_RBUTTONUP:
-			_specialButtons &= ~MK_RBUTTON;
+			_specialButtons &= ~(MK_RBUTTON | MK_SHIFT);
 			_mousePos = event.mouse;
-			eventTarget()->rightButtonUp(_mousePos);
+			eventTarget()->leftButtonUp(_mousePos);
 			return;
 		case Common::EVENT_WHEELUP:
 		case Common::EVENT_WHEELDOWN:
diff --git a/engines/titanic/events.h b/engines/titanic/events.h
index e14fbd8..430702b 100644
--- a/engines/titanic/events.h
+++ b/engines/titanic/events.h
@@ -63,15 +63,13 @@ public:
 	virtual void middleButtonDown(const Point &mousePos) {}
 	virtual void middleButtonUp(const Point &mousePos) {}
 	virtual void middleButtonDoubleClick(const Point &mousePos) {}
-	virtual void rightButtonDown(const Point &mousePos) {}
-	virtual void rightButtonUp(const Point &mousePos) {}
 	virtual void mouseWheel(const Point &mousePos, bool wheelUp) {}
 	virtual void keyDown(Common::KeyState keyState) {}
 	virtual void keyUp(Common::KeyState keyState) {}
 };
 
 /**
- * An eent target used for waiting for a mouse or keypress
+ * An event target used for waiting for a mouse or keypress
  */
 class CPressTarget : public CEventTarget {
 public:
@@ -81,7 +79,6 @@ public:
 	virtual ~CPressTarget() {}
 	virtual void leftButtonDown(const Point &mousePos) { _pressed = true; }
 	virtual void middleButtonDown(const Point &mousePos) { _pressed = true; }
-	virtual void rightButtonDown(const Point &mousePos) { _pressed = true; }
 	virtual void keyDown(Common::KeyState keyState) { _pressed = true; }
 };
 
diff --git a/engines/titanic/input_translator.cpp b/engines/titanic/input_translator.cpp
index 0f717de..cd0dbc7 100644
--- a/engines/titanic/input_translator.cpp
+++ b/engines/titanic/input_translator.cpp
@@ -80,26 +80,11 @@ void CInputTranslator::middleButtonDoubleClick(int special, const Point &pt) {
 	_inputHandler->handleMessage(msg);
 }
 
-void CInputTranslator::rightButtonDown(int special, const Point &pt) {
-	CMouseButtonDownMsg msg(pt, MB_RIGHT);
-	_inputHandler->handleMessage(msg);
-}
-
-void CInputTranslator::rightButtonUp(int special, const Point &pt) {
-	CMouseButtonUpMsg msg(pt, MB_RIGHT);
-	_inputHandler->handleMessage(msg);
-}
-
 void CInputTranslator::mouseWheel(bool wheelUp, const Point &pt) {
 	CMouseWheelMsg msg(pt, wheelUp);
 	_inputHandler->handleMessage(msg);
 }
 
-void CInputTranslator::rightButtonDoubleClick(int special, const Point &pt) {
-	CMouseDoubleClickMsg msg(pt, MB_RIGHT);
-	_inputHandler->handleMessage(msg);
-}
-
 void CInputTranslator::keyDown(const Common::KeyState &keyState) {
 	if (keyState.keycode >= Common::KEYCODE_F1 && keyState.keycode <= Common::KEYCODE_F5) {
 		CVirtualKeyCharMsg msg(keyState);
diff --git a/engines/titanic/input_translator.h b/engines/titanic/input_translator.h
index 66dcaa1..cb53a2c 100644
--- a/engines/titanic/input_translator.h
+++ b/engines/titanic/input_translator.h
@@ -48,10 +48,7 @@ public:
 	void middleButtonDown(int special, const Point &pt);
 	void middleButtonUp(int special, const Point &pt);
 	void middleButtonDoubleClick(int special, const Point &pt);
-	void rightButtonDown(int special, const Point &pt);
-	void rightButtonUp(int special, const Point &pt);
 	void mouseWheel(bool wheelUp, const Point &pt);
-	void rightButtonDoubleClick(int special, const Point &pt);
 	void keyDown(const Common::KeyState &keyState);
 
 	/**
diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp
index 6cbcba0..b578bb9 100644
--- a/engines/titanic/main_game_window.cpp
+++ b/engines/titanic/main_game_window.cpp
@@ -32,7 +32,7 @@
 namespace Titanic {
 
 CMainGameWindow::CMainGameWindow(TitanicEngine *vm): _vm(vm),
-		_priorLeftDownTime(0), _priorMiddleDownTime(0), _priorRightDownTime(0) {
+		_priorLeftDownTime(0), _priorMiddleDownTime(0) {
 	_gameView = nullptr;
 	_gameManager = nullptr;
 	_project = nullptr;
@@ -320,26 +320,6 @@ void CMainGameWindow::middleButtonDoubleClick(const Point &mousePos) {
 	HANDLE_MESSAGE(middleButtonDoubleClick)
 }
 
-void CMainGameWindow::rightButtonDown(const Point &mousePos) {
-	if (!isMouseControlEnabled())
-		return;
-
-	if ((_vm->_events->getTicksCount() - _priorRightDownTime) < DOUBLE_CLICK_TIME) {
-		_priorRightDownTime = 0;
-		rightButtonDoubleClick(mousePos);
-	} else {
-		_priorRightDownTime = _vm->_events->getTicksCount();
-		HANDLE_MESSAGE(rightButtonDown)
-	}
-}
-
-void CMainGameWindow::rightButtonUp(const Point &mousePos) {
-	if (!isMouseControlEnabled())
-		return;
-
-	HANDLE_MESSAGE(rightButtonUp)
-}
-
 void CMainGameWindow::mouseWheel(const Point &mousePos, bool wheelUp) {
 	if (!isMouseControlEnabled())
 		return;
@@ -348,13 +328,6 @@ void CMainGameWindow::mouseWheel(const Point &mousePos, bool wheelUp) {
 	mouseChanged();
 }
 
-void CMainGameWindow::rightButtonDoubleClick(const Point &mousePos) {
-	if (!isMouseControlEnabled())
-		return;
-
-	HANDLE_MESSAGE(rightButtonDoubleClick)
-}
-
 void CMainGameWindow::keyDown(Common::KeyState keyState) {
 	if (keyState.keycode == Common::KEYCODE_d && (keyState.flags & Common::KBD_CTRL)) {
 		// Attach to the debugger
diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h
index b29198c..e573217 100644
--- a/engines/titanic/main_game_window.h
+++ b/engines/titanic/main_game_window.h
@@ -41,7 +41,6 @@ private:
 	int _pendingLoadSlot;
 	uint32 _priorLeftDownTime;
 	uint32 _priorMiddleDownTime;
-	uint32 _priorRightDownTime;
 private:
 	/**
 	 * Returns true if a savegame was selected to be loaded
@@ -78,7 +77,6 @@ private:
 
 	void leftButtonDoubleClick(const Point &mousePos);
 	void middleButtonDoubleClick(const Point &mousePos);
-	void rightButtonDoubleClick(const Point &mousePos);
 
 	/**
 	 * Returns true if the player can control the mouse
@@ -105,8 +103,6 @@ public:
 	virtual void leftButtonUp(const Point &mousePos);
 	virtual void middleButtonDown(const Point &mousePos);
 	virtual void middleButtonUp(const Point &mousePos);
-	virtual void rightButtonDown(const Point &mousePos);
-	virtual void rightButtonUp(const Point &mousePos);
 	virtual void mouseWheel(const Point &mousePos, bool wheelUp);
 	virtual void keyDown(Common::KeyState keyState);
 





More information about the Scummvm-git-logs mailing list