From 9a9c1a40d9b9eb40747633eae8b8e242042626c9 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Tue, 6 Jan 2009 23:29:58 +0000 Subject: Added a few more shouldQuit() checks. It's now possible to quit while, for instance, Leisure Suit Larry is waiting for you to enter your age. svn-id: r35761 --- engines/agi/keyboard.cpp | 8 ++++---- engines/agi/op_cmd.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/agi/keyboard.cpp b/engines/agi/keyboard.cpp index b8cf14d0ec..c52767d0c2 100644 --- a/engines/agi/keyboard.cpp +++ b/engines/agi/keyboard.cpp @@ -365,7 +365,7 @@ void AgiEngine::handleKeys(int key) { } int AgiEngine::waitKey() { - int key; + int key = 0; /* clear key queue */ while (_gfx->keypress()) { @@ -373,7 +373,7 @@ int AgiEngine::waitKey() { } debugC(3, kDebugLevelInput, "waiting..."); - for (;;) { + while (!shouldQuit()) { _gfx->pollTimer(); /* msdos driver -> does nothing */ key = doPollKeyboard(); if (key == KEY_ENTER || key == KEY_ESCAPE || key == BUTTON_LEFT) @@ -388,7 +388,7 @@ int AgiEngine::waitKey() { } int AgiEngine::waitAnyKey() { - int key; + int key = 0; /* clear key queue */ while (_gfx->keypress()) { @@ -396,7 +396,7 @@ int AgiEngine::waitAnyKey() { } debugC(3, kDebugLevelInput, "waiting..."); - for (;;) { + while (!shouldQuit()) { _gfx->pollTimer(); /* msdos driver -> does nothing */ key = doPollKeyboard(); if (key) diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp index 186002e8cc..70587820f7 100644 --- a/engines/agi/op_cmd.cpp +++ b/engines/agi/op_cmd.cpp @@ -1331,7 +1331,7 @@ cmd(get_string) { do { g_agi->mainCycle(); - } while (game.inputMode == INPUT_GETSTRING); + } while (game.inputMode == INPUT_GETSTRING && !g_agi->shouldQuit()); } cmd(get_num) { @@ -1349,7 +1349,7 @@ cmd(get_num) { do { g_agi->mainCycle(); - } while (game.inputMode == INPUT_GETSTRING); + } while (game.inputMode == INPUT_GETSTRING && !g_agi->shouldQuit()); _v[p1] = atoi(game.strings[MAX_STRINGS]); debugC(4, kDebugLevelScripts, "[%s] -> %d", game.strings[MAX_STRINGS], _v[p1]); -- cgit v1.2.3