diff options
Diffstat (limited to 'engines/scumm/scumm.cpp')
-rw-r--r-- | engines/scumm/scumm.cpp | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index cc7e01fca7..2f0593dca8 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -109,7 +109,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _language(dr.language), _debugger(0), _currentScript(0xFF), // Let debug() work on init stage - _pauseDialog(0), _scummMenuDialog(0), _versionDialog(0) { + _pauseDialog(0), _mainMenuDialog(0), _versionDialog(0) { if (_game.platform == Common::kPlatformNES) { _gdi = new GdiNES(this); @@ -143,8 +143,9 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _objs = NULL; _sound = NULL; memset(&vm, 0, sizeof(vm)); + _quit = false; _pauseDialog = NULL; - _scummMenuDialog = NULL; + _mainMenuDialog = NULL; _versionDialog = NULL; _fastMode = 0; _actors = NULL; @@ -560,7 +561,7 @@ ScummEngine::~ScummEngine() { delete _2byteFontPtr; delete _charset; delete _pauseDialog; - delete _scummMenuDialog; + delete _mainMenuDialog; delete _versionDialog; delete _fileHandle; @@ -814,6 +815,7 @@ ScummEngine_vCUPhe::ScummEngine_vCUPhe(OSystem *syst, const DetectorResult &dr) _syst = syst; _game = dr.game; _filenamePattern = dr.fp, + _quit = false; _cupPlayer = new CUP_Player(syst, this, _mixer); } @@ -844,6 +846,9 @@ void ScummEngine_vCUPhe::parseEvents() { while (_eventMan->pollEvent(event)) { switch (event.type) { + case Common::EVENT_QUIT: + _quit = true; + break; default: break; @@ -1103,7 +1108,7 @@ int ScummEngine::init() { if (_game.version >= 5 && _game.version <= 7) _sound->setupSound(); - syncSoundSettings(); + updateSoundSettings(); return 0; } @@ -1662,7 +1667,7 @@ void ScummEngine::setupMusic(int midi) { } } -void ScummEngine::syncSoundSettings() { +void ScummEngine::updateSoundSettings() { // Sync the engine with the config manager int soundVolumeMusic = ConfMan.getInt("music_volume"); @@ -1716,7 +1721,7 @@ int ScummEngine::go() { int diff = 0; // Duration of one loop iteration - while (!quit()) { + while (!_quit) { if (_debugger->isAttached()) _debugger->onFrame(); @@ -1749,12 +1754,12 @@ int ScummEngine::go() { diff = _system->getMillis() - diff; - if (quit()) { + if (_quit) { // TODO: Maybe perform an autosave on exit? } } - return _eventMan->shouldRTL(); + return 0; } void ScummEngine::waitForTimer(int msec_delay) { @@ -1767,7 +1772,7 @@ void ScummEngine::waitForTimer(int msec_delay) { start_time = _system->getMillis(); - while (!quit()) { + while (!_quit) { _sound->updateCD(); // Loop CD Audio if needed parseEvents(); _system->updateScreen(); @@ -1890,7 +1895,7 @@ load_game: checkExecVerbs(); checkAndRunSentenceScript(); - if (quit()) + if (_quit) return; // HACK: If a load was requested, immediately perform it. This avoids @@ -2155,6 +2160,10 @@ void ScummEngine::pauseGame() { pauseDialog(); } +void ScummEngine::shutDown() { + _quit = true; +} + void ScummEngine::restart() { // TODO: Check this function - we should probably be reinitting a lot more stuff, and I suspect // this leaks memory like a sieve @@ -2296,18 +2305,18 @@ void ScummEngine::versionDialog() { runDialog(*_versionDialog); } -void ScummEngine::scummMenuDialog() { - if (!_scummMenuDialog) - _scummMenuDialog = new ScummMenuDialog(this); - runDialog(*_scummMenuDialog); - syncSoundSettings(); +void ScummEngine::mainMenuDialog() { + if (!_mainMenuDialog) + _mainMenuDialog = new MainMenuDialog(this); + runDialog(*_mainMenuDialog); + updateSoundSettings(); } void ScummEngine::confirmExitDialog() { ConfirmDialog d(this, 6); if (runDialog(d)) { - quitGame(); + _quit = true; } } |