aboutsummaryrefslogtreecommitdiff
path: root/engines/agos
diff options
context:
space:
mode:
authorChristopher Page2008-07-07 22:34:45 +0000
committerChristopher Page2008-07-07 22:34:45 +0000
commita4f56de13ac2a7daaf5654c75f07ad6331f375e6 (patch)
tree8a000a805fef0d628eaeb9d662daf0649a785ffe /engines/agos
parentb50df858eb52520b529597d98fcd0d9b29619930 (diff)
downloadscummvm-rg350-a4f56de13ac2a7daaf5654c75f07ad6331f375e6.tar.gz
scummvm-rg350-a4f56de13ac2a7daaf5654c75f07ad6331f375e6.tar.bz2
scummvm-rg350-a4f56de13ac2a7daaf5654c75f07ad6331f375e6.zip
Implemented Common::EventManager::pushEvent() to insert fake events into the event queue. Quit and RTL events have been added, and are now tracked by the DefaultEventManager using shouldQuit() and shouldRTL(). AGOS is working with this new implementation, other engines to follow.
svn-id: r32952
Diffstat (limited to 'engines/agos')
-rw-r--r--engines/agos/agos.cpp8
-rw-r--r--engines/agos/animation.cpp3
-rw-r--r--engines/agos/event.cpp5
-rw-r--r--engines/agos/gfx.cpp3
-rw-r--r--engines/agos/input.cpp5
-rw-r--r--engines/agos/script.cpp9
-rw-r--r--engines/agos/script_e1.cpp6
-rw-r--r--engines/agos/script_s1.cpp6
8 files changed, 22 insertions, 23 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index f888931ad0..86121f89a6 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -947,7 +947,7 @@ void AGOSEngine::pauseEngineIntern(bool pauseIt) {
void AGOSEngine::pause() {
pauseEngine(true);
- while (_pause && !_quit) {
+ while (_pause && !_eventMan->shouldQuit()) {
delay(1);
if (_keyPressed.keycode == Common::KEYCODE_p)
pauseEngine(false);
@@ -984,7 +984,7 @@ int AGOSEngine::go() {
(getFeatures() & GF_DEMO)) {
int i;
- while (!_quit) {
+ while (!_eventMan->shouldQuit()) {
for (i = 0; i < 4; i++) {
setWindowImage(3, 9902 + i);
debug(0, "Displaying image %d", 9902 + i);
@@ -1013,13 +1013,13 @@ int AGOSEngine::go() {
runSubroutine101();
permitInput();
- while (!_quit) {
+ while (!_eventMan->shouldQuit()) {
waitForInput();
handleVerbClicked(_verbHitArea);
delay(100);
}
- return _rtl;
+ return _eventMan->shouldRTL();
}
diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp
index c92f834a3b..770f48b62e 100644
--- a/engines/agos/animation.cpp
+++ b/engines/agos/animation.cpp
@@ -279,9 +279,6 @@ void MoviePlayer::handleNextFrame() {
case Common::EVENT_RBUTTONUP:
_rightButtonDown = false;
break;
- case Common::EVENT_QUIT:
- _vm->_quit = true;
- break;
default:
break;
}
diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp
index 010b331cf8..4a362d420a 100644
--- a/engines/agos/event.cpp
+++ b/engines/agos/event.cpp
@@ -142,7 +142,7 @@ bool AGOSEngine::kickoffTimeEvents() {
cur_time = getTime() - _gameStoppedClock;
- while ((te = _firstTimeStruct) != NULL && te->time <= cur_time && !_quit) {
+ while ((te = _firstTimeStruct) != NULL && te->time <= cur_time && !_eventMan->shouldQuit()) {
result = true;
_pendingDeleteTimeEvent = te;
invokeTimeEvent(te);
@@ -521,7 +521,6 @@ void AGOSEngine::delay(uint amount) {
_rightButtonDown++;
break;
case Common::EVENT_QUIT:
- _quit = true;
return;
default:
break;
@@ -544,7 +543,7 @@ void AGOSEngine::delay(uint amount) {
_system->delayMillis(this_delay);
cur = _system->getMillis();
- } while (cur < start + amount && !_quit);
+ } while (cur < start + amount && !_eventMan->shouldQuit());
}
void AGOSEngine::timer_callback() {
diff --git a/engines/agos/gfx.cpp b/engines/agos/gfx.cpp
index c014413bdc..e39b7c9ea4 100644
--- a/engines/agos/gfx.cpp
+++ b/engines/agos/gfx.cpp
@@ -26,6 +26,7 @@
#include "common/system.h"
+#include "common/events.h"
#include "graphics/surface.h"
@@ -1263,7 +1264,7 @@ void AGOSEngine::setWindowImageEx(uint16 mode, uint16 vga_res) {
if (getGameType() == GType_WW && (mode == 6 || mode == 8 || mode == 9)) {
setWindowImage(mode, vga_res);
} else {
- while (_copyScnFlag && !_quit)
+ while (_copyScnFlag && !_eventMan->shouldQuit())
delay(1);
setWindowImage(mode, vga_res);
diff --git a/engines/agos/input.cpp b/engines/agos/input.cpp
index d36549f187..b3acfe188b 100644
--- a/engines/agos/input.cpp
+++ b/engines/agos/input.cpp
@@ -26,6 +26,7 @@
#include "common/config-manager.h"
+#include "common/events.h"
#include "common/file.h"
#include "agos/intern.h"
@@ -189,12 +190,12 @@ void AGOSEngine::waitForInput() {
resetVerbs();
}
- while (!_quit) {
+ while (!_eventMan->shouldQuit()) {
_lastHitArea = NULL;
_lastHitArea3 = NULL;
_dragAccept = 1;
- while (!_quit) {
+ while (!_eventMan->shouldQuit()) {
if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) &&
_keyPressed.keycode == Common::KEYCODE_F10)
displayBoxStars();
diff --git a/engines/agos/script.cpp b/engines/agos/script.cpp
index 6758aec511..da47d61891 100644
--- a/engines/agos/script.cpp
+++ b/engines/agos/script.cpp
@@ -28,6 +28,7 @@
#include "common/system.h"
+#include "common/events.h"
#include "agos/animation.h"
#include "agos/agos.h"
@@ -410,7 +411,7 @@ void AGOSEngine::o_msg() {
void AGOSEngine::o_end() {
// 68: exit interpreter
- _quit = true;
+ _eventMan->pushEvent(Common::EVENT_QUIT);
}
void AGOSEngine::o_done() {
@@ -965,7 +966,7 @@ void AGOSEngine::writeVariable(uint16 variable, uint16 contents) {
int AGOSEngine::runScript() {
bool flag;
- if (_quit)
+ if (_eventMan->shouldQuit())
return 1;
do {
@@ -1010,7 +1011,7 @@ int AGOSEngine::runScript() {
error("Invalid opcode '%d' encountered", _opcode);
executeOpcode(_opcode);
- } while (getScriptCondition() != flag && !getScriptReturn() && !_quit);
+ } while (getScriptCondition() != flag && !getScriptReturn() && !_eventMan->shouldQuit());
return getScriptReturn();
}
@@ -1066,7 +1067,7 @@ void AGOSEngine::waitForSync(uint a) {
_exitCutscene = false;
_rightButtonDown = false;
- while (_vgaWaitFor != 0 && !_quit) {
+ while (_vgaWaitFor != 0 && !_eventMan->shouldQuit()) {
if (_rightButtonDown) {
if (_vgaWaitFor == 200 && (getGameType() == GType_FF || !getBitFlag(14))) {
skipSpeech();
diff --git a/engines/agos/script_e1.cpp b/engines/agos/script_e1.cpp
index c7e1d6736e..e394779ab8 100644
--- a/engines/agos/script_e1.cpp
+++ b/engines/agos/script_e1.cpp
@@ -23,7 +23,7 @@
*
*/
-
+#include "common/events.h"
#include "agos/agos.h"
#include "agos/vga.h"
@@ -565,7 +565,7 @@ void AGOSEngine_Elvira1::oe1_look() {
lobjFunc(l, "You can see "); /* Show objects */
}
if (r && (r->flags & 4) && levelOf(i) < 10000) {
- _quit = true;
+ _eventMan->pushEvent(Common::EVENT_QUIT);
}
}
@@ -944,7 +944,7 @@ restart:
windowPutChar(window, *message2);
if (confirmYesOrNo(120, 62) == 0x7FFF) {
- _quit = true;
+ _eventMan->pushEvent(Common::EVENT_QUIT);
} else {
goto restart;
}
diff --git a/engines/agos/script_s1.cpp b/engines/agos/script_s1.cpp
index 51918b9515..e8577d21bc 100644
--- a/engines/agos/script_s1.cpp
+++ b/engines/agos/script_s1.cpp
@@ -24,7 +24,7 @@
*/
-
+#include "common/events.h"
#include "common/system.h"
#include "agos/agos.h"
@@ -345,14 +345,14 @@ void AGOSEngine_Simon1::os1_pauseGame() {
if (isSmartphone()) {
if (_keyPressed.keycode) {
if (_keyPressed.keycode == Common::KEYCODE_RETURN)
- _quit = true;
+ _eventMan->pushEvent(Common::EVENT_QUIT);
else
break;
}
}
#endif
if (_keyPressed.keycode == keyYes)
- _quit = true;
+ _eventMan->pushEvent(Common::EVENT_QUIT);
else if (_keyPressed.keycode == keyNo)
break;
}