aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2015-12-16 00:07:31 +0100
committerWillem Jan Palenstijn2015-12-23 21:34:06 +0100
commiteab6682929d47d09c0ac81921f479e46a06e93bd (patch)
tree797c8d86eb5612351d6537c87fa0a8d3022a6282 /engines
parent3f1bb66959dbe72444d7cd1bc36609bf1e3e2f77 (diff)
downloadscummvm-rg350-eab6682929d47d09c0ac81921f479e46a06e93bd.tar.gz
scummvm-rg350-eab6682929d47d09c0ac81921f479e46a06e93bd.tar.bz2
scummvm-rg350-eab6682929d47d09c0ac81921f479e46a06e93bd.zip
LAB: Add some checks to quit the game quickly when closing ScummVM
Diffstat (limited to 'engines')
-rw-r--r--engines/lab/engine.cpp30
-rw-r--r--engines/lab/intro.cpp6
-rw-r--r--engines/lab/map.cpp6
-rw-r--r--engines/lab/special.cpp14
4 files changed, 40 insertions, 16 deletions
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index 2b06a5db31..cce5aef751 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -188,7 +188,7 @@ void LabEngine::eatMessages() {
do {
msg = _event->getMsg();
- } while (msg);
+ } while (msg && !g_engine->shouldQuit());
}
/**
@@ -527,6 +527,10 @@ void LabEngine::mainGameLoop() {
_music->updateMusic();
interfaceOn();
IntuiMessage *curMsg = _event->getMsg();
+ if (g_engine->shouldQuit()) {
+ _quitLab = true;
+ return;
+ }
if (!curMsg) {
// Does music load and next animation frame when you've run out of messages
@@ -632,6 +636,9 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo
_anim->_doBlack = false;
+ if (g_engine->shouldQuit())
+ return false;
+
if ((msgClass == RAWKEY) && (!_graphics->_longWinInFront)) {
if (!processKey(curMsg, msgClass, qualifier, curPos, curInv, forceDraw, code))
return false;
@@ -856,21 +863,22 @@ bool LabEngine::processKey(IntuiMessage *curMsg, uint32 &msgClass, uint16 &quali
_music->updateMusic();
curMsg = _event->getMsg();
+ if (g_engine->shouldQuit())
+ return false;
+
if (!curMsg) {
// Does music load and next animation frame when you've run out of messages
_music->updateMusic();
_anim->diffNextFrame();
- } else {
- if (curMsg->_msgClass == RAWKEY) {
- codeLower = tolower(curMsg->_code);
- if (codeLower == 'y' || codeLower == 'q') {
- _anim->stopDiff();
- return false;
- } else if (curMsg->_code < 128)
- break;
- } else if (curMsg->_msgClass == MOUSEBUTTONS)
+ } else if (curMsg->_msgClass == RAWKEY) {
+ codeLower = tolower(curMsg->_code);
+ if (codeLower == 'y' || codeLower == 'q') {
+ _anim->stopDiff();
+ return false;
+ } else if (curMsg->_code < 128)
break;
- }
+ } else if (curMsg->_msgClass == MOUSEBUTTONS)
+ break;
}
forceDraw = true;
diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp
index 86007c0ec3..f49a860d3f 100644
--- a/engines/lab/intro.cpp
+++ b/engines/lab/intro.cpp
@@ -126,8 +126,12 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {
}
IntuiMessage *msg = _vm->_event->getMsg();
+ if (g_engine->shouldQuit()) {
+ _quitIntro = true;
+ return;
+ }
- if (msg == NULL) {
+ if (!msg) {
_vm->_music->updateMusic();
_vm->_anim->diffNextFrame();
diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp
index a248544938..927bfd037a 100644
--- a/engines/lab/map.cpp
+++ b/engines/lab/map.cpp
@@ -426,7 +426,7 @@ void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fad
* Processes the map.
*/
void LabEngine::processMap(uint16 curRoom) {
- uint32 place = 1;
+ byte place = 1;
uint16 curMsg = curRoom;
uint16 curFloor = _maps[curRoom]._pageNumber;
@@ -434,6 +434,10 @@ void LabEngine::processMap(uint16 curRoom) {
// Make sure we check the music at least after every message
_music->updateMusic();
IntuiMessage *msg = _event->getMsg();
+ if (g_engine->shouldQuit()) {
+ _quitLab = true;
+ return;
+ }
if (!msg) {
_music->updateMusic();
diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp
index 38921ea650..02bbdf4c07 100644
--- a/engines/lab/special.cpp
+++ b/engines/lab/special.cpp
@@ -260,10 +260,14 @@ void LabEngine::processJournal() {
// Make sure we check the music at least after every message
_music->updateMusic();
IntuiMessage *msg = _event->getMsg();
+ if (g_engine->shouldQuit()) {
+ _quitLab = true;
+ return;
+ }
- if (msg == NULL) {
+ if (!msg)
_music->updateMusic();
- } else {
+ else {
uint32 msgClass = msg->_msgClass;
uint16 qualifier = msg->_qualifier;
uint16 gadID = msg->_code;
@@ -420,8 +424,12 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isIntera
// Make sure we check the music at least after every message
_music->updateMusic();
IntuiMessage *msg = _event->getMsg();
+ if (g_engine->shouldQuit()) {
+ _quitLab = true;
+ return;
+ }
- if (msg == NULL) {
+ if (!msg) {
_music->updateMusic();
} else {
uint32 msgClass = msg->_msgClass;