[Scummvm-cvs-logs] scummvm master -> d734e8fc41c99ccc80b2919d9ce624927ba06c8c
urukgit
urukgit at users.noreply.github.com
Wed Feb 12 23:40:54 CET 2014
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
d734e8fc41 AVALANCHE: Implement keyboard control in Help.
Commit: d734e8fc41c99ccc80b2919d9ce624927ba06c8c
https://github.com/scummvm/scummvm/commit/d734e8fc41c99ccc80b2919d9ce624927ba06c8c
Author: uruk (koppirnyo at gmail.com)
Date: 2014-02-12T14:40:17-08:00
Commit Message:
AVALANCHE: Implement keyboard control in Help.
Changed paths:
engines/avalanche/help.cpp
engines/avalanche/help.h
diff --git a/engines/avalanche/help.cpp b/engines/avalanche/help.cpp
index fd1513d..2ba4cac 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);
}
/**
diff --git a/engines/avalanche/help.h b/engines/avalanche/help.h
index 626709b..23fa5d4 100644
--- a/engines/avalanche/help.h
+++ b/engines/avalanche/help.h
@@ -48,6 +48,7 @@ private:
Button _buttons[10];
byte _highlightWas;
+ byte _buttonNum; // How many buttons do we have on the screen at the moment.
void switchPage(byte which);
Common::String getLine(Common::File &file); // It was a nested function in getMe().
More information about the Scummvm-git-logs
mailing list