[Scummvm-cvs-logs] SF.net SVN: scummvm:[45509] scummvm/trunk/engines/sci/gui
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Thu Oct 29 22:07:24 CET 2009
Revision: 45509
http://scummvm.svn.sourceforge.net/scummvm/?rev=45509&view=rev
Author: thebluegr
Date: 2009-10-29 21:07:24 +0000 (Thu, 29 Oct 2009)
Log Message:
-----------
Poll for events while performing screen transitions, so that ScummVM remains responsive
Modified Paths:
--------------
scummvm/trunk/engines/sci/gui/gui_transitions.cpp
scummvm/trunk/engines/sci/gui/gui_transitions.h
Modified: scummvm/trunk/engines/sci/gui/gui_transitions.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_transitions.cpp 2009-10-29 20:32:55 UTC (rev 45508)
+++ scummvm/trunk/engines/sci/gui/gui_transitions.cpp 2009-10-29 21:07:24 UTC (rev 45509)
@@ -23,6 +23,7 @@
*
*/
+#include "common/events.h"
#include "common/util.h"
#include "common/stack.h"
#include "graphics/surface.h"
@@ -120,6 +121,13 @@
}
}
+void SciGuiTransitions::updateScreenAndWait(int msec) {
+ Common::Event ev;
+ g_system->updateScreen();
+ g_system->delayMillis(msec);
+ while (g_system->getEventManager()->pollEvent(ev)) {} // discard all events
+}
+
// will translate a number and return corresponding translationEntry
const GuiTransitionTranslateEntry *SciGuiTransitions::translateNumber (int16 number, const GuiTransitionTranslateEntry *tablePtr) {
while (1) {
@@ -303,8 +311,7 @@
pixelRect.top = mask / 320; pixelRect.bottom = pixelRect.top + 1;
copyRectToScreen(pixelRect, blackoutFlag);
if ((stepNr & 0x3FF) == 0) {
- g_system->updateScreen();
- g_system->delayMillis(5);
+ updateScreenAndWait(5);
}
stepNr++;
} while (mask != 0x40);
@@ -324,8 +331,7 @@
blockRect.top = (mask / 40) << 3; blockRect.bottom = blockRect.top + 8;
copyRectToScreen(blockRect, blackoutFlag);
if ((stepNr & 7) == 0) {
- g_system->updateScreen();
- g_system->delayMillis(4);
+ updateScreenAndWait(4);
}
stepNr++;
} while (mask != 0x40);
@@ -342,8 +348,7 @@
while (newScreenRect.left >= _picRect.left) {
copyRectToScreen(newScreenRect, blackoutFlag);
if ((stepNr & 1) == 0) {
- g_system->updateScreen();
- g_system->delayMillis(1);
+ updateScreenAndWait(1);
}
stepNr++;
newScreenRect.translate(-1, 0);
@@ -355,8 +360,7 @@
while (newScreenRect.right <= _picRect.right) {
copyRectToScreen(newScreenRect, blackoutFlag);
if ((stepNr & 1) == 0) {
- g_system->updateScreen();
- g_system->delayMillis(1);
+ updateScreenAndWait(1);
}
stepNr++;
newScreenRect.translate(1, 0);
@@ -367,8 +371,7 @@
newScreenRect.top = newScreenRect.bottom - 1;
while (newScreenRect.top >= _picRect.top) {
copyRectToScreen(newScreenRect, blackoutFlag);
- g_system->updateScreen();
- g_system->delayMillis(3);
+ updateScreenAndWait(3);
stepNr++;
newScreenRect.translate(0, -1);
}
@@ -378,8 +381,7 @@
newScreenRect.bottom = newScreenRect.top + 1;
while (newScreenRect.bottom <= _picRect.bottom) {
copyRectToScreen(newScreenRect, blackoutFlag);
- g_system->updateScreen();
- g_system->delayMillis(3);
+ updateScreenAndWait(3);
stepNr++;
newScreenRect.translate(0, 1);
}
@@ -412,8 +414,7 @@
newScreenRect.right++; newMoveRect.left--;
_screen->copyRectToScreen(newScreenRect, newMoveRect.left, newMoveRect.top);
if ((stepNr & 1) == 0) {
- g_system->updateScreen();
- g_system->delayMillis(1);
+ updateScreenAndWait(1);
}
stepNr++;
}
@@ -430,8 +431,7 @@
newScreenRect.left--;
_screen->copyRectToScreen(newScreenRect, newMoveRect.left, newMoveRect.top);
if ((stepNr & 1) == 0) {
- g_system->updateScreen();
- g_system->delayMillis(1);
+ updateScreenAndWait(1);
}
stepNr++;
}
@@ -448,8 +448,7 @@
g_system->copyRectToScreen(oldScreenPtr, screenWidth, _picRect.left, _picRect.top, oldMoveRect.width(), oldMoveRect.height());
newScreenRect.bottom++; newMoveRect.top--;
_screen->copyRectToScreen(newScreenRect, newMoveRect.left, newMoveRect.top);
- g_system->updateScreen();
- g_system->delayMillis(3);
+ updateScreenAndWait(3);
}
break;
@@ -461,8 +460,7 @@
g_system->copyRectToScreen(oldScreenPtr, screenWidth, oldMoveRect.left, oldMoveRect.top, oldMoveRect.width(), oldMoveRect.height());
newScreenRect.top--;
_screen->copyRectToScreen(newScreenRect, _picRect.left, _picRect.top);
- g_system->updateScreen();
- g_system->delayMillis(3);
+ updateScreenAndWait(3);
}
break;
}
@@ -480,8 +478,7 @@
rightRect.translate(-1, 0);
copyRectToScreen(leftRect, blackoutFlag); leftRect.translate(-1, 0);
copyRectToScreen(rightRect, blackoutFlag); rightRect.translate(1, 0);
- g_system->updateScreen();
- g_system->delayMillis(2);
+ updateScreenAndWait(2);
}
}
@@ -493,8 +490,7 @@
while (leftRect.left < rightRect.right) {
copyRectToScreen(leftRect, blackoutFlag); leftRect.translate(1, 0);
copyRectToScreen(rightRect, blackoutFlag); rightRect.translate(-1, 0);
- g_system->updateScreen();
- g_system->delayMillis(2);
+ updateScreenAndWait(2);
}
}
@@ -510,8 +506,7 @@
lowerRect.translate(0, -1);
copyRectToScreen(upperRect, blackoutFlag); upperRect.translate(0, -1);
copyRectToScreen(lowerRect, blackoutFlag); lowerRect.translate(0, 1);
- g_system->updateScreen();
- g_system->delayMillis(3);
+ updateScreenAndWait(3);
}
}
@@ -523,8 +518,7 @@
while (upperRect.top < lowerRect.bottom) {
copyRectToScreen(upperRect, blackoutFlag); upperRect.translate(0, 1);
copyRectToScreen(lowerRect, blackoutFlag); lowerRect.translate(0, -1);
- g_system->updateScreen();
- g_system->delayMillis(3);
+ updateScreenAndWait(3);
}
}
@@ -554,8 +548,7 @@
copyRectToScreen(lowerRect, blackoutFlag); lowerRect.translate(0, 1); lowerRect.left--; lowerRect.right++;
copyRectToScreen(leftRect, blackoutFlag); leftRect.translate(-1, 0); leftRect.top--; leftRect.bottom++;
copyRectToScreen(rightRect, blackoutFlag); rightRect.translate(1, 0); rightRect.top--; rightRect.bottom++;
- g_system->updateScreen();
- g_system->delayMillis(3);
+ updateScreenAndWait(3);
}
}
@@ -572,8 +565,7 @@
copyRectToScreen(lowerRect, blackoutFlag); lowerRect.translate(0, -1); lowerRect.left++; lowerRect.right--;
copyRectToScreen(leftRect, blackoutFlag); leftRect.translate(1, 0);
copyRectToScreen(rightRect, blackoutFlag); rightRect.translate(-1, 0);
- g_system->updateScreen();
- g_system->delayMillis(3);
+ updateScreenAndWait(3);
}
}
Modified: scummvm/trunk/engines/sci/gui/gui_transitions.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_transitions.h 2009-10-29 20:32:55 UTC (rev 45508)
+++ scummvm/trunk/engines/sci/gui/gui_transitions.h 2009-10-29 21:07:24 UTC (rev 45509)
@@ -87,6 +87,7 @@
void horizontalRollToCenter(bool blackoutFlag);
void diagonalRollFromCenter(bool blackoutFlag);
void diagonalRollToCenter(bool blackoutFlag);
+ void updateScreenAndWait(int msec);
SciGui *_gui;
SciGuiScreen *_screen;
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