diff options
author | Eugene Sandulenko | 2008-08-03 11:42:05 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2008-08-03 11:42:05 +0000 |
commit | c88c69f357fd886822e7cb9f5c98b59fb993df57 (patch) | |
tree | 97db3a98adce81417cba1741d5e02d145e888311 /engines | |
parent | 117dee5e4a024d41edf1e21b74c0017f78341424 (diff) | |
download | scummvm-rg350-c88c69f357fd886822e7cb9f5c98b59fb993df57.tar.gz scummvm-rg350-c88c69f357fd886822e7cb9f5c98b59fb993df57.tar.bz2 scummvm-rg350-c88c69f357fd886822e7cb9f5c98b59fb993df57.zip |
Fix bug #2017432: "DRASCULA: Typing is slow when you save a game"
svn-id: r33574
Diffstat (limited to 'engines')
-rw-r--r-- | engines/drascula/interface.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/engines/drascula/interface.cpp b/engines/drascula/interface.cpp index 088c3c3704..ef1d1cc7a3 100644 --- a/engines/drascula/interface.cpp +++ b/engines/drascula/interface.cpp @@ -114,7 +114,8 @@ void DrasculaEngine::clearMenu() { } void DrasculaEngine::enterName() { - Common::KeyCode key; + Common::KeyCode key, prevkey = Common::KEYCODE_INVALID; + int counter = 0; int v = 0, h = 0; char select2[23]; strcpy(select2, " "); @@ -123,9 +124,21 @@ void DrasculaEngine::enterName() { copyBackground(115, 14, 115, 14, 176, 9, bgSurface, screenSurface); print_abc(select2, 117, 15); updateScreen(); + _system->delayMillis(100); + key = getScan(); - delay(70); - if (key != 0) { + + // Artifically decrease repeat rate. + // Part of bug fix#2017432 DRASCULA: Typing is slow when you save a game + // Alternative is to roll our own event loop + if (key == prevkey) + if (++counter == 3) { + counter = 0; + prevkey = Common::KEYCODE_INVALID; + } + + if (key != 0 && key != prevkey) { + prevkey = key; if (key >= 0 && key <= 0xFF && isalpha(key)) select2[v] = tolower(key); else if ((key >= Common::KEYCODE_0 && key <= Common::KEYCODE_9) || key == Common::KEYCODE_SPACE) |