From 53f6c2f693755014b0dfe1652e85eeab9cfc18a9 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 30 Sep 2013 12:43:39 +0200 Subject: [PATCH] AVALANCHE: Implement keyboard control in Dialogs::scrollModeDialogue(). --- engines/avalanche/dialogs.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 9868c772e1f..d991ca77117 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -176,9 +176,6 @@ void Dialogs::scrollModeNormal() { } void Dialogs::scrollModeDialogue() { - warning("STUB: Scrolls::scrollModeDialogue()"); - // It should work with keypresses too! TODO: Implement it! - _vm->_graphics->loadMouse(kCurHand); _vm->_graphics->saveScreen(); @@ -189,13 +186,25 @@ void Dialogs::scrollModeDialogue() { _vm->_graphics->refreshScreen(); _vm->getEvent(event); + Common::Point cursorPos = _vm->getMousePos(); cursorPos.y /= 2; - if (_vm->shouldQuit() || (event.type == Common::EVENT_LBUTTONUP)) { - if ((cursorPos.x >= _shadowBoxX - 65) && (cursorPos.y >= _shadowBoxY - 24) && (cursorPos.x <= _shadowBoxX - 5) && (cursorPos.y <= _shadowBoxY - 10)) { + + char inChar = 0; + if (event.type == Common::EVENT_KEYDOWN) { + inChar = (char)event.kbd.ascii; + Common::String temp(inChar); + temp.toUppercase(); + inChar = temp[0]; + } + + if (_vm->shouldQuit() || (event.type == Common::EVENT_LBUTTONUP) || (event.type == Common::EVENT_KEYDOWN)) { + if (((cursorPos.x >= _shadowBoxX - 65) && (cursorPos.y >= _shadowBoxY - 24) && (cursorPos.x <= _shadowBoxX - 5) && (cursorPos.y <= _shadowBoxY - 10)) + || (inChar == 'Y') || (inChar == 'J') || (inChar == 'O')) { // Yes, Ja, Oui _scReturn = true; break; - } else if ((cursorPos.x >= _shadowBoxX + 5) && (cursorPos.y >= _shadowBoxY - 24) && (cursorPos.x <= _shadowBoxX + 65) && (cursorPos.y <= _shadowBoxY - 10)) { + } else if (((cursorPos.x >= _shadowBoxX + 5) && (cursorPos.y >= _shadowBoxY - 24) && (cursorPos.x <= _shadowBoxX + 65) && (cursorPos.y <= _shadowBoxY - 10)) + || (inChar == 'N')){ // No, Non, Nein _scReturn = false; break; }