aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/keyboard.cpp
diff options
context:
space:
mode:
authorMartin Kiewitz2016-02-02 17:28:58 +0100
committerMartin Kiewitz2016-02-02 17:28:58 +0100
commit05a5fc1b65a089f3c12025107f745f6bb748526e (patch)
treef79e55f0ce1de1f908a25c0c2e3c00269bff52e4 /engines/agi/keyboard.cpp
parent604d906038576344e4196d54445603994604c24c (diff)
downloadscummvm-rg350-05a5fc1b65a089f3c12025107f745f6bb748526e.tar.gz
scummvm-rg350-05a5fc1b65a089f3c12025107f745f6bb748526e.tar.bz2
scummvm-rg350-05a5fc1b65a089f3c12025107f745f6bb748526e.zip
AGI: mouse support for menu
Diffstat (limited to 'engines/agi/keyboard.cpp')
-rw-r--r--engines/agi/keyboard.cpp60
1 files changed, 28 insertions, 32 deletions
diff --git a/engines/agi/keyboard.cpp b/engines/agi/keyboard.cpp
index 5a2e165d13..627e5021d1 100644
--- a/engines/agi/keyboard.cpp
+++ b/engines/agi/keyboard.cpp
@@ -285,39 +285,34 @@ bool AgiEngine::handleMouseClicks(uint16 &key) {
if (key != AGI_MOUSE_BUTTON_LEFT)
return false;
- Common::Rect displayLineRect(DISPLAY_WIDTH, FONT_DISPLAY_HEIGHT);
- int16 statusRow = _text->statusRow_Get();
-
- displayLineRect.moveTo(0, statusRow * FONT_DISPLAY_HEIGHT);
-
- if (displayLineRect.contains(_mouse.pos)) {
- if (getFlag(VM_FLAG_MENUS_ACCESSIBLE) && _menu->isAvailable()) {
- warning("click on status line -> menu TODO");
- // TODO: menu
- // This should be done in a better way as in simulate ESC key
- // Sierra seems to have hardcoded it in some way, but we would have to verify, what flags
- // they checked. The previous way wasn't accurate. Mouse support for menu is missing atm anyway.
- //if ((getflag(VM_FLAG_MENUS_WORK) || (getFeatures() & GF_MENUS)) && _mouse.y <= CHAR_LINES) {
- // newInputMode(INPUTMODE_MENU);
- // return true;
- //}
- key = 0; // eat event
- return true;
- }
- }
-
- if (_text->promptIsEnabled() && (!cycleInnerLoopIsActive()) ) {
- // Prompt is currently enabled, but no inner loop is active
- int16 promptRow = _text->promptRow_Get();
+ if (!cycleInnerLoopIsActive()) {
+ // Only do this, when no inner loop is currently active
+ Common::Rect displayLineRect(DISPLAY_WIDTH, FONT_DISPLAY_HEIGHT);
+ int16 statusRow = _text->statusRow_Get();
- displayLineRect.moveTo(0, promptRow * FONT_DISPLAY_HEIGHT);
+ displayLineRect.moveTo(0, statusRow * FONT_DISPLAY_HEIGHT);
if (displayLineRect.contains(_mouse.pos)) {
- // and user clicked within the line of the prompt
- showPredictiveDialog();
+ if (getFlag(VM_FLAG_MENUS_ACCESSIBLE) && _menu->isAvailable()) {
+ _menu->delayedExecuteViaMouse();
+ key = 0; // eat event
+ return true;
+ }
+ }
- key = 0; // eat event
- return true;
+ if (_text->promptIsEnabled()) {
+ // Prompt is currently enabled
+ int16 promptRow = _text->promptRow_Get();
+
+ displayLineRect.moveTo(0, promptRow * FONT_DISPLAY_HEIGHT);
+
+ if (displayLineRect.contains(_mouse.pos)) {
+ // and user clicked within the line of the prompt
+ showPredictiveDialog();
+
+ key = 0; // eat event
+ return true;
+ }
}
}
@@ -347,8 +342,9 @@ bool AgiEngine::handleMouseClicks(uint16 &key) {
case CYCLE_INNERLOOP_INVENTORY:
// TODO: forward
break;
- case CYCLE_INNERLOOP_MENU:
- // TODO: forward
+ case CYCLE_INNERLOOP_MENU_VIA_KEYBOARD:
+ _menu->mouseEvent(key);
+ key = 0; // eat event
break;
case CYCLE_INNERLOOP_SYSTEMUI_SELECTSAVEDGAMESLOT:
// TODO: forward
@@ -393,7 +389,7 @@ bool AgiEngine::handleController(uint16 key) {
// Needs further investigation.
if (getFlag(VM_FLAG_MENUS_ACCESSIBLE) && _menu->isAvailable()) {
// menu is supposed to be accessible and is also available
- _menu->delayedExecute();
+ _menu->delayedExecuteViaKeyboard();
return true;
}
default: