aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2018-12-31 15:45:33 +0100
committerEugene Sandulenko2019-11-13 22:07:08 +0100
commit84f02e2f73c5272bdecee890128a95456285104f (patch)
tree85fd968ebc2c8b98aef2982d9f76033b19ad4e4d /engines
parent17e1cb80c854575e720011a7882c182273687b3e (diff)
downloadscummvm-rg350-84f02e2f73c5272bdecee890128a95456285104f.tar.gz
scummvm-rg350-84f02e2f73c5272bdecee890128a95456285104f.tar.bz2
scummvm-rg350-84f02e2f73c5272bdecee890128a95456285104f.zip
GRIFFON: Implement engine quitting
Diffstat (limited to 'engines')
-rw-r--r--engines/griffon/engine.cpp56
-rw-r--r--engines/griffon/griffon.cpp2
-rw-r--r--engines/griffon/griffon.h1
3 files changed, 45 insertions, 14 deletions
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index f20019ad2e..86291f87f3 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -255,6 +255,10 @@ int pmenu;
void GriffonEngine::griffon_main() {
sys_initialize();
game_showlogos();
+
+ if (_shouldQuit)
+ return;
+
game_main();
}
@@ -1015,9 +1019,12 @@ void GriffonEngine::game_checkinputs() {
if (attacking == 1 || (forcepause == 1 && itemselon == 0))
return;
- if (event.type == Common::EVENT_KEYDOWN) {
- warning("HERE3");
+ if (event.type == Common::EVENT_QUIT) {
+ _shouldQuit = true;
+ return;
+ }
+ if (event.type == Common::EVENT_KEYDOWN) {
if (event.kbd.keycode == Common::KEYCODE_ESCAPE) {
if (itemticks < ticks)
game_title(1);
@@ -1487,9 +1494,10 @@ void GriffonEngine::game_configmenu() {
if (keypause < ticks) {
g_system->getEventManager()->pollEvent(event);
- if (event.type == Common::EVENT_KEYDOWN) {
- warning("HERE4");
+ if (event.type == Common::EVENT_QUIT)
+ _shouldQuit = true;
+ if (event.type == Common::EVENT_KEYDOWN) {
keypause = ticks + tickwait;
if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
@@ -1667,7 +1675,7 @@ void GriffonEngine::game_configmenu() {
clouddeg = clouddeg - 360;
g_system->delayMillis(10);
- } while (1);
+ } while (!_shouldQuit);
configwindow->free();
itemticks = ticks + 210;
@@ -4649,6 +4657,10 @@ void GriffonEngine::game_loadmap(int mapnum) {
void GriffonEngine::game_main() {
game_title(0);
+
+ if (_shouldQuit)
+ return;
+
game_saveloadnew();
}
@@ -4749,10 +4761,16 @@ void GriffonEngine::game_newgame() {
if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
goto __exit_do;
+ if (event.type == Common::EVENT_QUIT)
+ _shouldQuit = true;
+
g_system->delayMillis(10);
- } while (1);
+ } while (!_shouldQuit);
__exit_do:
+ if (_shouldQuit)
+ return;
+
player.px = 0;
player.py = 0;
player.opx = 0;
@@ -4851,7 +4869,7 @@ void GriffonEngine::game_playgame() {
game_updmusic();
sys_update();
- } while (1);
+ } while (!_shouldQuit);
}
void GriffonEngine::game_processtrigger(int trignum) {
@@ -4968,15 +4986,20 @@ void GriffonEngine::game_saveloadnew() {
g_system->getEventManager()->pollEvent(event);
+ if (event.type == Common::EVENT_QUIT) {
+ _shouldQuit = true;
+ return;
+ }
+
if (tickpause < ticks) {
- warning("HERE");
if (event.type == Common::EVENT_KEYDOWN) {
itemticks = ticks + 220;
if (event.kbd.keycode == Common::KEYCODE_RETURN) {
// QUIT - non existent :)
if (currow == 0 && curcol == 4) {
- //exit(1); // FIXME
+ _shouldQuit = true;
+ return;
}
// RETURN
if (currow == 0 && curcol == 3) {
@@ -5232,7 +5255,7 @@ void GriffonEngine::game_saveloadnew() {
itemyloc -= 16;
g_system->delayMillis(10);
- } while (1);
+ } while (!_shouldQuit);
SDL_SetAlpha(cloudimg, 0, 64);
}
@@ -5273,6 +5296,9 @@ void GriffonEngine::game_showlogos() {
g_system->getEventManager()->pollEvent(event);
+ if (event.type == Common::EVENT_QUIT)
+ _shouldQuit = true;
+
tickspassed = ticks;
ticks = g_system->getMillis();
@@ -5289,7 +5315,7 @@ void GriffonEngine::game_showlogos() {
g_system->delayMillis(10);
if (ticks > ticks1 + 4000)
break;
- } while (1);
+ } while (!_shouldQuit);
}
@@ -5530,9 +5556,11 @@ void GriffonEngine::game_title(int mode) {
g_system->getEventManager()->pollEvent(event);
+ if (event.type == Common::EVENT_QUIT)
+ _shouldQuit = true;
+
if (keypause < ticks) {
if (event.type == Common::EVENT_KEYDOWN) {
- warning("HERE2");
keypause = ticks + 150;
if (event.kbd.keycode == Common::KEYCODE_ESCAPE && mode == 1)
@@ -5557,7 +5585,7 @@ void GriffonEngine::game_title(int mode) {
keypause = ticks + 150;
ticks1 = ticks;
} else if (cursel == 2) {
- //exit(1); // FIXME
+ _shouldQuit = true;
} else if (cursel == 3) {
break;
}
@@ -5567,7 +5595,7 @@ void GriffonEngine::game_title(int mode) {
SDL_Flip(video);
g_system->delayMillis(10);
- } while (1);
+ } while (!_shouldQuit);
itemticks = ticks + 210;
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index e31c7a3249..17cb048ac2 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -39,6 +39,8 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
SearchMan.addSubDirectoryMatching(gameDataDir, "sound");
_rnd = new Common::RandomSource("griffon");
+
+ _shouldQuit = false;
}
GriffonEngine::~GriffonEngine() {
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index a81951e019..7da3414ab3 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -239,6 +239,7 @@ public:
private:
Common::RandomSource *_rnd;
+ bool _shouldQuit;
private:
void griffon_main();