aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Page2008-07-16 04:22:56 +0000
committerChristopher Page2008-07-16 04:22:56 +0000
commit7f480ac571f978802a3ecd5cf6169d0271d1f561 (patch)
treedcd550f0c84bec20aa3cfe5ffc4604a51f174ef6
parent7ecd54a9da6b9a14b4f16c3e53f87475d43bc2da (diff)
downloadscummvm-rg350-7f480ac571f978802a3ecd5cf6169d0271d1f561.tar.gz
scummvm-rg350-7f480ac571f978802a3ecd5cf6169d0271d1f561.tar.bz2
scummvm-rg350-7f480ac571f978802a3ecd5cf6169d0271d1f561.zip
Quit and RTL code is more modular now. EVENT_RTL no longer sets _shouldQuit, shouldQuit is only set if there's an EVENT_QUIT. EVENT_RTL and EVENT_QUIT are completely separate from each other. Engine::quit() method now checks both _shouldQuit and _shouldRTL to determine if the engine should exit. There is no longer a need for resetQuit(), so it's removed
svn-id: r33082
-rw-r--r--backends/events/default/default-events.cpp4
-rw-r--r--backends/events/default/default-events.h1
-rw-r--r--base/main.cpp3
-rw-r--r--common/events.h6
-rw-r--r--engines/agi/preagi_common.cpp1
-rw-r--r--engines/agi/preagi_mickey.cpp3
-rw-r--r--engines/agi/preagi_troll.cpp2
-rw-r--r--engines/agi/preagi_winnie.cpp1
-rw-r--r--engines/agos/event.cpp1
-rw-r--r--engines/engine.h4
-rw-r--r--engines/kyra/sequences_lok.cpp1
-rw-r--r--engines/kyra/text_lok.cpp1
-rw-r--r--engines/kyra/vqa.cpp1
-rw-r--r--engines/lure/animseq.cpp2
-rw-r--r--engines/lure/events.cpp2
-rw-r--r--engines/parallaction/input.cpp2
-rw-r--r--engines/queen/input.cpp2
-rw-r--r--engines/queen/journal.cpp1
-rw-r--r--engines/saga/introproc_ihnm.cpp1
-rw-r--r--engines/sky/intro.cpp2
-rw-r--r--engines/sword2/animation.cpp1
-rw-r--r--engines/touche/menu.cpp2
22 files changed, 27 insertions, 17 deletions
diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp
index 8648c5909e..b070fb89ef 100644
--- a/backends/events/default/default-events.cpp
+++ b/backends/events/default/default-events.cpp
@@ -435,13 +435,15 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
case Common::EVENT_MAINMENU:
if (g_engine && !g_engine->isPaused())
g_engine->mainMenuDialog();
+
if (_shouldQuit)
event.type = Common::EVENT_QUIT;
+ else if (_shouldRTL)
+ event.type = Common::EVENT_RTL;
break;
case Common::EVENT_RTL:
_shouldRTL = true;
- _shouldQuit = true;
break;
case Common::EVENT_QUIT:
diff --git a/backends/events/default/default-events.h b/backends/events/default/default-events.h
index 2195437f3e..b2cd1354cc 100644
--- a/backends/events/default/default-events.h
+++ b/backends/events/default/default-events.h
@@ -117,7 +117,6 @@ public:
virtual int getModifierState() const { return _modifierState; }
virtual int shouldQuit() const { return _shouldQuit; }
virtual int shouldRTL() const { return _shouldRTL; }
- virtual void resetQuit() { _shouldQuit = false; }
virtual void resetRTL() { _shouldRTL = false; }
};
diff --git a/base/main.cpp b/base/main.cpp
index f91574ffc4..bb7a17b901 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -317,9 +317,8 @@ extern "C" int scummvm_main(int argc, char *argv[]) {
// (so instead of just quitting, show a nice error dialog to the
// user and let him pick another game).
- // Reset RTL and Quit flags in case we want to load another engine
+ // Reset RTL flag in case we want to load another engine
g_system->getEventManager()->resetRTL();
- g_system->getEventManager()->resetQuit();
if (result == 0)
break;
diff --git a/common/events.h b/common/events.h
index efaa90fab6..3e4fdbf5ef 100644
--- a/common/events.h
+++ b/common/events.h
@@ -181,12 +181,6 @@ public:
virtual int shouldRTL() const = 0;
/**
- * We have returned to the launcher, and _shouldQuit should be reset to false
- */
-
- virtual void resetQuit() = 0;
-
- /**
* We have returned to the launcher, and the _shouldRTL should be reset to false
*/
virtual void resetRTL() = 0;
diff --git a/engines/agi/preagi_common.cpp b/engines/agi/preagi_common.cpp
index 7817a7594f..3cd04351f7 100644
--- a/engines/agi/preagi_common.cpp
+++ b/engines/agi/preagi_common.cpp
@@ -123,6 +123,7 @@ int PreAgiEngine::getSelection(SelectionTypes type) {
while (!quit()) {
while (_eventMan->pollEvent(event)) {
switch(event.type) {
+ case Common::EVENT_RTL:
case Common::EVENT_QUIT:
return 0;
case Common::EVENT_RBUTTONUP:
diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp
index 6055d21197..5d89e96d59 100644
--- a/engines/agi/preagi_mickey.cpp
+++ b/engines/agi/preagi_mickey.cpp
@@ -345,6 +345,7 @@ bool Mickey::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow) {
while (!_vm->quit()) {
while (_vm->_system->getEventManager()->pollEvent(event)) {
switch(event.type) {
+ case Common::EVENT_RTL:
case Common::EVENT_QUIT:
return 0;
case Common::EVENT_MOUSEMOVE:
@@ -639,6 +640,7 @@ void Mickey::playSound(ENUM_MSA_SOUND iSound) {
if (iSound == IDI_MSA_SND_THEME) {
while (_vm->_system->getEventManager()->pollEvent(event)) {
switch(event.type) {
+ case Common::EVENT_RTL:
case Common::EVENT_QUIT:
case Common::EVENT_LBUTTONUP:
case Common::EVENT_RBUTTONUP:
@@ -2051,6 +2053,7 @@ void Mickey::waitAnyKey(bool anim) {
for (;;) {
while (_vm->_system->getEventManager()->pollEvent(event)) {
switch(event.type) {
+ case Common::EVENT_RTL:
case Common::EVENT_QUIT:
case Common::EVENT_KEYDOWN:
case Common::EVENT_LBUTTONUP:
diff --git a/engines/agi/preagi_troll.cpp b/engines/agi/preagi_troll.cpp
index 418f174a94..beff721fda 100644
--- a/engines/agi/preagi_troll.cpp
+++ b/engines/agi/preagi_troll.cpp
@@ -59,6 +59,7 @@ bool Troll::getMenuSel(const char *szMenu, int *iSel, int nSel) {
while (!_vm->quit()) {
while (_vm->_system->getEventManager()->pollEvent(event)) {
switch(event.type) {
+ case Common::EVENT_RTL:
case Common::EVENT_QUIT:
return 0;
case Common::EVENT_MOUSEMOVE:
@@ -203,6 +204,7 @@ void Troll::waitAnyKeyIntro() {
for (;;) {
while (_vm->_system->getEventManager()->pollEvent(event)) {
switch(event.type) {
+ case Common::EVENT_RTL:
case Common::EVENT_QUIT:
case Common::EVENT_LBUTTONUP:
case Common::EVENT_KEYDOWN:
diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp
index bb0d375fc2..bf023fe5e5 100644
--- a/engines/agi/preagi_winnie.cpp
+++ b/engines/agi/preagi_winnie.cpp
@@ -799,6 +799,7 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) {
while (!_vm->quit()) {
while (_vm->_system->getEventManager()->pollEvent(event)) {
switch(event.type) {
+ case Common::EVENT_RTL:
case Common::EVENT_QUIT:
return;
case Common::EVENT_MOUSEMOVE:
diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp
index 5082db84be..4db3545594 100644
--- a/engines/agos/event.cpp
+++ b/engines/agos/event.cpp
@@ -520,6 +520,7 @@ void AGOSEngine::delay(uint amount) {
setBitFlag(92, false);
_rightButtonDown++;
break;
+ case Common::EVENT_RTL:
case Common::EVENT_QUIT:
return;
default:
diff --git a/engines/engine.h b/engines/engine.h
index 0968642a08..278c259ea8 100644
--- a/engines/engine.h
+++ b/engines/engine.h
@@ -128,9 +128,9 @@ public:
bool isPaused() const { return _pauseLevel != 0; }
/**
- * Return whether or not the engine should quit
+ * Return whether or not the ENGINE should quit
*/
- bool quit() const { return _eventMan->shouldQuit(); }
+ bool quit() const { return (_eventMan->shouldQuit() || _eventMan->shouldRTL()); }
/** Run the Global Main Menu Dialog
*/
diff --git a/engines/kyra/sequences_lok.cpp b/engines/kyra/sequences_lok.cpp
index 577dcd827b..77cfbed2d0 100644
--- a/engines/kyra/sequences_lok.cpp
+++ b/engines/kyra/sequences_lok.cpp
@@ -1185,6 +1185,7 @@ void KyraEngine_LoK::seq_playCredits() {
case Common::EVENT_KEYDOWN:
finished = true;
break;
+ case Common::EVENT_RTL:
case Common::EVENT_QUIT:
finished = true;
break;
diff --git a/engines/kyra/text_lok.cpp b/engines/kyra/text_lok.cpp
index d452109f91..150ec59a23 100644
--- a/engines/kyra/text_lok.cpp
+++ b/engines/kyra/text_lok.cpp
@@ -120,6 +120,7 @@ void KyraEngine_LoK::waitForChatToFinish(int vocFile, int16 chatDuration, const
if (event.kbd.keycode == '.')
_skipFlag = true;
break;
+ case Common::EVENT_RTL:
case Common::EVENT_QUIT:
runLoop = false;
break;
diff --git a/engines/kyra/vqa.cpp b/engines/kyra/vqa.cpp
index 9e2adfa71f..c55c573ea3 100644
--- a/engines/kyra/vqa.cpp
+++ b/engines/kyra/vqa.cpp
@@ -670,6 +670,7 @@ void VQAMovie::play() {
if (event.kbd.ascii == 27)
return;
break;
+ case Common::EVENT_RTL:
case Common::EVENT_QUIT:
return;
default:
diff --git a/engines/lure/animseq.cpp b/engines/lure/animseq.cpp
index f33c3307be..3d5265c90f 100644
--- a/engines/lure/animseq.cpp
+++ b/engines/lure/animseq.cpp
@@ -49,7 +49,7 @@ AnimAbortType AnimationSequence::delay(uint32 milliseconds) {
else return ABORT_NEXT_SCENE;
} else if (events.type() == Common::EVENT_LBUTTONDOWN)
return ABORT_NEXT_SCENE;
- else if (events.type() == Common::EVENT_QUIT)
+ else if ((events.type() == Common::EVENT_QUIT) || (events.type() == Common::EVENT_RTL))
return ABORT_END_INTRO;
}
diff --git a/engines/lure/events.cpp b/engines/lure/events.cpp
index ed1102e9b2..97da8bdb03 100644
--- a/engines/lure/events.cpp
+++ b/engines/lure/events.cpp
@@ -187,7 +187,7 @@ void Events::waitForPress() {
bool keyButton = false;
while (!keyButton) {
while (pollEvent()) {
- if (_event.type == Common::EVENT_QUIT) return;
+ if ((_event.type == Common::EVENT_QUIT) || (_event.type == Common::EVENT_RTL)) return;
else if ((_event.type == Common::EVENT_KEYDOWN) && (_event.kbd.ascii != 0))
keyButton = true;
else if ((_event.type == Common::EVENT_LBUTTONDOWN) ||
diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp
index 9d5ff4ef80..e57b95678f 100644
--- a/engines/parallaction/input.cpp
+++ b/engines/parallaction/input.cpp
@@ -78,7 +78,7 @@ uint16 Input::readInput() {
case Common::EVENT_MOUSEMOVE:
_mousePos = e.mouse;
break;
-
+ case Common::EVENT_RTL:
case Common::EVENT_QUIT:
_vm->_quit = true;
return KeyDown;
diff --git a/engines/queen/input.cpp b/engines/queen/input.cpp
index e7fcf84959..84e21fbcaa 100644
--- a/engines/queen/input.cpp
+++ b/engines/queen/input.cpp
@@ -118,7 +118,7 @@ void Input::delay(uint amount) {
case Common::EVENT_RBUTTONDOWN:
_mouseButton |= MOUSE_RBUTTON;
break;
-
+ case Common::EVENT_RTL:
case Common::EVENT_QUIT:
if (_cutawayRunning)
_cutawayQuit = true;
diff --git a/engines/queen/journal.cpp b/engines/queen/journal.cpp
index c0bd3837c1..ead759cdb6 100644
--- a/engines/queen/journal.cpp
+++ b/engines/queen/journal.cpp
@@ -84,6 +84,7 @@ void Journal::use() {
case Common::EVENT_WHEELDOWN:
handleMouseWheel(1);
break;
+ case Common::EVENT_RTL:
case Common::EVENT_QUIT:
return;
default:
diff --git a/engines/saga/introproc_ihnm.cpp b/engines/saga/introproc_ihnm.cpp
index 079b355826..aaa428ca53 100644
--- a/engines/saga/introproc_ihnm.cpp
+++ b/engines/saga/introproc_ihnm.cpp
@@ -148,6 +148,7 @@ bool Scene::checkKey() {
while (_vm->_eventMan->pollEvent(event)) {
switch (event.type) {
+ case Common::EVENT_RTL:
case Common::EVENT_QUIT:
res = true;
break;
diff --git a/engines/sky/intro.cpp b/engines/sky/intro.cpp
index 51160924da..d7a94f6c2f 100644
--- a/engines/sky/intro.cpp
+++ b/engines/sky/intro.cpp
@@ -911,7 +911,7 @@ bool Intro::escDelay(uint32 msecs) {
if (event.type == Common::EVENT_KEYDOWN) {
if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
return false;
- } else if (event.type == Common::EVENT_QUIT) {
+ } else if (event.type == Common::EVENT_QUIT || event.type == Common::EVENT_RTL) {
return false;
}
}
diff --git a/engines/sword2/animation.cpp b/engines/sword2/animation.cpp
index 47b71f4a33..76f14851e7 100644
--- a/engines/sword2/animation.cpp
+++ b/engines/sword2/animation.cpp
@@ -357,6 +357,7 @@ bool MoviePlayer::userInterrupt() {
case Common::EVENT_SCREEN_CHANGED:
handleScreenChanged();
break;
+ case Common::EVENT_RTL:
case Common::EVENT_QUIT:
terminate = true;
break;
diff --git a/engines/touche/menu.cpp b/engines/touche/menu.cpp
index c3c14c61d3..82490fca38 100644
--- a/engines/touche/menu.cpp
+++ b/engines/touche/menu.cpp
@@ -395,6 +395,7 @@ void ToucheEngine::handleOptions(int forceDisplay) {
while (_eventMan->pollEvent(event)) {
const Button *button = 0;
switch (event.type) {
+ case Common::EVENT_RTL:
case Common::EVENT_QUIT:
menuData.quit = true;
menuData.exit = true;
@@ -556,6 +557,7 @@ int ToucheEngine::displayQuitDialog() {
Common::Event event;
while (_eventMan->pollEvent(event)) {
switch (event.type) {
+ case Common::EVENT_RTL:
case Common::EVENT_QUIT:
quitLoop = true;
ret = 1;