diff options
Diffstat (limited to 'engines/parallaction')
-rw-r--r-- | engines/parallaction/dialogue.cpp | 4 | ||||
-rw-r--r-- | engines/parallaction/exec_ns.cpp | 11 | ||||
-rw-r--r-- | engines/parallaction/gui_br.cpp | 3 | ||||
-rw-r--r-- | engines/parallaction/input.cpp | 4 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 23 | ||||
-rw-r--r-- | engines/parallaction/parallaction.h | 8 | ||||
-rw-r--r-- | engines/parallaction/parallaction_br.cpp | 10 | ||||
-rw-r--r-- | engines/parallaction/parallaction_ns.cpp | 16 | ||||
-rw-r--r-- | engines/parallaction/saveload.cpp | 8 | ||||
-rw-r--r-- | engines/parallaction/sound.cpp | 3 |
10 files changed, 58 insertions, 32 deletions
diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp index 290f8cfd4f..96491bf084 100644 --- a/engines/parallaction/dialogue.cpp +++ b/engines/parallaction/dialogue.cpp @@ -260,6 +260,9 @@ int16 DialogueManager::selectAnswerN() { _vm->_balloonMan->setBalloonText(_oldSelection, _q->_answers[_visAnswers[_oldSelection]]->_text, 3); } + if (_vm->quit()) + return -1; + if (_selection != -1) { _vm->_balloonMan->setBalloonText(_selection, _q->_answers[_visAnswers[_selection]]->_text, 0); _vm->_gfx->setItemFrame(0, _q->_answers[_visAnswers[_selection]]->_mood & 0xF); @@ -333,7 +336,6 @@ void DialogueManager::nextQuestion() { } } - void DialogueManager::run() { // cache event data diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp index 9cde27a853..913e7ae648 100644 --- a/engines/parallaction/exec_ns.cpp +++ b/engines/parallaction/exec_ns.cpp @@ -310,7 +310,8 @@ DECLARE_COMMAND_OPCODE(drop){ DECLARE_COMMAND_OPCODE(quit) { - _engineFlags |= kEngineQuit; + _vm->_quit = true; + _vm->quitGame(); } @@ -436,11 +437,15 @@ void CommandExec::run(CommandList& list, ZonePtr z) { CommandList::iterator it = list.begin(); for ( ; it != list.end(); it++) { - if (_engineFlags & kEngineQuit) + + if (_vm->quit()) break; CommandPtr cmd = *it; + if (_vm->quit()) + break; + if (cmd->_flagsOn & kFlagsGlobal) { useFlags = _commandFlags | kFlagsGlobal; useLocalFlags = false; @@ -539,7 +544,7 @@ uint16 Parallaction::runZone(ZonePtr z) { break; case kZoneHear: - _soundMan->playSfx(z->u.hear->_name, z->u.hear->_channel, (z->_flags & kFlagsLooping) == kFlagsLooping, 60); + _soundMan->playSfx(z->u.hear->_name, z->u.hear->_channel, (z->_flags & kFlagsLooping) == kFlagsLooping); break; case kZoneSpeak: diff --git a/engines/parallaction/gui_br.cpp b/engines/parallaction/gui_br.cpp index 0be070e345..391459a12f 100644 --- a/engines/parallaction/gui_br.cpp +++ b/engines/parallaction/gui_br.cpp @@ -50,7 +50,8 @@ void Parallaction_br::guiStart() { int option = guiShowMenu(); switch (option) { case kMenuQuit: - _engineFlags |= kEngineQuit; + _quit = true; + _vm->quitGame(); break; case kMenuLoadGame: diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp index 9601ae3b36..d625199e2b 100644 --- a/engines/parallaction/input.cpp +++ b/engines/parallaction/input.cpp @@ -80,9 +80,9 @@ uint16 Input::readInput() { case Common::EVENT_MOUSEMOVE: _mousePos = e.mouse; break; - + case Common::EVENT_RTL: case Common::EVENT_QUIT: - _engineFlags |= kEngineQuit; + _vm->_quit = true; return KeyDown; default: diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index cd852f7c84..fff50b48df 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -120,6 +120,8 @@ int Parallaction::init() { _location._comment = NULL; _location._endComment = NULL; + _quit = false; + _pathBuffer = 0; _screenSize = _screenWidth * _screenHeight; @@ -137,6 +139,7 @@ int Parallaction::init() { _debugger = new Debugger(this); setupBalloonManager(); + syncSoundSettings(); return 0; } @@ -334,7 +337,8 @@ void Parallaction::processInput(InputData *data) { break; case kEvQuitGame: - _engineFlags |= kEngineQuit; + _quit = true; + _vm->quitGame(); break; case kEvSaveGame: @@ -357,7 +361,7 @@ void Parallaction::processInput(InputData *data) { void Parallaction::runGame() { InputData *data = _input->updateInput(); - if (_engineFlags & kEngineQuit) + if (_vm->quit()) return; if (_input->_inputMode == Input::kInputModeDialogue) { @@ -367,13 +371,13 @@ void Parallaction::runGame() { processInput(data); } - if (_engineFlags & kEngineQuit) + if (_vm->quit()) return; runPendingZones(); - if (_engineFlags & kEngineQuit) - return; + if (_vm->quit()) + return; if (_engineFlags & kEngineChangeLocation) { changeLocation(_location._name); @@ -476,7 +480,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(); @@ -485,7 +489,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 { @@ -499,6 +503,11 @@ void Parallaction::freeZones() { return; } +void Parallaction::syncSoundSettings() { + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume") / 6); + _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume")); +} enum { WALK_LEFT = 0, diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index c45d32b013..115099addd 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -99,7 +99,6 @@ enum { }; enum EngineFlags { - kEngineQuit = (1 << 0), kEnginePauseJobs = (1 << 1), kEngineInventory = (1 << 2), kEngineWalking = (1 << 3), @@ -258,6 +257,11 @@ public: virtual bool loadGame() = 0; virtual bool saveGame() = 0; + bool _quit; /* The only reason this flag exists is for freeZones() to properly + * delete all zones when necessary. THIS FLAG IS NOT THE ENGINE QUIT FLAG, + * use _eventMan->shouldQuit() for that. + */ + Input *_input; void processInput(InputData* data); @@ -265,6 +269,8 @@ public: void pauseJobs(); void resumeJobs(); + virtual void syncSoundSettings(); + void finalizeWalk(Character &character); int16 selectWalkFrame(Character &character, const Common::Point& pos, const WalkNodePtr to); void clipMove(Common::Point& pos, const Common::Point& to); diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp index 9e2a0f10f1..0c8058e4bd 100644 --- a/engines/parallaction/parallaction_br.cpp +++ b/engines/parallaction/parallaction_br.cpp @@ -112,17 +112,17 @@ int Parallaction_br::go() { guiSplash("dyna"); guiSplash("core"); - while ((_engineFlags & kEngineQuit) == 0) { + while (quit() == 0) { guiStart(); - if (_engineFlags & kEngineQuit) - return 0; + if (quit()) + return _eventMan->shouldRTL(); // initCharacter(); _input->_inputMode = Input::kInputModeGame; - while ((_engineFlags & (kEngineReturn | kEngineQuit)) == 0) { + while (((_engineFlags & kEngineReturn) == 0) && (!quit())) { runGame(); } _engineFlags &= ~kEngineReturn; @@ -132,7 +132,7 @@ int Parallaction_br::go() { } - return 0; + return _eventMan->shouldRTL(); } diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp index 9e925d1e1d..e8264238a1 100644 --- a/engines/parallaction/parallaction_ns.cpp +++ b/engines/parallaction/parallaction_ns.cpp @@ -242,20 +242,20 @@ int Parallaction_ns::go() { guiStart(); - if (_engineFlags & kEngineQuit) - return 0; + if (quit()) + return _eventMan->shouldRTL(); changeLocation(_location._name); - if (_engineFlags & kEngineQuit) - return 0; + if (quit()) + return _eventMan->shouldRTL(); _input->_inputMode = Input::kInputModeGame; - while ((_engineFlags & kEngineQuit) == 0) { + while (!quit()) { runGame(); } - return 0; + return _eventMan->shouldRTL(); } void Parallaction_ns::switchBackground(const char* background, const char* mask) { @@ -465,13 +465,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); diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp index 002295315d..86700d6bb1 100644 --- a/engines/parallaction/saveload.cpp +++ b/engines/parallaction/saveload.cpp @@ -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); diff --git a/engines/parallaction/sound.cpp b/engines/parallaction/sound.cpp index df6867a90c..4ac1399c3a 100644 --- a/engines/parallaction/sound.cpp +++ b/engines/parallaction/sound.cpp @@ -387,7 +387,8 @@ void AmigaSoundMan::playSfx(const char *filename, uint channel, bool looping, in rate = ch->header.samplesPerSec; } - _mixer->playRaw(Audio::Mixer::kSFXSoundType, &ch->handle, ch->data, ch->dataSize, rate, flags, -1, volume, 0, loopStart, loopEnd); + _mixer->playRaw(Audio::Mixer::kSFXSoundType, &ch->handle, ch->data, ch->dataSize, rate, flags, -1, + Audio::Mixer::kMaxChannelVolume, 0, loopStart, loopEnd); } void AmigaSoundMan::stopSfx(uint channel) { |