aboutsummaryrefslogtreecommitdiff
path: root/engines/gob
diff options
context:
space:
mode:
Diffstat (limited to 'engines/gob')
-rw-r--r--engines/gob/game_v1.cpp5
-rw-r--r--engines/gob/game_v2.cpp11
-rw-r--r--engines/gob/gob.cpp4
-rw-r--r--engines/gob/inter.cpp5
-rw-r--r--engines/gob/inter_bargon.cpp7
-rw-r--r--engines/gob/inter_v1.cpp5
-rw-r--r--engines/gob/inter_v2.cpp4
-rw-r--r--engines/gob/mult.cpp3
-rw-r--r--engines/gob/palanim.cpp4
-rw-r--r--engines/gob/util.cpp5
-rw-r--r--engines/gob/videoplayer.cpp4
11 files changed, 33 insertions, 24 deletions
diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp
index 16865eb7a2..4bfcd0fcad 100644
--- a/engines/gob/game_v1.cpp
+++ b/engines/gob/game_v1.cpp
@@ -24,6 +24,7 @@
*/
#include "common/endian.h"
+#include "common/events.h"
#include "common/stream.h"
#include "gob/gob.h"
@@ -63,7 +64,7 @@ void Game_v1::playTot(int16 skipPlay) {
strcpy(savedTotName, _curTotFile);
if (skipPlay <= 0) {
- while (!_vm->_quit) {
+ while (!g_system->getEventManager()->shouldQuit()) {
for (int i = 0; i < 4; i++) {
_vm->_draw->_fontToSprite[i].sprite = -1;
_vm->_draw->_fontToSprite[i].base = -1;
@@ -997,7 +998,7 @@ void Game_v1::collisionsBlock(void) {
WRITE_VAR(16, 0);
_activeCollResId = 0;
}
- while ((_activeCollResId == 0) && !_vm->_inter->_terminate && !_vm->_quit);
+ while ((_activeCollResId == 0) && !_vm->_inter->_terminate && !g_system->getEventManager()->shouldQuit());
if (((uint16) _activeCollResId & ~0x8000) == collResId) {
collStackPos = 0;
diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp
index e794bda17c..cf7beec031 100644
--- a/engines/gob/game_v2.cpp
+++ b/engines/gob/game_v2.cpp
@@ -24,6 +24,7 @@
*/
#include "common/endian.h"
+#include "common/events.h"
#include "common/stream.h"
#include "gob/gob.h"
@@ -70,7 +71,7 @@ void Game_v2::playTot(int16 skipPlay) {
strcpy(savedTotName, _curTotFile);
if (skipPlay <= 0) {
- while (!_vm->_quit) {
+ while (!g_system->getEventManager()->shouldQuit()) {
if (_vm->_inter->_variables)
_vm->_draw->animateCursor(4);
@@ -438,7 +439,7 @@ int16 Game_v2::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId,
timeKey = _vm->_util->getTimeKey();
while (1) {
- if (_vm->_inter->_terminate || _vm->_quit) {
+ if (_vm->_inter->_terminate || g_system->getEventManager()->shouldQuit()) {
if (handleMouse)
_vm->_draw->blitCursor();
return 0;
@@ -1043,7 +1044,7 @@ void Game_v2::collisionsBlock(void) {
WRITE_VAR(16, 0);
_activeCollResId = 0;
}
- while ((_activeCollResId == 0) && !_vm->_inter->_terminate && !_vm->_quit);
+ while ((_activeCollResId == 0) && !_vm->_inter->_terminate && !g_system->getEventManager()->shouldQuit());
if ((_activeCollResId & 0xFFF) == collResId) {
collStackPos = 0;
@@ -1465,7 +1466,7 @@ int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height,
key = checkCollisions(handleMouse, -300, collResId, collIndex);
if ((key != 0) || (*collResId != 0) ||
- _vm->_inter->_terminate || _vm->_quit)
+ _vm->_inter->_terminate || g_system->getEventManager()->shouldQuit())
break;
if (*pTotTime > 0) {
@@ -1479,7 +1480,7 @@ int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height,
}
if ((key == 0) || (*collResId != 0) ||
- _vm->_inter->_terminate || _vm->_quit)
+ _vm->_inter->_terminate || g_system->getEventManager()->shouldQuit())
return 0;
switch (key) {
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp
index b43539e8f2..61d173346e 100644
--- a/engines/gob/gob.cpp
+++ b/engines/gob/gob.cpp
@@ -111,11 +111,11 @@ GobEngine::~GobEngine() {
int GobEngine::go() {
_init->initGame(0);
- return _rtl;
+ return _eventMan->shouldRTL();
}
void GobEngine::shutdown() {
- _quit = true;
+ g_system->getEventManager()->pushEvent(Common::EVENT_QUIT);
}
const char *GobEngine::getLangDesc(int16 language) const {
diff --git a/engines/gob/inter.cpp b/engines/gob/inter.cpp
index d5daed2d97..0c226193f9 100644
--- a/engines/gob/inter.cpp
+++ b/engines/gob/inter.cpp
@@ -26,6 +26,7 @@
#include <time.h> // FIXME: for Inter::renewTimeInVars()
#include "common/endian.h"
+#include "common/events.h"
#include "gob/gob.h"
#include "gob/inter.h"
@@ -249,7 +250,7 @@ void Inter::funcBlock(int16 retFlag) {
if (executeFuncOpcode(cmd2, cmd, params))
return;
- if (_vm->_quit)
+ if (g_system->getEventManager()->shouldQuit())
break;
if (_break) {
@@ -269,7 +270,7 @@ void Inter::funcBlock(int16 retFlag) {
void Inter::callSub(int16 retFlag) {
byte block;
- while (!_vm->_quit && _vm->_global->_inter_execPtr &&
+ while (!g_system->getEventManager()->shouldQuit() && _vm->_global->_inter_execPtr &&
(_vm->_global->_inter_execPtr != _vm->_game->_totFileData)) {
block = *_vm->_global->_inter_execPtr;
diff --git a/engines/gob/inter_bargon.cpp b/engines/gob/inter_bargon.cpp
index c2bc4ca01d..b0378f1bdb 100644
--- a/engines/gob/inter_bargon.cpp
+++ b/engines/gob/inter_bargon.cpp
@@ -24,6 +24,7 @@
*/
#include "common/endian.h"
+#include "common/events.h"
#include "gob/gob.h"
#include "gob/inter.h"
@@ -750,7 +751,7 @@ void Inter_Bargon::oBargon_intro2(OpGobParams &params) {
for (i = 320; i >= 0; i--) {
_vm->_util->setScrollOffset(i, 0);
if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == 0x11B) ||
- _vm->_quit) {
+ g_system->getEventManager()->shouldQuit()) {
_vm->_palAnim->fade(0, -2, 0);
_vm->_video->clearSurf(_vm->_draw->_frontSurface);
memset((char *) _vm->_draw->_vgaPalette, 0, 768);
@@ -760,7 +761,7 @@ void Inter_Bargon::oBargon_intro2(OpGobParams &params) {
break;
}
}
- if (!_vm->_quit)
+ if (!g_system->getEventManager()->shouldQuit())
_vm->_util->setScrollOffset(0, 0);
surface = 0;
if (VAR(57) == ((uint32) -1))
@@ -799,7 +800,7 @@ void Inter_Bargon::oBargon_intro3(OpGobParams &params) {
_vm->_util->longDelay(_vm->_util->getRandom(200));
}
if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == 0x11B) ||
- _vm->_quit) {
+ g_system->getEventManager()->shouldQuit()) {
_vm->_sound->blasterStop(10);
_vm->_palAnim->fade(0, -2, 0);
_vm->_video->clearSurf(_vm->_draw->_frontSurface);
diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp
index ab63bd0e1b..8553354f87 100644
--- a/engines/gob/inter_v1.cpp
+++ b/engines/gob/inter_v1.cpp
@@ -24,6 +24,7 @@
*/
#include "common/endian.h"
+#include "common/events.h"
#include "common/file.h"
#include "gob/gob.h"
@@ -1225,7 +1226,7 @@ bool Inter_v1::o1_repeatUntil(OpFuncParams &params) {
funcBlock(1);
_vm->_global->_inter_execPtr = blockPtr + size + 1;
flag = evalBoolResult();
- } while (!flag && !_break && !_terminate && !_vm->_quit);
+ } while (!flag && !_break && !_terminate && !g_system->getEventManager()->shouldQuit());
_nestLevel[0]--;
@@ -1260,7 +1261,7 @@ bool Inter_v1::o1_whileDo(OpFuncParams &params) {
} else
_vm->_global->_inter_execPtr += size;
- if (_break || _terminate || _vm->_quit) {
+ if (_break || _terminate || g_system->getEventManager()->shouldQuit()) {
_vm->_global->_inter_execPtr = blockPtr;
_vm->_global->_inter_execPtr += size;
break;
diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp
index cf74252e09..2d39fc0a65 100644
--- a/engines/gob/inter_v2.cpp
+++ b/engines/gob/inter_v2.cpp
@@ -24,6 +24,8 @@
*/
#include "common/endian.h"
+#include "common/events.h"
+
#include "sound/mixer.h"
#include "sound/mods/infogrames.h"
@@ -1483,7 +1485,7 @@ void Inter_v2::o2_scroll() {
curX = startX;
curY = startY;
- while (!_vm->_quit && ((curX != endX) || (curY != endY))) {
+ while (!g_system->getEventManager()->shouldQuit() && ((curX != endX) || (curY != endY))) {
curX = stepX > 0 ? MIN(curX + stepX, (int) endX) :
MAX(curX + stepX, (int) endX);
curY = stepY > 0 ? MIN(curY + stepY, (int) endY) :
diff --git a/engines/gob/mult.cpp b/engines/gob/mult.cpp
index c4d45ee4bd..2916e246a0 100644
--- a/engines/gob/mult.cpp
+++ b/engines/gob/mult.cpp
@@ -24,6 +24,7 @@
*/
#include "common/endian.h"
+#include "common/events.h"
#include "gob/gob.h"
#include "gob/mult.h"
@@ -197,7 +198,7 @@ void Mult::playMult(int16 startFrame, int16 endFrame, char checkEscape,
_frame++;
_vm->_util->waitEndFrame();
- } while (!stop && !stopNoClear && !_vm->_quit);
+ } while (!stop && !stopNoClear && !g_system->getEventManager()->shouldQuit());
if (!stopNoClear) {
if (_animDataAllocated) {
diff --git a/engines/gob/palanim.cpp b/engines/gob/palanim.cpp
index 2b1b34872a..25c5fb43b7 100644
--- a/engines/gob/palanim.cpp
+++ b/engines/gob/palanim.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/events.h"
+
#include "gob/gob.h"
#include "gob/palanim.h"
#include "gob/global.h"
@@ -131,7 +133,7 @@ void PalAnim::fade(Video::PalDesc *palDesc, int16 fadeV, int16 allColors) {
bool stop;
int16 i;
- if (_vm->_quit)
+ if (g_system->getEventManager()->shouldQuit())
return;
_fadeValue = (fadeV < 0) ? -fadeV : 2;
diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp
index d25628fe81..c38f2e9a77 100644
--- a/engines/gob/util.cpp
+++ b/engines/gob/util.cpp
@@ -72,7 +72,7 @@ void Util::longDelay(uint16 msecs) {
_vm->_video->waitRetrace();
processInput();
delay(15);
- } while (!_vm->_quit &&
+ } while (!g_system->getEventManager()->shouldQuit() &&
((g_system->getMillis() * _vm->_global->_speedFactor) < time));
}
@@ -118,9 +118,6 @@ void Util::processInput(bool scroll) {
break;
case Common::EVENT_KEYUP:
break;
- case Common::EVENT_QUIT:
- _vm->_quit = true;
- break;
default:
break;
}
diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp
index 1b1c061524..84524b3210 100644
--- a/engines/gob/videoplayer.cpp
+++ b/engines/gob/videoplayer.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/events.h"
+
#include "gob/videoplayer.h"
#include "gob/global.h"
#include "gob/util.h"
@@ -568,7 +570,7 @@ bool VideoPlayer::doPlay(int16 frame, int16 breakKey,
_vm->_util->processInput();
- if (_vm->_quit) {
+ if (g_system->getEventManager()->shouldQuit()) {
_primaryVideo->getVideo()->disableSound();
return true;
}