[Scummvm-cvs-logs] scummvm master -> 9f5f240e904374a47f85c08899955376f18474f6
eriktorbjorn
eriktorbjorn at telia.com
Sun Nov 20 23:46:00 CET 2011
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
9f5f240e90 TOLTECS: Change the updateScreen() logic a bit
Commit: 9f5f240e904374a47f85c08899955376f18474f6
https://github.com/scummvm/scummvm/commit/9f5f240e904374a47f85c08899955376f18474f6
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2011-11-20T14:45:29-08:00
Commit Message:
TOLTECS: Change the updateScreen() logic a bit
Updating the screen when getMillis() % 10 is 0 seems sub-optimal
to me. It could be true several iterations in a row (shouldn't be
harmful, since updateScreen is assumed to be cheap if the screen
hasn't changed) or we could miss it every single time. Let's
measure the time between updates instead, just to be safer.
Changed paths:
engines/toltecs/script.cpp
diff --git a/engines/toltecs/script.cpp b/engines/toltecs/script.cpp
index 708afb7..959db8b 100644
--- a/engines/toltecs/script.cpp
+++ b/engines/toltecs/script.cpp
@@ -183,6 +183,7 @@ void ScriptInterpreter::setMainScript(uint slotIndex) {
}
void ScriptInterpreter::runScript() {
+ uint32 lastScreenUpdate = 0;
while (!_vm->shouldQuit()) {
@@ -217,9 +218,13 @@ void ScriptInterpreter::runScript() {
byte opcode = readByte();
execOpcode(opcode);
- // Call updateScreen roughly every 10ms else the mouse cursor will be jerky
- if (_vm->_system->getMillis() % 10 == 0)
+ // Update the screen at semi-regular intervals, else the mouse
+ // cursor will be jerky.
+ uint32 now = _vm->_system->getMillis();
+ if (now < lastScreenUpdate || now - lastScreenUpdate > 10) {
_vm->_system->updateScreen();
+ lastScreenUpdate = _vm->_system->getMillis();
+ }
}
More information about the Scummvm-git-logs
mailing list