aboutsummaryrefslogtreecommitdiff
path: root/engines/made/script.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2009-03-14 14:58:19 +0000
committerFilippos Karapetis2009-03-14 14:58:19 +0000
commit498a355a74822974733ade011875e3446f655e96 (patch)
tree560d5049e688aab9709c6d80dc8d76220f92ef17 /engines/made/script.cpp
parent092f2a37e3e8ef1283ee04281727ed113061ff27 (diff)
downloadscummvm-rg350-498a355a74822974733ade011875e3446f655e96.tar.gz
scummvm-rg350-498a355a74822974733ade011875e3446f655e96.tar.bz2
scummvm-rg350-498a355a74822974733ade011875e3446f655e96.zip
Reduced CPU usage of the MADE engine by about 10% (by profiling the code)
- Added delays in places where the screen gets updated - Moved event polling inside sfPollEvent() (cause that's where events are polled), instead of after each opcode svn-id: r39392
Diffstat (limited to 'engines/made/script.cpp')
-rw-r--r--engines/made/script.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/engines/made/script.cpp b/engines/made/script.cpp
index 79f93f3b23..4c3bff77c3 100644
--- a/engines/made/script.cpp
+++ b/engines/made/script.cpp
@@ -144,9 +144,6 @@ void ScriptInterpreter::runScript(int16 scriptObjectIndex) {
_codeIp = _codeBase;
while (!_vm->shouldQuit()) {
-
- _vm->handleEvents();
-
byte opcode = readByte();
if (opcode >= 1 && opcode <= _commandsMax) {
@@ -159,11 +156,7 @@ void ScriptInterpreter::runScript(int16 scriptObjectIndex) {
/* We sleep a little after 500 opcodes to reduce the CPU load.
*/
if (++opcodeSleepCounter > 500) {
- uint32 startTime = _vm->_system->getMillis();
- while (_vm->_system->getMillis() < startTime + 5) {
- _vm->handleEvents();
- _vm->_system->delayMillis(5);
- }
+ _vm->_screen->updateScreenAndWait(5);
opcodeSleepCounter = 0;
}