From a9bb8c3a50c49b27c1235599ca169390aad959e7 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Wed, 3 Feb 2016 08:27:44 +0100 Subject: AGI: Message box mouse support --- engines/agi/keyboard.cpp | 3 +++ engines/agi/text.cpp | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) (limited to 'engines') diff --git a/engines/agi/keyboard.cpp b/engines/agi/keyboard.cpp index 169c294e4d..5ef6dd256f 100644 --- a/engines/agi/keyboard.cpp +++ b/engines/agi/keyboard.cpp @@ -340,13 +340,16 @@ bool AgiEngine::handleMouseClicks(uint16 &key) { case CYCLE_INNERLOOP_INVENTORY: // TODO: forward break; + case CYCLE_INNERLOOP_MENU_VIA_KEYBOARD: _menu->mouseEvent(key); key = 0; // eat event break; + case CYCLE_INNERLOOP_SYSTEMUI_SELECTSAVEDGAMESLOT: // TODO: forward break; + default: break; } diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp index 135d05e0df..691c0aedfb 100644 --- a/engines/agi/text.cpp +++ b/engines/agi/text.cpp @@ -392,6 +392,24 @@ void TextMgr::messageBox_KeyPress(uint16 newKey) { _messageBoxCancelled = true; _vm->cycleInnerLoopInactive(); // exit messagebox-loop break; + case AGI_MOUSE_BUTTON_LEFT: { + // Find out, where current mouse cursor actually is + int16 mouseY = _vm->_mouse.pos.y; + int16 mouseX = _vm->_mouse.pos.x; + + _vm->adjustPosToGameScreen(mouseX, mouseY); + + // Check, if mouse cursor is within message box + // If it is, take the click as ENTER. + // That's what AGI on Amiga + Apple IIgs did. + // On Atari ST at least via emulator it seems that the mouse cursor froze when messageboxes were diplayed. + if ((mouseX >= _messageState.backgroundPos_x) && (mouseX <= (_messageState.backgroundPos_x + _messageState.backgroundSize_Width))) { + if ((mouseY >= _messageState.backgroundPos_y - _messageState.backgroundSize_Height) && (mouseY <= (_messageState.backgroundPos_y))) { + _vm->cycleInnerLoopInactive(); // exit messagebox-loop + } + } + break; + } default: break; } -- cgit v1.2.3