From 13aba8747a8293388640211233375cc4e7ecaf95 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 15 Jun 2010 10:09:42 +0000 Subject: Throttle screen updates to 60fps in some screen transition effects as well svn-id: r49690 --- engines/sci/event.cpp | 4 +--- engines/sci/graphics/paint16.cpp | 14 ++++++++++++-- engines/sci/graphics/transitions.cpp | 16 ++++++++++++---- 3 files changed, 25 insertions(+), 9 deletions(-) (limited to 'engines') diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp index ed9c4bfd0d..7a55555a70 100644 --- a/engines/sci/event.cpp +++ b/engines/sci/event.cpp @@ -321,9 +321,7 @@ sciEvent EventManager::get(unsigned int mask) { // Update the screen here, since it's called very often. // Throttle the screen update rate to 60fps. - uint32 curTime = g_system->getMillis(); - uint32 duration = curTime - g_sci->getEngineState()->_screenUpdateTime; - if (duration >= 1000 / 60) { + if (g_system->getMillis() - g_sci->getEngineState()->_screenUpdateTime >= 1000 / 60) { g_system->updateScreen(); g_sci->getEngineState()->_screenUpdateTime = g_system->getMillis(); } diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp index ff4f3bec52..6a13f792cb 100644 --- a/engines/sci/graphics/paint16.cpp +++ b/engines/sci/graphics/paint16.cpp @@ -561,11 +561,21 @@ void GfxPaint16::kernelShakeScreen(uint16 shakeCount, uint16 directions) { if (directions & SCI_SHAKE_DIRECTION_VERTICAL) _screen->setVerticalShakePos(10); // TODO: horizontal shakes - g_system->updateScreen(); + + if (g_system->getMillis() - g_sci->getEngineState()->_screenUpdateTime >= 1000 / 60) { + g_system->updateScreen(); + g_sci->getEngineState()->_screenUpdateTime = g_system->getMillis(); + } + _gui->wait(3); if (directions & SCI_SHAKE_DIRECTION_VERTICAL) _screen->setVerticalShakePos(0); - g_system->updateScreen(); + + if (g_system->getMillis() - g_sci->getEngineState()->_screenUpdateTime >= 1000 / 60) { + g_system->updateScreen(); + g_sci->getEngineState()->_screenUpdateTime = g_system->getMillis(); + } + _gui->wait(3); } } diff --git a/engines/sci/graphics/transitions.cpp b/engines/sci/graphics/transitions.cpp index 1976326aa9..f73525caaf 100644 --- a/engines/sci/graphics/transitions.cpp +++ b/engines/sci/graphics/transitions.cpp @@ -440,8 +440,12 @@ void GfxTransitions::scroll(int16 number) { } stepNr++; } - if ((stepNr & 1) == 0) - g_system->updateScreen(); + if ((stepNr & 1) == 0) { + if (g_system->getMillis() - g_sci->getEngineState()->_screenUpdateTime >= 1000 / 60) { + g_system->updateScreen(); + g_sci->getEngineState()->_screenUpdateTime = g_system->getMillis(); + } + } break; case SCI_TRANSITIONS_SCROLL_RIGHT: @@ -461,8 +465,12 @@ void GfxTransitions::scroll(int16 number) { } stepNr++; } - if ((stepNr & 1) == 0) - g_system->updateScreen(); + if ((stepNr & 1) == 0) { + if (g_system->getMillis() - g_sci->getEngineState()->_screenUpdateTime >= 1000 / 60) { + g_system->updateScreen(); + g_sci->getEngineState()->_screenUpdateTime = g_system->getMillis(); + } + } break; case SCI_TRANSITIONS_SCROLL_UP: -- cgit v1.2.3