[Scummvm-cvs-logs] SF.net SVN: scummvm:[39392] scummvm/trunk/engines/made
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Sat Mar 14 15:58:19 CET 2009
Revision: 39392
http://scummvm.svn.sourceforge.net/scummvm/?rev=39392&view=rev
Author: thebluegr
Date: 2009-03-14 14:58:19 +0000 (Sat, 14 Mar 2009)
Log Message:
-----------
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
Modified Paths:
--------------
scummvm/trunk/engines/made/screen.cpp
scummvm/trunk/engines/made/script.cpp
scummvm/trunk/engines/made/scriptfuncs.cpp
Modified: scummvm/trunk/engines/made/screen.cpp
===================================================================
--- scummvm/trunk/engines/made/screen.cpp 2009-03-14 13:48:12 UTC (rev 39391)
+++ scummvm/trunk/engines/made/screen.cpp 2009-03-14 14:58:19 UTC (rev 39392)
@@ -358,9 +358,7 @@
drawSpriteChannels(_workScreenDrawCtx, 1, 2);
_vm->_system->copyRectToScreen((const byte*)_workScreen->pixels, _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h);
-
- _vm->_system->updateScreen();
-
+ _vm->_screen->updateScreenAndWait(10);
}
void Screen::clearChannels() {
@@ -626,14 +624,13 @@
_fx->run(_visualEffectNum, _workScreen, _palette, _newPalette, _paletteColorCount);
_visualEffectNum = 0;
- _vm->_system->updateScreen();
-
if (!_paletteInitialized) {
memcpy(_newPalette, _palette, _paletteColorCount * 3);
_oldPaletteColorCount = _paletteColorCount;
_paletteInitialized = true;
}
+ updateScreenAndWait(10);
}
void Screen::flash(int flashCount) {
Modified: scummvm/trunk/engines/made/script.cpp
===================================================================
--- scummvm/trunk/engines/made/script.cpp 2009-03-14 13:48:12 UTC (rev 39391)
+++ scummvm/trunk/engines/made/script.cpp 2009-03-14 14:58:19 UTC (rev 39392)
@@ -144,9 +144,6 @@
_codeIp = _codeBase;
while (!_vm->shouldQuit()) {
-
- _vm->handleEvents();
-
byte opcode = readByte();
if (opcode >= 1 && opcode <= _commandsMax) {
@@ -159,11 +156,7 @@
/* 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;
}
Modified: scummvm/trunk/engines/made/scriptfuncs.cpp
===================================================================
--- scummvm/trunk/engines/made/scriptfuncs.cpp 2009-03-14 13:48:12 UTC (rev 39391)
+++ scummvm/trunk/engines/made/scriptfuncs.cpp 2009-03-14 14:58:19 UTC (rev 39392)
@@ -203,11 +203,12 @@
}
int16 ScriptFunctions::sfPollEvent(int16 argc, int16 *argv) {
+ _vm->handleEvents();
+ _vm->_screen->updateScreenAndWait(10);
- _vm->_system->updateScreen();
-
int16 eventNum = _vm->_eventNum;
_vm->_eventNum = 0;
+
return eventNum;
}
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