AGOS Engine: Began implementation for a new quit event which will cleanly return to the launcher. This replaces the old shutdown() method within delay()

svn-id: r32203
This commit is contained in:
Christopher Page
2008-05-20 21:40:53 +00:00
parent 5e592d4e4a
commit ca76ef4e1f
9 changed files with 30 additions and 16 deletions
+9 -3
View File
@@ -98,6 +98,8 @@ AGOSEngine::AGOSEngine(OSystem *syst)
_vc_get_out_of_code = 0;
_gameOffsetsPtr = 0;
_quit = false;
_debugger = 0;
_gameFile = 0;
@@ -933,7 +935,7 @@ void AGOSEngine::pause() {
_mixer->pauseAll(true);
_sound->ambientPause(true);
while (_pause) {
while (_pause && !_quit) {
delay(1);
if (_keyPressed.keycode == Common::KEYCODE_p)
_pause = false;
@@ -974,7 +976,7 @@ int AGOSEngine::go() {
(getFeatures() & GF_DEMO)) {
int i;
while (1) {
while (!_quit) {
for (i = 0; i < 4; i++) {
setWindowImage(3, 9902 + i);
debug(0, "Displaying image %d", 9902 + i);
@@ -1003,7 +1005,7 @@ int AGOSEngine::go() {
runSubroutine101();
permitInput();
while (1) {
while (!_quit) {
waitForInput();
handleVerbClicked(_verbHitArea);
delay(100);
@@ -1012,6 +1014,9 @@ int AGOSEngine::go() {
return 0;
}
/* I do not think that this will be used
*
void AGOSEngine::shutdown() {
// Sync with AGOSEngine::~AGOSEngine()
// In Simon 2, this gets deleted along with _sound further down
@@ -1059,6 +1064,7 @@ void AGOSEngine::shutdown() {
_system->quit();
}
*/
uint32 AGOSEngine::getTime() const {
// FIXME: calling time() is not portable, use OSystem::getMillis instead
+1
View File
@@ -269,6 +269,7 @@ protected:
uint16 _marks;
bool _quit;
bool _scriptVar2;
bool _runScriptReturn1;
bool _runScriptCondition[40];
+3 -3
View File
@@ -142,7 +142,7 @@ bool AGOSEngine::kickoffTimeEvents() {
cur_time = getTime() - _gameStoppedClock;
while ((te = _firstTimeStruct) != NULL && te->time <= cur_time) {
while ((te = _firstTimeStruct) != NULL && te->time <= cur_time && !_quit) {
result = true;
_pendingDeleteTimeEvent = te;
invokeTimeEvent(te);
@@ -521,7 +521,7 @@ void AGOSEngine::delay(uint amount) {
_rightButtonDown++;
break;
case Common::EVENT_QUIT:
shutdown();
_quit = true;
return;
default:
break;
@@ -544,7 +544,7 @@ void AGOSEngine::delay(uint amount) {
_system->delayMillis(this_delay);
cur = _system->getMillis();
} while (cur < start + amount);
} while (cur < start + amount && !_quit);
}
void AGOSEngine::timer_callback() {
+1 -1
View File
@@ -1263,7 +1263,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)
while (_copyScnFlag && !_quit)
delay(1);
setWindowImage(mode, vga_res);
+2 -2
View File
@@ -189,12 +189,12 @@ void AGOSEngine::waitForInput() {
resetVerbs();
}
for (;;) {
while (!_quit) {
_lastHitArea = NULL;
_lastHitArea3 = NULL;
_dragAccept = 1;
for (;;) {
while (!_quit) {
if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) &&
_keyPressed.keycode == Common::KEYCODE_F10)
displayBoxStars();
+6 -3
View File
@@ -410,7 +410,7 @@ void AGOSEngine::o_msg() {
void AGOSEngine::o_end() {
// 68: exit interpreter
shutdown();
_quit = true;
}
void AGOSEngine::o_done() {
@@ -965,6 +965,9 @@ void AGOSEngine::writeVariable(uint16 variable, uint16 contents) {
int AGOSEngine::runScript() {
bool flag;
if (_quit)
return 1;
do {
if (_continousMainScript)
dumpOpcode(_codePtr);
@@ -1007,7 +1010,7 @@ int AGOSEngine::runScript() {
error("Invalid opcode '%d' encountered", _opcode);
executeOpcode(_opcode);
} while (getScriptCondition() != flag && !getScriptReturn());
} while (getScriptCondition() != flag && !getScriptReturn() && !_quit);
return getScriptReturn();
}
@@ -1063,7 +1066,7 @@ void AGOSEngine::waitForSync(uint a) {
_exitCutscene = false;
_rightButtonDown = false;
while (_vgaWaitFor != 0) {
while (_vgaWaitFor != 0 && !_quit) {
if (_rightButtonDown) {
if (_vgaWaitFor == 200 && (getGameType() == GType_FF || !getBitFlag(14))) {
skipSpeech();
+2 -2
View File
@@ -565,7 +565,7 @@ void AGOSEngine_Elvira1::oe1_look() {
lobjFunc(l, "You can see "); /* Show objects */
}
if (r && (r->flags & 4) && levelOf(i) < 10000) {
shutdown();
_quit = true;
}
}
@@ -944,7 +944,7 @@ restart:
windowPutChar(window, *message2);
if (confirmYesOrNo(120, 62) == 0x7FFF) {
shutdown();
_quit = true;
} else {
goto restart;
}
+2 -2
View File
@@ -345,14 +345,14 @@ void AGOSEngine_Simon1::os1_pauseGame() {
if (isSmartphone()) {
if (_keyPressed.keycode) {
if (_keyPressed.keycode == Common::KEYCODE_RETURN)
shutdown();
_quit = true;
else
break;
}
}
#endif
if (_keyPressed.keycode == keyYes)
shutdown();
_quit = true;
else if (_keyPressed.keycode == keyNo)
break;
}
+4
View File
@@ -554,6 +554,10 @@ int AGOSEngine::startSubroutine(Subroutine *sub) {
_currentTable = sub;
restart:
if (_quit)
return result;
while ((byte *)sl != (byte *)sub) {
_currentLine = sl;
if (checkIfToRunSubroutineLine(sl, sub)) {