diff options
author | Arnaud Boutonné | 2011-01-04 08:36:03 +0000 |
---|---|---|
committer | Arnaud Boutonné | 2011-01-04 08:36:03 +0000 |
commit | 9ee74fee8a8cc296ccd4a22bc34900afefc7438e (patch) | |
tree | 9213bbf7a94ebfd8b09016fdec7776db2e7273c0 /engines/hugo/parser_v1d.cpp | |
parent | e59eb31ba94cf80cd905fe954970c1b926d1c3a4 (diff) | |
download | scummvm-rg350-9ee74fee8a8cc296ccd4a22bc34900afefc7438e.tar.gz scummvm-rg350-9ee74fee8a8cc296ccd4a22bc34900afefc7438e.tar.bz2 scummvm-rg350-9ee74fee8a8cc296ccd4a22bc34900afefc7438e.zip |
HUGO: Implement menu commands
Also did some cleanup, and had to comment out
handleMouseUp() as it's currently not working really well
svn-id: r55114
Diffstat (limited to 'engines/hugo/parser_v1d.cpp')
-rw-r--r-- | engines/hugo/parser_v1d.cpp | 157 |
1 files changed, 9 insertions, 148 deletions
diff --git a/engines/hugo/parser_v1d.cpp b/engines/hugo/parser_v1d.cpp index 405dd55c13..1539dfb4c0 100644 --- a/engines/hugo/parser_v1d.cpp +++ b/engines/hugo/parser_v1d.cpp @@ -33,15 +33,12 @@ // parser.c - handles all keyboard/command input #include "common/system.h" -#include "common/events.h" #include "hugo/hugo.h" #include "hugo/parser.h" #include "hugo/file.h" #include "hugo/schedule.h" -#include "hugo/display.h" #include "hugo/util.h" -#include "hugo/route.h" #include "hugo/sound.h" #include "hugo/object.h" @@ -300,151 +297,6 @@ bool Parser_v1d::isCatchallVerb(bool testNounFl, char *noun, char *verb, objectL return false; } -void Parser_v1d::keyHandler(Common::Event event) { - debugC(1, kDebugParser, "keyHandler(%d)", event.kbd.keycode); - - status_t &gameStatus = _vm->getGameStatus(); - uint16 nChar = event.kbd.keycode; - - // 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_PAGEUP: - case Common::KEYCODE_PAGEDOWN: - case Common::KEYCODE_KP1: - case Common::KEYCODE_KP7: - case Common::KEYCODE_KP9: - case Common::KEYCODE_KP3: - case Common::KEYCODE_LEFT: - case Common::KEYCODE_RIGHT: - case Common::KEYCODE_UP: - case Common::KEYCODE_DOWN: - case Common::KEYCODE_KP4: - case Common::KEYCODE_KP6: - case Common::KEYCODE_KP8: - case Common::KEYCODE_KP2: - 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) { - if (gameStatus.gameOverFl) - Utils::gameOverMsg(); - else - _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 - if (gameStatus.viewState == V_PLAY) { - if (gameStatus.gameOverFl) - Utils::gameOverMsg(); - else - 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; - case Common::KEYCODE_l: - if (event.kbd.hasFlags(Common::KBD_CTRL)) { - _vm->_file->restoreGame(-1); - _vm->_scheduler->restoreScreen(*_vm->_screen_p); - gameStatus.viewState = V_PLAY; - } else { - 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] = event.kbd.ascii; - _putIndex = bnext; - } - } - } - break; - case Common::KEYCODE_n: - if (event.kbd.hasFlags(Common::KBD_CTRL)) { - warning("STUB: CTRL-N (WIN) - New Game"); - } else { - 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] = event.kbd.ascii; - _putIndex = bnext; - } - } - } - break; - case Common::KEYCODE_s: - if (event.kbd.hasFlags(Common::KBD_CTRL)) { - if (gameStatus.viewState == V_PLAY) { - if (gameStatus.gameOverFl) - Utils::gameOverMsg(); - else - _vm->_file->saveGame(-1, Common::String()); - } - } else { - 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] = event.kbd.ascii; - _putIndex = bnext; - } - } - } - 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] = event.kbd.ascii; - _putIndex = bnext; - } - } - break; - } - if (_checkDoubleF1Fl && (nChar != Common::KEYCODE_F1)) - _checkDoubleF1Fl = false; -} - /** * Parse the user's line of text input. Generate events as necessary */ @@ -570,4 +422,13 @@ void Parser_v1d::lineHandler() { Utils::Box(BOX_ANY, "%s", _vm->_textParser[kTBEh_1d]); } +void Parser_v1d::showInventory() { + status_t &gameStatus = _vm->getGameStatus(); + if (gameStatus.viewState == V_PLAY) { + if (gameStatus.gameOverFl) + Utils::gameOverMsg(); + else + showDosInventory(); + } +} } // End of namespace Hugo |