diff options
author | Torbjörn Andersson | 2003-12-10 07:59:45 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2003-12-10 07:59:45 +0000 |
commit | f89739b8f3243b5bdadb1ecaf3dabb8b6091cc30 (patch) | |
tree | 2fe39fabb9cc0b1ae05f102c9e4cf7078337b9e5 | |
parent | 2ea6f815aad86de6a6ab92f31ab1761916eedfd1 (diff) | |
download | scummvm-rg350-f89739b8f3243b5bdadb1ecaf3dabb8b6091cc30.tar.gz scummvm-rg350-f89739b8f3243b5bdadb1ecaf3dabb8b6091cc30.tar.bz2 scummvm-rg350-f89739b8f3243b5bdadb1ecaf3dabb8b6091cc30.zip |
Cleaned up keyboard handling. The old code would misinterpret some keys,
e.g. it's 'C' or 'c' to display the credits, not some random function key.
svn-id: r11549
-rw-r--r-- | sword2/sword2.cpp | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/sword2/sword2.cpp b/sword2/sword2.cpp index b6d40c3251..fb1ced2ef8 100644 --- a/sword2/sword2.cpp +++ b/sword2/sword2.cpp @@ -342,41 +342,35 @@ void Sword2Engine::go() { if (_input->keyWaiting()) { _input->readKey(&ke); - char c = toupper(ke.ascii); - - if ((ke.modifiers == OSystem::KBD_CTRL && ke.keycode == 'd') || c == '~' || c == '#') { + if ((ke.modifiers == OSystem::KBD_CTRL && ke.keycode == 'd') || ke.ascii == '#' || ke.ascii == '~') { _debugger->attach(); - } - - if (_gamePaused) { // if currently paused - if (c == 'P') { - // 'P' while paused = unpause! - unpauseGame(); - } + } else if (ke.modifiers == 0 || ke.modifiers == OSystem::KBD_SHIFT) { + switch (ke.keycode) { + case 'p': + if (_gamePaused) + unpauseGame(); + else + pauseGame(); + break; + case 'c': + if (!(_features & GF_DEMO)) + _logic->fnPlayCredits(NULL); + break; #ifdef _SWORD2_DEBUG - // frame-skipping only allowed on - // debug version - - else if (c == ' ') { - // SPACE bar while paused = - // step one frame! - _stepOneCycle = true; - unpauseGame(); - } + case ' ': + if (_gamePaused) { + _stepOneCycle = true; + unpauseGame(); + } + break; + case 's': + _renderSkip = !_renderSkip; + break; #endif - } else if (c == 'P') { - // 'P' while not paused = pause! - pauseGame(); - } else if (c == 'C' && !(_features & GF_DEMO)) { - _logic->fnPlayCredits(NULL); - } -#ifdef _SWORD2_DEBUG - else if (c == 'S') { - // 'S' toggles speed up (by skipping - // display rendering) - _renderSkip = !_renderSkip; + default: + break; + } } -#endif } // skip GameCycle if we're paused |