[Scummvm-cvs-logs] SF.net SVN: scummvm:[55786] scummvm/trunk/engines/toon
sylvaintv at users.sourceforge.net
sylvaintv at users.sourceforge.net
Sat Feb 5 13:11:58 CET 2011
Revision: 55786
http://scummvm.svn.sourceforge.net/scummvm/?rev=55786&view=rev
Author: sylvaintv
Date: 2011-02-05 12:11:57 +0000 (Sat, 05 Feb 2011)
Log Message:
-----------
TOON: Add some sleep if the game refreshes too fast
Prevents the game from using 100% CPU?
Modified Paths:
--------------
scummvm/trunk/engines/toon/toon.cpp
scummvm/trunk/engines/toon/toon.h
Modified: scummvm/trunk/engines/toon/toon.cpp
===================================================================
--- scummvm/trunk/engines/toon/toon.cpp 2011-02-05 10:34:37 UTC (rev 55785)
+++ scummvm/trunk/engines/toon/toon.cpp 2011-02-05 12:11:57 UTC (rev 55786)
@@ -160,6 +160,7 @@
_lastMouseButton = 0;
_mouseButton = 0;
+ _lastRenderTime = _system->getMillis();
}
void ToonEngine::waitForScriptStep() {
@@ -417,6 +418,15 @@
} else {
copyToVirtualScreen(true);
}
+
+ // add a little sleep here if needed.
+ int32 newMillis = (int32)_system->getMillis();
+ if(newMillis - _lastRenderTime < _tickLength) {
+ int32 sleepMs = _tickLength - ( _system->getMillis() - _lastRenderTime );
+ assert(sleepMs >= 0);
+ _system->delayMillis(sleepMs);
+ }
+ _lastRenderTime = _system->getMillis();
}
void ToonEngine::doMagnifierEffect() {
Modified: scummvm/trunk/engines/toon/toon.h
===================================================================
--- scummvm/trunk/engines/toon/toon.h 2011-02-05 10:34:37 UTC (rev 55785)
+++ scummvm/trunk/engines/toon/toon.h 2011-02-05 12:11:57 UTC (rev 55786)
@@ -407,6 +407,7 @@
int32 _oldTimer;
int32 _oldTimer2;
+ int32 _lastRenderTime;
Movie *_moviePlayer;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list