Parallaction now uses the new _quit flag

svn-id: r32773
This commit is contained in:
Christopher Page 2008-06-25 01:41:40 +00:00
parent 6e3474896c
commit e37b0745d3
9 changed files with 33 additions and 32 deletions

View File

@ -105,7 +105,7 @@ uint16 DialogueManager::askPassword() {
if (g_system->getEventManager()->pollEvent(e)) {
if (e.type == Common::EVENT_QUIT) {
_engineFlags |= kEngineQuit;
_vm->_quit = true;
break;
}
@ -230,7 +230,7 @@ void DialogueManager::run() {
displayQuestion();
if (_engineFlags & kEngineQuit)
if (_vm->_quit)
return;
if (_q->_answers[0] == NULL) break;
@ -239,7 +239,7 @@ void DialogueManager::run() {
if (!displayAnswers()) break;
answer = getAnswer();
if (_engineFlags & kEngineQuit)
if (_vm->_quit)
return;
cmdlist = &_q->_answers[answer]->_commands;
@ -272,7 +272,7 @@ int16 DialogueManager::selectAnswer() {
uint32 event;
Common::Point p;
while (_engineFlags & kEngineQuit == 0) {
while (!_vm->_quit) {
_vm->_input->readInput();
_vm->_input->getCursorPos(p);

View File

@ -297,7 +297,7 @@ DECLARE_COMMAND_OPCODE(drop){
DECLARE_COMMAND_OPCODE(quit) {
_engineFlags |= kEngineQuit;
_vm->_quit = true;
}
@ -427,7 +427,7 @@ void Parallaction::runCommands(CommandList& list, ZonePtr z) {
CommandPtr cmd = *it;
uint32 v8 = getLocationFlags();
if (_engineFlags & kEngineQuit)
if (_vm->_quit)
break;
if (cmd->_flagsOn & kFlagsGlobal) {
@ -519,7 +519,7 @@ uint16 Parallaction::runZone(ZonePtr z) {
case kZoneSpeak:
runDialogue(z->u.speak);
if (_engineFlags & kEngineQuit)
if (_vm->_quit)
return 0;
break;

View File

@ -50,7 +50,7 @@ void Parallaction_br::guiStart() {
int option = guiShowMenu();
switch (option) {
case kMenuQuit:
_engineFlags |= kEngineQuit;
_vm->_quit = true;
break;
case kMenuLoadGame:

View File

@ -80,7 +80,7 @@ uint16 Input::readInput() {
break;
case Common::EVENT_QUIT:
_engineFlags |= kEngineQuit;
_vm->_quit = true;
return KeyDown;
default:

View File

@ -331,7 +331,7 @@ void Parallaction::processInput(InputData *data) {
break;
case kEvQuitGame:
_engineFlags |= kEngineQuit;
_vm->_quit = true;
break;
case kEvSaveGame:
@ -358,19 +358,19 @@ void Parallaction::runGame() {
processInput(data);
}
if (_engineFlags & kEngineQuit)
if (_vm->_quit)
return;
runPendingZones();
if (_engineFlags & kEngineQuit)
if (_vm->_quit)
return;
if (_engineFlags & kEngineChangeLocation) {
changeLocation(_location._name);
}
if (_engineFlags & kEngineQuit)
if (_vm->_quit)
return;
_gfx->beginFrame();
@ -466,7 +466,7 @@ ZonePtr Parallaction::findZone(const char *name) {
void Parallaction::freeZones() {
debugC(2, kDebugExec, "freeZones: kEngineQuit = %i", _engineFlags & kEngineQuit);
debugC(2, kDebugExec, "freeZones: _vm->_quit = %i", _vm->_quit);
ZoneList::iterator it = _location._zones.begin();
@ -475,7 +475,7 @@ void Parallaction::freeZones() {
// NOTE : this condition has been relaxed compared to the original, to allow the engine
// to retain special - needed - zones that were lost across location switches.
ZonePtr z = *it;
if (((z->_top == -1) || (z->_left == -2)) && ((_engineFlags & kEngineQuit) == 0)) {
if (((z->_top == -1) || (z->_left == -2)) && ((_vm->_quit) == 0)) {
debugC(2, kDebugExec, "freeZones preserving zone '%s'", z->_name);
it++;
} else {

View File

@ -98,7 +98,6 @@ enum {
};
enum EngineFlags {
kEngineQuit = (1 << 0),
kEnginePauseJobs = (1 << 1),
kEngineInventory = (1 << 2),
kEngineWalking = (1 << 3),

View File

@ -105,17 +105,17 @@ int Parallaction_br::go() {
guiSplash("dyna");
guiSplash("core");
while ((_engineFlags & kEngineQuit) == 0) {
while (_vm->_quit == 0) {
guiStart();
if (_engineFlags & kEngineQuit)
return 0;
if (_vm->_quit)
return _rtl;
// initCharacter();
_input->_inputMode = Input::kInputModeGame;
while ((_engineFlags & (kEngineReturn | kEngineQuit)) == 0) {
while (((_engineFlags & kEngineReturn) == 0) && (!_vm->_quit)) {
runGame();
}
_engineFlags &= ~kEngineReturn;
@ -125,7 +125,7 @@ int Parallaction_br::go() {
}
return 0;
return _rtl;
}

View File

@ -236,20 +236,20 @@ int Parallaction_ns::go() {
guiStart();
if (_engineFlags & kEngineQuit)
return 0;
if (_vm->_quit)
return _rtl;
changeLocation(_location._name);
if (_engineFlags & kEngineQuit)
return 0;
if (_vm->_quit)
return _rtl;
_input->_inputMode = Input::kInputModeGame;
while ((_engineFlags & kEngineQuit) == 0) {
while (!_vm->_quit) {
runGame();
}
return 0;
return _rtl;
}
void Parallaction_ns::switchBackground(const char* background, const char* mask) {
@ -454,13 +454,13 @@ void Parallaction_ns::cleanupGame() {
memset(_locationNames, 0, sizeof(_locationNames));
// this flag tells freeZones to unconditionally remove *all* Zones
_engineFlags |= kEngineQuit;
_vm->_quit = true;
freeZones();
freeAnimations();
// this dangerous flag can now be cleared
_engineFlags &= ~kEngineQuit;
_vm->_quit = false;
// main character animation is restored
_location._animations.push_front(_char._ani);

View File

@ -132,11 +132,13 @@ void Parallaction_ns::doLoadGame(uint16 slot) {
// TODO (LIST): unify (and parametrize) calls to freeZones.
// We aren't calling freeAnimations because it is not needed, since
// kChangeLocation will trigger a complete deletion. Anyway, we still
// need to invoke freeZones here with kEngineQuit set, because the
// need to invoke freeZones here with _quit set, because the
// call in changeLocation preserve certain zones.
_engineFlags |= kEngineQuit;
_quit = true;
freeZones();
_engineFlags &= ~kEngineQuit;
_quit = false;
_numLocations = atoi(s);