diff options
author | Strangerke | 2014-08-20 01:46:46 +0200 |
---|---|---|
committer | Strangerke | 2014-08-20 01:46:46 +0200 |
commit | b4f74b9b5e3b5eebcd695f8c07dd2d78e6a53a61 (patch) | |
tree | 02cc52e66f3352c30398f6413e403e14423da0a4 /engines/access | |
parent | 992ea95cd796aafeb1a1c61fcf29d57c7ecba8db (diff) | |
download | scummvm-rg350-b4f74b9b5e3b5eebcd695f8c07dd2d78e6a53a61.tar.gz scummvm-rg350-b4f74b9b5e3b5eebcd695f8c07dd2d78e6a53a61.tar.bz2 scummvm-rg350-b4f74b9b5e3b5eebcd695f8c07dd2d78e6a53a61.zip |
ACCESS: Use a variable delay of up to 20ms instead of a fix 50ms
Diffstat (limited to 'engines/access')
-rw-r--r-- | engines/access/access.cpp | 13 | ||||
-rw-r--r-- | engines/access/access.h | 2 | ||||
-rw-r--r-- | engines/access/room.cpp | 4 |
3 files changed, 14 insertions, 5 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp index ab58f8effc..71271230dd 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -99,6 +99,8 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc) _rKeyFlag = 0; _mapOffset = 0; _screenVirtX = 0; + _lastTime = g_system->getMillis(); + _curTime = 0; } AccessEngine::~AccessEngine() { @@ -171,7 +173,16 @@ void AccessEngine::dummyLoop() { // Dummy game loop while (!shouldQuit()) { _events->pollEvents(); - g_system->delayMillis(50); + + _curTime = g_system->getMillis(); + // Process machine once every tick + while (_curTime - _lastTime < 20) { + g_system->delayMillis(5); + _curTime = g_system->getMillis(); + } + + _lastTime = _curTime; + g_system->updateScreen(); if (_events->_leftButton) { diff --git a/engines/access/access.h b/engines/access/access.h index 88b6c837a5..f775310805 100644 --- a/engines/access/access.h +++ b/engines/access/access.h @@ -73,6 +73,8 @@ struct AccessGameDescription; class AccessEngine : public Engine { private: + uint32 _lastTime, _curTime; + /** * Handles basic initialisation */ diff --git a/engines/access/room.cpp b/engines/access/room.cpp index 5e3a4d743d..e40c6b7096 100644 --- a/engines/access/room.cpp +++ b/engines/access/room.cpp @@ -79,10 +79,6 @@ void Room::doRoom() { _vm->_screen->fadeIn(); } - // TODO: Game loop doesn't seem to have any delay. For now, - // introduce a slight delay here - _vm->_events->delay(50); - // Handle any events _vm->_events->pollEvents(); |