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

View file

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

View file

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

View file

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

View file

@ -331,7 +331,7 @@ void Parallaction::processInput(InputData *data) {
break; break;
case kEvQuitGame: case kEvQuitGame:
_engineFlags |= kEngineQuit; _vm->_quit = true;
break; break;
case kEvSaveGame: case kEvSaveGame:
@ -358,19 +358,19 @@ void Parallaction::runGame() {
processInput(data); processInput(data);
} }
if (_engineFlags & kEngineQuit) if (_vm->_quit)
return; return;
runPendingZones(); runPendingZones();
if (_engineFlags & kEngineQuit) if (_vm->_quit)
return; return;
if (_engineFlags & kEngineChangeLocation) { if (_engineFlags & kEngineChangeLocation) {
changeLocation(_location._name); changeLocation(_location._name);
} }
if (_engineFlags & kEngineQuit) if (_vm->_quit)
return; return;
_gfx->beginFrame(); _gfx->beginFrame();
@ -466,7 +466,7 @@ ZonePtr Parallaction::findZone(const char *name) {
void Parallaction::freeZones() { 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(); 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 // 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. // to retain special - needed - zones that were lost across location switches.
ZonePtr z = *it; 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); debugC(2, kDebugExec, "freeZones preserving zone '%s'", z->_name);
it++; it++;
} else { } else {

View file

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

View file

@ -105,17 +105,17 @@ int Parallaction_br::go() {
guiSplash("dyna"); guiSplash("dyna");
guiSplash("core"); guiSplash("core");
while ((_engineFlags & kEngineQuit) == 0) { while (_vm->_quit == 0) {
guiStart(); guiStart();
if (_engineFlags & kEngineQuit) if (_vm->_quit)
return 0; return _rtl;
// initCharacter(); // initCharacter();
_input->_inputMode = Input::kInputModeGame; _input->_inputMode = Input::kInputModeGame;
while ((_engineFlags & (kEngineReturn | kEngineQuit)) == 0) { while (((_engineFlags & kEngineReturn) == 0) && (!_vm->_quit)) {
runGame(); runGame();
} }
_engineFlags &= ~kEngineReturn; _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(); guiStart();
if (_engineFlags & kEngineQuit) if (_vm->_quit)
return 0; return _rtl;
changeLocation(_location._name); changeLocation(_location._name);
if (_engineFlags & kEngineQuit) if (_vm->_quit)
return 0; return _rtl;
_input->_inputMode = Input::kInputModeGame; _input->_inputMode = Input::kInputModeGame;
while ((_engineFlags & kEngineQuit) == 0) { while (!_vm->_quit) {
runGame(); runGame();
} }
return 0; return _rtl;
} }
void Parallaction_ns::switchBackground(const char* background, const char* mask) { void Parallaction_ns::switchBackground(const char* background, const char* mask) {
@ -454,13 +454,13 @@ void Parallaction_ns::cleanupGame() {
memset(_locationNames, 0, sizeof(_locationNames)); memset(_locationNames, 0, sizeof(_locationNames));
// this flag tells freeZones to unconditionally remove *all* Zones // this flag tells freeZones to unconditionally remove *all* Zones
_engineFlags |= kEngineQuit; _vm->_quit = true;
freeZones(); freeZones();
freeAnimations(); freeAnimations();
// this dangerous flag can now be cleared // this dangerous flag can now be cleared
_engineFlags &= ~kEngineQuit; _vm->_quit = false;
// main character animation is restored // main character animation is restored
_location._animations.push_front(_char._ani); _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. // TODO (LIST): unify (and parametrize) calls to freeZones.
// We aren't calling freeAnimations because it is not needed, since // We aren't calling freeAnimations because it is not needed, since
// kChangeLocation will trigger a complete deletion. Anyway, we still // 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. // call in changeLocation preserve certain zones.
_engineFlags |= kEngineQuit; _quit = true;
freeZones(); freeZones();
_engineFlags &= ~kEngineQuit;
_quit = false;
_numLocations = atoi(s); _numLocations = atoi(s);