diff options
-rw-r--r-- | engines/titanic/continue_save_dialog.cpp | 36 | ||||
-rw-r--r-- | engines/titanic/continue_save_dialog.h | 2 | ||||
-rw-r--r-- | engines/titanic/events.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/events.h | 5 | ||||
-rw-r--r-- | engines/titanic/input_translator.cpp | 15 | ||||
-rw-r--r-- | engines/titanic/input_translator.h | 3 | ||||
-rw-r--r-- | engines/titanic/main_game_window.cpp | 29 | ||||
-rw-r--r-- | engines/titanic/main_game_window.h | 4 |
8 files changed, 24 insertions, 78 deletions
diff --git a/engines/titanic/continue_save_dialog.cpp b/engines/titanic/continue_save_dialog.cpp index f4c778083c..c74e1c7634 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 b6d9aebfac..29a4bf4f14 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 cb46f8c42b..f554796d09 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 e14fbd8637..430702be00 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 0f717de37f..cd0dbc7d56 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 66dcaa1cbe..cb53a2c396 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 6cbcba08ff..b578bb942e 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 b29198caeb..e573217058 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); |