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.
This commit is contained in:
Paul Gilbert 2017-07-30 11:39:40 -04:00
parent 99f5a3dc04
commit 4fee9a492e
8 changed files with 24 additions and 78 deletions

View File

@ -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;

View File

@ -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);
/**

View File

@ -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:

View File

@ -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; }
};

View File

@ -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);

View File

@ -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);
/**

View File

@ -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

View File

@ -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);