Hopefully allow quiting at any stage AGOS engines games again.

svn-id: r33693
This commit is contained in:
Travis Howell 2008-08-08 02:18:17 +00:00
parent 52650efb6a
commit fd65ea311a
12 changed files with 33 additions and 24 deletions

View file

@ -151,7 +151,7 @@ void MoviePlayer::play() {
startSound();
while (_frameNum < _framesCount)
while (_frameNum < _framesCount && !_vm->_quit)
handleNextFrame();
closeFile();

View file

@ -123,7 +123,7 @@ void AGOSEngine::setup_cond_c_helper() {
clearName();
_lastNameOn = last;
for (;;) {
while (!_quit) {
_lastHitArea = NULL;
_lastHitArea3 = 0;
_leftButtonDown = 0;
@ -145,7 +145,7 @@ void AGOSEngine::setup_cond_c_helper() {
}
delay(100);
} while (_lastHitArea3 == (HitArea *) -1 || _lastHitArea3 == 0);
} while ((_lastHitArea3 == (HitArea *) -1 || _lastHitArea3 == 0) && !_quit);
if (_lastHitArea == NULL) {
} else if (_lastHitArea->id == 0x7FFB) {

View file

@ -459,7 +459,7 @@ void AGOSEngine_Feeble::saveUserGame(int slot) {
}
windowPutChar(window, 0x7f);
for (;;) {
while (!_quit) {
_keyPressed.reset();
delay(1);

View file

@ -279,11 +279,11 @@ restart:
name = buf;
_saveGameNameLen = 0;
for (;;) {
while (!_quit) {
windowPutChar(window, 128);
_keyPressed.reset();
for (;;) {
while (!_quit) {
delay(10);
if (_keyPressed.ascii && _keyPressed.ascii < 128) {
i = _keyPressed.ascii;
@ -443,7 +443,7 @@ void AGOSEngine_Elvira2::userGame(bool load) {
name = buf + 192;
for (;;) {
while (!_quit) {
windowPutChar(window, 128);
_saveLoadEdit = true;
@ -516,7 +516,7 @@ int AGOSEngine_Elvira2::userGameGetKey(bool *b, char *buf, uint maxChar) {
_keyPressed.reset();
for (;;) {
while (!_quit) {
_lastHitArea = NULL;
_lastHitArea3 = NULL;
@ -526,7 +526,7 @@ int AGOSEngine_Elvira2::userGameGetKey(bool *b, char *buf, uint maxChar) {
return _keyPressed.ascii;
}
delay(10);
} while (_lastHitArea3 == 0);
} while (_lastHitArea3 == 0 && !_quit);
ha = _lastHitArea;
if (ha == NULL || ha->id < 200) {
@ -543,6 +543,8 @@ int AGOSEngine_Elvira2::userGameGetKey(bool *b, char *buf, uint maxChar) {
return ha->id - 200;
}
}
return 225;
}
void AGOSEngine_Simon1::listSaveGames(char *dst) {
@ -706,7 +708,7 @@ restart:;
_saveGameNameLen++;
}
for (;;) {
while (!_quit) {
windowPutChar(window, 127);
_saveLoadEdit = true;
@ -785,7 +787,7 @@ int AGOSEngine_Simon1::userGameGetKey(bool *b, char *buf, uint maxChar) {
_keyPressed.reset();
for (;;) {
while (!_quit) {
_lastHitArea = NULL;
_lastHitArea3 = NULL;
@ -795,7 +797,7 @@ int AGOSEngine_Simon1::userGameGetKey(bool *b, char *buf, uint maxChar) {
return _keyPressed.ascii;
}
delay(10);
} while (_lastHitArea3 == 0);
} while (_lastHitArea3 == 0 && !_quit);
ha = _lastHitArea;
if (ha == NULL || ha->id < 205) {
@ -824,6 +826,8 @@ int AGOSEngine_Simon1::userGameGetKey(bool *b, char *buf, uint maxChar) {
return ha->id - 208;
}
}
return 205;
}
void AGOSEngine::disableFileBoxes() {

View file

@ -1012,7 +1012,7 @@ int AGOSEngine::runScript() {
executeOpcode(_opcode);
} while (getScriptCondition() != flag && !getScriptReturn() && !_quit);
return getScriptReturn();
return (_quit) ? 1 : getScriptReturn();
}
Child *nextSub(Child *sub, int16 key) {

View file

@ -1053,11 +1053,11 @@ uint AGOSEngine::confirmYesOrNo(uint16 x, uint16 y) {
ha->priority = 999;
ha->window = 0;
for (;;) {
while (!_quit) {
_lastHitArea = NULL;
_lastHitArea3 = NULL;
for (;;) {
while (!_quit) {
if (_lastHitArea3 != 0)
break;
delay(1);
@ -1102,11 +1102,11 @@ uint AGOSEngine::continueOrQuit() {
ha->priority = 999;
ha->window = 0;
for (;;) {
while (!_quit) {
_lastHitArea = NULL;
_lastHitArea3 = NULL;
for (;;) {
while (!_quit) {
if (_lastHitArea3 != 0)
break;
delay(1);

View file

@ -370,11 +370,11 @@ void AGOSEngine_Elvira2::oe2_pauseGame() {
uint32 pauseTime = getTime();
haltAnimation();
for (;;) {
while (!_quit) {
_lastHitArea = NULL;
_lastHitArea3 = NULL;
for (;;) {
while (!_quit) {
if (processSpecialKeys() != 0 || _lastHitArea3 != 0)
break;
delay(1);

View file

@ -339,7 +339,7 @@ void AGOSEngine_Simon1::os1_pauseGame() {
break;
}
for (;;) {
while (!_quit) {
delay(1);
if (_keyPressed.keycode == keyYes)
_quit = true;

View file

@ -368,11 +368,11 @@ void AGOSEngine_Waxworks::oww_pauseGame() {
uint32 pauseTime = getTime();
haltAnimation();
for (;;) {
while (!_quit) {
_lastHitArea = NULL;
_lastHitArea3 = NULL;
for (;;) {
while (!_quit) {
if (_lastHitArea3 != 0)
break;
delay(1);

View file

@ -518,6 +518,8 @@ void AGOSEngine::runSubroutine101() {
}
int AGOSEngine::startSubroutine(Subroutine *sub) {
printf("startSubroutine\n");
int result = -1;
SubroutineLine *sl = (SubroutineLine *)((byte *)sub + sub->first);

View file

@ -343,6 +343,9 @@ void AGOSEngine::handleVerbClicked(uint verb) {
Subroutine *sub;
int result;
if (_quit)
return;
_objectItem = _hitAreaObjectItem;
if (_objectItem == _dummyItem2) {
_objectItem = me();

View file

@ -298,7 +298,7 @@ void AGOSEngine::waitWindow(WindowBlock *window) {
ha->id = 0x7FFF;
ha->priority = 999;
for (;;) {
while (!_quit) {
_lastHitArea = NULL;
_lastHitArea3 = NULL;