diff options
author | Einar Johan Trøan Sømåen | 2012-06-28 02:08:33 +0200 |
---|---|---|
committer | Einar Johan Trøan Sømåen | 2012-06-28 02:08:33 +0200 |
commit | 7d45960039326eed4e02f2fae502c79a5538ea0e (patch) | |
tree | 8bea64ee5a25b8e996ac09fcd0b2f3855f1a8134 | |
parent | e49b43f7a9bbbe7bda7c4107b0279bf2add1aaaa (diff) | |
download | scummvm-rg350-7d45960039326eed4e02f2fae502c79a5538ea0e.tar.gz scummvm-rg350-7d45960039326eed4e02f2fae502c79a5538ea0e.tar.bz2 scummvm-rg350-7d45960039326eed4e02f2fae502c79a5538ea0e.zip |
WINTERMUTE: Cap framerate at 25 fps for now.
-rw-r--r-- | engines/wintermute/wintermute.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp index 7b987867c3..c57be85cf1 100644 --- a/engines/wintermute/wintermute.cpp +++ b/engines/wintermute/wintermute.cpp @@ -263,7 +263,13 @@ int WinterMuteEngine::init() { int WinterMuteEngine::messageLoop() { bool done = false; - + + uint32 prevTime = _system->getMillis(); + uint32 time = _system->getMillis(); + uint32 diff = 0; + + const uint32 maxFPS = 25; + const uint32 frameTime = (1.0/maxFPS) * 1000; while (!done) { Common::Event event; while (_system->getEventManager()->pollEvent(event)) { @@ -271,18 +277,22 @@ int WinterMuteEngine::messageLoop() { } if (_game && _game->_renderer->_active && _game->_renderer->_ready) { - _game->DisplayContent(); _game->DisplayQuickMsg(); - + _game->DisplayDebugInfo(); - + + time = _system->getMillis(); + diff = time - prevTime; + if (frameTime > diff) // Avoid overflows + _system->delayMillis(frameTime - diff); + // ***** flip if (!_game->_suspendedRendering) _game->_renderer->flip(); if (_game->_loading) _game->LoadGame(_game->_scheduledLoadSlot); + prevTime = time; } if (_game->_quitting) break; - } if (_game) { |