aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2003-06-08 12:11:14 +0000
committerMax Horn2003-06-08 12:11:14 +0000
commitbe9e6e85db6ecbaaefcc8fe46066e0ac34bf1201 (patch)
tree482155e803af627d1d335605c1e93bece8ea541b /scumm
parent083f4c48455d2bdeb84877c7f3ce2b0169bff94e (diff)
downloadscummvm-rg350-be9e6e85db6ecbaaefcc8fe46066e0ac34bf1201.tar.gz
scummvm-rg350-be9e6e85db6ecbaaefcc8fe46066e0ac34bf1201.tar.bz2
scummvm-rg350-be9e6e85db6ecbaaefcc8fe46066e0ac34bf1201.zip
added quit event
svn-id: r8398
Diffstat (limited to 'scumm')
-rw-r--r--scumm/dialogs.cpp4
-rw-r--r--scumm/scumm.h6
-rw-r--r--scumm/scummvm.cpp31
3 files changed, 21 insertions, 20 deletions
diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp
index 55ac8447b4..c3c9539cdf 100644
--- a/scumm/dialogs.cpp
+++ b/scumm/dialogs.cpp
@@ -298,10 +298,8 @@ void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
_scumm->optionsDialog();
break;
case kQuitCmd:
-#ifdef __PALM_OS__
+ _scumm->_quit = true;
close();
-#endif
- _scumm->_system->quit();
break;
default:
ScummDialog::handleCommand(sender, cmd, data);
diff --git a/scumm/scumm.h b/scumm/scumm.h
index 58d6638796..a3b1c728d9 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -354,9 +354,9 @@ public:
void shutDown();
void setOptions(void);
-#ifdef __PALM_OS__
- bool _quit; // try to exit properly
-#endif
+ /** We keep running until this is set to true. */
+ bool _quit;
+
// GUI
NewGui *_newgui;
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index 6b23232c1a..e4b952050d 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -231,16 +231,14 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst)
_objs = NULL;
_debugger = NULL;
_bundle = NULL;
- _sound= NULL;
+ _sound = NULL;
memset(&res, 0, sizeof(res));
memset(&vm, 0, sizeof(vm));
_smushFrameRate = 0;
- _insaneState = 0;
- _videoFinished = 0;
- _smushPlay = 0;
-#ifdef __PALM_OS__
+ _insaneState = false;
+ _videoFinished = false;
+ _smushPlay = false;
_quit = false;
-#endif
_newgui = NULL;
_pauseDialog = NULL;
_optionsDialog = NULL;
@@ -249,7 +247,7 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst)
_fastMode = 0;
memset(&_rnd, 0, sizeof(RandomSource));
_gameId = 0;
- memset(&gdi,0,sizeof(Gdi));
+ memset(&gdi, 0, sizeof(Gdi));
_actors = NULL;
_inventory = NULL;
_newNames = NULL;
@@ -1878,8 +1876,7 @@ char Scumm::displayError(bool showCancel, const char *message, ...) {
}
void Scumm::shutDown() {
- // FIXME: This is ugly
- _system->quit();
+ _quit = true;
}
void Scumm::restart() {
@@ -2342,6 +2339,10 @@ void Scumm::parseEvents() {
_rightBtnPressed &= ~msDown;
break;
+ case OSystem::EVENT_QUIT:
+ _quit = true;
+ break;
+
default:
break;
}
@@ -2403,11 +2404,8 @@ void Scumm::mainRun() {
int delta = 0;
int diff = _system->get_msecs();
- for (;;) {
-#ifdef __PALM_OS__
- if (_quit) // palmfixme : need to check for autosave on exit
- return;
-#endif
+ while (!_quit) {
+
updatePalette();
_system->update_screen();
@@ -2418,6 +2416,11 @@ void Scumm::mainRun() {
if (delta < 1) // Ensure we don't get into a loop
delta = 1; // by not decreasing sleepers.
+
+ if (_quit) {
+ // TODO: Maybe perform an autosave on exit?
+ // TODO: Also, we could optionally show a "Do you really want to quit?" dialog here
+ }
}
}