aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Hesse2012-06-28 17:37:58 +0200
committerSven Hesse2012-07-30 01:24:18 +0200
commitb5fa752b78c63bedcb53d38fb11244b7e99f9941 (patch)
treea421e5016586003a63ca869faccbeffc4298a9d4
parent1cb6cc0218382bbf5fe487fd0e84d233e56592bb (diff)
downloadscummvm-rg350-b5fa752b78c63bedcb53d38fb11244b7e99f9941.tar.gz
scummvm-rg350-b5fa752b78c63bedcb53d38fb11244b7e99f9941.tar.bz2
scummvm-rg350-b5fa752b78c63bedcb53d38fb11244b7e99f9941.zip
GOB: Keep the mouse responsive while waiting for the frame to end
-rw-r--r--engines/gob/minigames/geisha/penetration.cpp2
-rw-r--r--engines/gob/util.cpp20
-rw-r--r--engines/gob/util.h2
3 files changed, 16 insertions, 8 deletions
diff --git a/engines/gob/minigames/geisha/penetration.cpp b/engines/gob/minigames/geisha/penetration.cpp
index 3be9f1f651..05695e5dbb 100644
--- a/engines/gob/minigames/geisha/penetration.cpp
+++ b/engines/gob/minigames/geisha/penetration.cpp
@@ -505,7 +505,7 @@ bool Penetration::play(bool hasAccessPass, bool hasMaxEnergy, bool testMode) {
// Draw, fade in if necessary and wait for the end of the frame
_vm->_draw->blitInvalidated();
fadeIn();
- _vm->_util->waitEndFrame();
+ _vm->_util->waitEndFrame(false);
// Handle the input
checkInput();
diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp
index 64dfcf9b12..5d6ae78872 100644
--- a/engines/gob/util.cpp
+++ b/engines/gob/util.cpp
@@ -367,21 +367,29 @@ void Util::notifyNewAnim() {
_startFrameTime = getTimeKey();
}
-void Util::waitEndFrame() {
+void Util::waitEndFrame(bool handleInput) {
int32 time;
- _vm->_video->waitRetrace();
-
time = getTimeKey() - _startFrameTime;
if ((time > 1000) || (time < 0)) {
+ _vm->_video->retrace();
_startFrameTime = getTimeKey();
return;
}
- int32 toWait = _frameWaitTime - time;
+ int32 toWait = 0;
+ do {
+ if (toWait > 0)
+ delay(MIN<int>(toWait, 10));
+
+ if (handleInput)
+ processInput();
+
+ _vm->_video->retrace();
- if (toWait > 0)
- delay(toWait);
+ time = getTimeKey() - _startFrameTime;
+ toWait = _frameWaitTime - time;
+ } while (toWait > 0);
_startFrameTime = getTimeKey();
}
diff --git a/engines/gob/util.h b/engines/gob/util.h
index b26a78ab2c..30bff72325 100644
--- a/engines/gob/util.h
+++ b/engines/gob/util.h
@@ -124,7 +124,7 @@ public:
int16 getFrameRate();
void setFrameRate(int16 rate);
void notifyNewAnim();
- void waitEndFrame();
+ void waitEndFrame(bool handleInput = true);
void setScrollOffset(int16 x = -1, int16 y = -1);
static void insertStr(const char *str1, char *str2, int16 pos);