aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2007-01-01 07:37:07 +0000
committerTorbjörn Andersson2007-01-01 07:37:07 +0000
commit6944797891cb80cb465d0d06ab824f498e7459d8 (patch)
tree2d82ede34066ed5fb7a1c8995ec388510ea96d43
parentcbe3cb850caae223dedb42192b02e8533ca55790 (diff)
downloadscummvm-rg350-6944797891cb80cb465d0d06ab824f498e7459d8.tar.gz
scummvm-rg350-6944797891cb80cb465d0d06ab824f498e7459d8.tar.bz2
scummvm-rg350-6944797891cb80cb465d0d06ab824f498e7459d8.zip
At Kirben's request, I've applied my old keyboard repeat patch for the AGOS
engine. Swampy's Adventures really needs it, and the more generic solution to keyboard repeat is apparently stalled. svn-id: r24964
-rw-r--r--engines/agos/agos.cpp2
-rw-r--r--engines/agos/agos.h2
-rw-r--r--engines/agos/event.cpp12
3 files changed, 16 insertions, 0 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index e7147ef269..8003c2843c 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -81,6 +81,8 @@ AGOSEngine::AGOSEngine(OSystem *syst)
_debugger = 0;
_keyPressed = 0;
+ _keyRepeatKey = 0;
+ _keyRepeatTime = 0;
_gameFile = 0;
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index ecc12c2ad4..043ab9709b 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -213,6 +213,8 @@ protected:
const GameSpecificSettings *gss;
byte _keyPressed;
+ byte _keyRepeatKey;
+ uint32 _keyRepeatTime;
typedef enum {
FORMAT_NONE,
diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp
index 1f083d23dd..37a72db995 100644
--- a/engines/agos/event.cpp
+++ b/engines/agos/event.cpp
@@ -369,6 +369,13 @@ void AGOSEngine::delay(uint amount) {
_keyPressed = 8;
else
_keyPressed = (byte)event.kbd.ascii;
+
+ _keyRepeatTime = _system->getMillis() + 400;
+ _keyRepeatKey = _keyPressed;
+ break;
+ case OSystem::EVENT_KEYUP:
+ _keyRepeatKey = 0;
+ _keyRepeatTime = 0;
break;
case OSystem::EVENT_MOUSEMOVE:
_sdlMouseX = event.mouse.x;
@@ -420,6 +427,11 @@ void AGOSEngine::delay(uint amount) {
cur = _system->getMillis();
} while (cur < start + amount);
+
+ if (_keyPressed == 0 && _keyRepeatKey != 0 && _keyRepeatTime != 0 && cur >= _keyRepeatTime) {
+ _keyPressed = _keyRepeatKey;
+ _keyRepeatTime = cur + 100;
+ }
}
void AGOSEngine::timer_callback() {