Added _quitFlag test to Kyra 2 animation and to waitForEvent().

svn-id: r23617
This commit is contained in:
Torbjörn Andersson 2006-07-29 05:59:44 +00:00
parent f8d4994dc2
commit f51fc44e66
2 changed files with 6 additions and 6 deletions

View File

@ -652,7 +652,7 @@ void KyraEngine::delay(uint32 amount, bool update, bool isMainLoop) {
void KyraEngine::waitForEvent() { void KyraEngine::waitForEvent() {
bool finished = false; bool finished = false;
OSystem::Event event; OSystem::Event event;
while (!finished) { while (!finished && !_quitFlag) {
while (_system->pollEvent(event)) { while (_system->pollEvent(event)) {
switch (event.type) { switch (event.type) {
case OSystem::EVENT_KEYDOWN: case OSystem::EVENT_KEYDOWN:

View File

@ -36,17 +36,17 @@ KyraEngine_v2::KyraEngine_v2(OSystem *system)
KyraEngine_v2::~KyraEngine_v2() { KyraEngine_v2::~KyraEngine_v2() {
} }
int KyraEngine_v2::go() { int KyraEngine_v2::go() {
uint8 pal[768]; uint8 pal[768];
WSAMovieV2 *title = new WSAMovieV2(this); WSAMovieV2 *title = new WSAMovieV2(this);
title->open("title.WSA", 0, pal); title->open("title.WSA", 0, pal);
assert(title->opened()); assert(title->opened());
_screen->setScreenPalette(pal); _screen->setScreenPalette(pal);
title->setX(0); title->setY(0); title->setX(0); title->setY(0);
title->setDrawPage(0); title->setDrawPage(0);
for (int i = 0; i < 26; ++i) { for (int i = 0; i < 26 && !_quitFlag; ++i) {
uint32 nextRun = _system->getMillis() + 6 * _tickLength; uint32 nextRun = _system->getMillis() + 6 * _tickLength;
title->displayFrame(i); title->displayFrame(i);
_screen->updateScreen(); _screen->updateScreen();
@ -54,7 +54,7 @@ int KyraEngine_v2::go() {
} }
delete title; delete title;
waitForEvent(); waitForEvent();
return 0; return 0;
} }