From 184d56df0ace87d5350ce394691904b00fd27c56 Mon Sep 17 00:00:00 2001 From: Arnaud Boutonné Date: Mon, 20 Dec 2010 17:25:58 +0000 Subject: HUGO: Improve keyboard handling - Handle keypad - Fix 'QWERTY' only issue - Suppress useless variable and parameter svn-id: r54977 --- engines/hugo/parser.cpp | 75 ------------------------------------------------- 1 file changed, 75 deletions(-) (limited to 'engines/hugo/parser.cpp') diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp index a07fbff319..9836861bca 100644 --- a/engines/hugo/parser.cpp +++ b/engines/hugo/parser.cpp @@ -35,9 +35,7 @@ #include "hugo/hugo.h" #include "hugo/parser.h" #include "hugo/file.h" -#include "hugo/display.h" #include "hugo/schedule.h" -#include "hugo/route.h" #include "hugo/util.h" #include "hugo/sound.h" #include "hugo/object.h" @@ -55,79 +53,6 @@ Parser::Parser(HugoEngine *vm) : Parser::~Parser() { } -void Parser::keyHandler(uint16 nChar, uint16 nFlags) { - debugC(1, kDebugParser, "keyHandler(%d, %d)", nChar, nFlags); - - status_t &gameStatus = _vm->getGameStatus(); - bool repeatedFl = (nFlags & 0x4000); // TRUE if key is a repeat - -// Process key down event - called from OnKeyDown() - switch (nChar) { // Set various toggle states - case Common::KEYCODE_ESCAPE: // Escape key, may want to QUIT - if (gameStatus.inventoryState == I_ACTIVE) // Remove inventory, if displayed - gameStatus.inventoryState = I_UP; - gameStatus.inventoryObjId = -1; // Deselect any dragged icon - break; - case Common::KEYCODE_END: - case Common::KEYCODE_HOME: - case Common::KEYCODE_LEFT: - case Common::KEYCODE_RIGHT: - case Common::KEYCODE_UP: - case Common::KEYCODE_DOWN: - if (!repeatedFl) { - gameStatus.routeIndex = -1; // Stop any automatic route - _vm->_route->setWalk(nChar); // Direction of hero travel - } - break; - case Common::KEYCODE_F1: // User Help (DOS) - if (_checkDoubleF1Fl) - _vm->_file->instructions(); - else - _vm->_screen->userHelp(); - _checkDoubleF1Fl = !_checkDoubleF1Fl; - break; - case Common::KEYCODE_F2: // Toggle sound - _vm->_sound->toggleSound(); - _vm->_sound->toggleMusic(); - break; - case Common::KEYCODE_F3: // Repeat last line - gameStatus.recallFl = true; - break; - case Common::KEYCODE_F4: // Save game - if (gameStatus.viewState == V_PLAY) - _vm->_file->saveGame(-1, Common::String()); - break; - case Common::KEYCODE_F5: // Restore game - _vm->_file->restoreGame(-1); - _vm->_scheduler->restoreScreen(*_vm->_screen_p); - gameStatus.viewState = V_PLAY; - break; - case Common::KEYCODE_F6: // Inventory - showDosInventory(); - break; - case Common::KEYCODE_F8: // Turbo mode - _config.turboFl = !_config.turboFl; - break; - case Common::KEYCODE_F9: // Boss button - warning("STUB: F9 (DOS) - BossKey"); - break; - default: // Any other key - if (!gameStatus.storyModeFl) { // Keyboard disabled - // Add printable keys to ring buffer - uint16 bnext = _putIndex + 1; - if (bnext >= sizeof(_ringBuffer)) - bnext = 0; - if (bnext != _getIndex) { - _ringBuffer[_putIndex] = nChar; - _putIndex = bnext; - } - } - break; - } - if (_checkDoubleF1Fl && (nChar != Common::KEYCODE_F1)) - _checkDoubleF1Fl = false; -} - /** * Add any new chars to line buffer and display them. * If CR pressed, pass line to LineHandler() -- cgit v1.2.3