aboutsummaryrefslogtreecommitdiff
path: root/engines/avalanche/help.cpp
diff options
context:
space:
mode:
authoruruk2014-02-12 23:40:17 +0100
committeruruk2014-02-12 23:40:17 +0100
commitd734e8fc41c99ccc80b2919d9ce624927ba06c8c (patch)
tree4c3c65f236cf80fa751b2f12a82c150d81805360 /engines/avalanche/help.cpp
parente5281bc0dbdf38870da9c20badaffca0fb19924a (diff)
downloadscummvm-rg350-d734e8fc41c99ccc80b2919d9ce624927ba06c8c.tar.gz
scummvm-rg350-d734e8fc41c99ccc80b2919d9ce624927ba06c8c.tar.bz2
scummvm-rg350-d734e8fc41c99ccc80b2919d9ce624927ba06c8c.zip
AVALANCHE: Implement keyboard control in Help.
Diffstat (limited to 'engines/avalanche/help.cpp')
-rw-r--r--engines/avalanche/help.cpp37
1 files changed, 35 insertions, 2 deletions
diff --git a/engines/avalanche/help.cpp b/engines/avalanche/help.cpp
index fd1513d1d7..2ba4cac168 100644
--- a/engines/avalanche/help.cpp
+++ b/engines/avalanche/help.cpp
@@ -29,6 +29,7 @@
#include "avalanche/avalanche.h"
#include "avalanche/help.h"
+#include <cctype>
namespace Avalanche {
@@ -36,6 +37,7 @@ Help::Help(AvalancheEngine *vm) {
_vm = vm;
_highlightWas = 0;
+ _buttonNum = 0;
}
/**
@@ -89,6 +91,7 @@ void Help::switchPage(byte which) {
// We are now at the end of the text. Next we must read the icons:
y = 0;
+ _buttonNum = 0;
while (!file.eos()) {
_buttons[y]._trigger = file.readByte();
if (_buttons[y]._trigger == 177)
@@ -103,10 +106,10 @@ void Help::switchPage(byte which) {
case 254:
text = Common::String("Esc");
break;
- case 214: // Latin capital letter O with diaeresis
+ case 214: // PageUp
text = Common::String(24);
break;
- case 216: // Latin capital letter O with stroke
+ case 216: // PageDown
text = Common::String(25);
break;
default:
@@ -118,6 +121,7 @@ void Help::switchPage(byte which) {
_vm->_graphics->drawBigText(text, _vm->_font, 8, 590 - (text.size() * 8), 17 + (y + 1) * 27, kColorCyan);
y++;
+ _buttonNum++;
}
_vm->_graphics->refreshScreen();
@@ -142,6 +146,35 @@ byte Help::checkMouse() {
void Help::continueHelp() {
warning("STUB: Help::continueHelp()");
+
+ do {
+ Common::Event event;
+ bool escape = false;
+ while (!_vm->shouldQuit() && !escape) {
+ _vm->_graphics->refreshScreen();
+ while (_vm->getEvent(event)) {
+ if (event.type == Common::EVENT_KEYDOWN) {
+ escape = true;
+ break;
+ }
+ }
+ }
+
+ if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
+ break;
+
+ for (int i = 0; i < _buttonNum; i++) {
+ char upperCase = toupper(event.kbd.ascii);
+ if (((_buttons[i]._trigger == upperCase) && (65 <= upperCase) && (upperCase <= 90)) ||
+ ((event.kbd.keycode == Common::KEYCODE_PAGEUP) && (_buttons[i]._trigger == 214)) ||
+ ((event.kbd.keycode == Common::KEYCODE_PAGEDOWN) && (_buttons[i]._trigger == 216))) { // We had to handle the pageups/pagedowns separately.
+ _vm->fadeOut();
+ switchPage(_buttons[i]._whither);
+ _vm->fadeIn();
+ break;
+ }
+ }
+ } while (true);
}
/**