From d31d50ac3dbf5c12b126b4d26ba2cd15e7057dcc Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Aug 2007 01:42:38 +0000 Subject: [PATCH] Possible fix for bug #1767748 (Gobliiins is not fast as it can be on slow computers) svn-id: r28456 --- engines/gob/game_v1.cpp | 3 ++- engines/gob/video.cpp | 10 ++++++---- engines/gob/video.h | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp index 6ba68553c7d..9c18ec1151f 100644 --- a/engines/gob/game_v1.cpp +++ b/engines/gob/game_v1.cpp @@ -911,7 +911,8 @@ void Game_v1::collisionsBlock(void) { _shouldPushColls = 0; _vm->_global->_inter_execPtr = savedIP; deltaTime = timeVal - - (_vm->_util->getTimeKey() - timeKey); + ((_vm->_util->getTimeKey() - timeKey) + - _vm->_video->_lastRetraceLength); if (deltaTime < 2) deltaTime = 2; diff --git a/engines/gob/video.cpp b/engines/gob/video.cpp index 83cd436b8a3..0dc15a8657b 100644 --- a/engines/gob/video.cpp +++ b/engines/gob/video.cpp @@ -94,6 +94,7 @@ Video::Video(GobEngine *vm) : _vm(vm) { _splitHeight1 = 200; _splitHeight2 = 0; _splitStart = 0; + _lastRetraceLength = 0; _curSparse = 0; _lastSparse = 0xFFFFFFFF; @@ -161,6 +162,8 @@ SurfaceDesc *Video::initSurfDesc(int16 vidMode, int16 width, int16 height, } void Video::retrace(bool mouse) { + uint32 time = _vm->_util->getTimeKey(); + if (mouse) CursorMan.showMouse((_vm->_draw->_showCursor & 2) != 0); if (_vm->_global->_primarySurfDesc) { @@ -173,14 +176,13 @@ void Video::retrace(bool mouse) { _vm->_height - _splitHeight2, _vm->_width, _splitHeight2); g_system->updateScreen(); } + + _lastRetraceLength = _vm->_util->getTimeKey() - time; } void Video::waitRetrace(bool mouse) { - uint32 time; - - time = _vm->_util->getTimeKey(); retrace(mouse); - _vm->_util->delay(MAX(1, 10 - (int)(_vm->_util->getTimeKey() - time))); + _vm->_util->delay(MAX(1, 10 - (int) _lastRetraceLength)); } void Video::sparseRetrace(int max) { diff --git a/engines/gob/video.h b/engines/gob/video.h index 51d02bd2197..dc23bda81ed 100644 --- a/engines/gob/video.h +++ b/engines/gob/video.h @@ -104,6 +104,7 @@ public: int16 _splitHeight1; int16 _splitHeight2; int16 _splitStart; + uint32 _lastRetraceLength; void freeDriver(); void initPrimary(int16 mode);