diff options
author | Arnaud Boutonné | 2011-01-01 10:13:42 +0000 |
---|---|---|
committer | Arnaud Boutonné | 2011-01-01 10:13:42 +0000 |
commit | 473ddccf507989af006ddd9f99bbe6f310211ee6 (patch) | |
tree | 8b86f69924f38651b1d43dd6ee0696439b74edaf /engines/hugo | |
parent | 6a299ce0b8b74897a08a522add1852b9b482ed67 (diff) | |
download | scummvm-rg350-473ddccf507989af006ddd9f99bbe6f310211ee6.tar.gz scummvm-rg350-473ddccf507989af006ddd9f99bbe6f310211ee6.tar.bz2 scummvm-rg350-473ddccf507989af006ddd9f99bbe6f310211ee6.zip |
HUGO: Reduce CPU usage by adding a delay in the main loop
svn-id: r55083
Diffstat (limited to 'engines/hugo')
-rw-r--r-- | engines/hugo/hugo.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp index 1702c3752a..0e9e4d0ca1 100644 --- a/engines/hugo/hugo.cpp +++ b/engines/hugo/hugo.cpp @@ -330,6 +330,7 @@ void HugoEngine::initMachine() { */ void HugoEngine::runMachine() { static uint32 lastTime; + uint32 curTime; status_t &gameStatus = getGameStatus(); // Don't process if we're in a textbox @@ -340,10 +341,13 @@ void HugoEngine::runMachine() { if (gameStatus.gameOverFl) return; + curTime = g_system->getMillis(); // Process machine once every tick - if (g_system->getMillis() - lastTime < (uint32)(1000 / getTPS())) - return; - lastTime = g_system->getMillis(); + while (curTime - lastTime < (uint32)(1000 / getTPS())) { + g_system->delayMillis(5); + curTime = g_system->getMillis(); + } + lastTime = curTime; switch (gameStatus.viewState) { case V_IDLE: // Not processing state machine |