diff options
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/dialogs.cpp | 12 | ||||
-rw-r--r-- | engines/scumm/dialogs.h | 6 | ||||
-rw-r--r-- | engines/scumm/he/cup_player_he.cpp | 6 | ||||
-rw-r--r-- | engines/scumm/he/script_v100he.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/he/script_v70he.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/he/script_v72he.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/input.cpp | 8 | ||||
-rw-r--r-- | engines/scumm/resource.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/saveload.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/script_v5.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/script_v6.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/script_v8.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 41 | ||||
-rw-r--r-- | engines/scumm/scumm.h | 10 | ||||
-rw-r--r-- | engines/scumm/smush/smush_player.cpp | 2 |
15 files changed, 46 insertions, 63 deletions
diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp index e4e2b2b620..cb9113fe65 100644 --- a/engines/scumm/dialogs.cpp +++ b/engines/scumm/dialogs.cpp @@ -442,7 +442,7 @@ Common::StringList generateSavegameList(ScummEngine *scumm, bool saveMode) { return descriptions; } -MainMenuDialog::MainMenuDialog(ScummEngine *scumm) +ScummMenuDialog::ScummMenuDialog(ScummEngine *scumm) : ScummDialog("scummmain"), _vm(scumm) { new GUI::ButtonWidget(this, "scummmain_resume", "Resume", kPlayCmd, 'P'); @@ -470,7 +470,7 @@ MainMenuDialog::MainMenuDialog(ScummEngine *scumm) _loadDialog = new SaveLoadChooser("Load game:", "Load", false, scumm); } -MainMenuDialog::~MainMenuDialog() { +ScummMenuDialog::~ScummMenuDialog() { delete _aboutDialog; delete _optionsDialog; #ifndef DISABLE_HELP @@ -480,7 +480,7 @@ MainMenuDialog::~MainMenuDialog() { delete _loadDialog; } -void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { +void ScummMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { switch (cmd) { case kSaveCmd: save(); @@ -503,7 +503,7 @@ void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat break; #endif case kQuitCmd: - _vm->_quit = true; + _vm->quitGame(); close(); break; default: @@ -511,7 +511,7 @@ void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat } } -void MainMenuDialog::save() { +void ScummMenuDialog::save() { int idx; _saveDialog->setList(generateSavegameList(_vm, true)); idx = _saveDialog->runModal(); @@ -530,7 +530,7 @@ void MainMenuDialog::save() { } } -void MainMenuDialog::load() { +void ScummMenuDialog::load() { int idx; _loadDialog->setList(generateSavegameList(_vm, false)); idx = _loadDialog->runModal(); diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h index 0d04d8faea..3837787a3b 100644 --- a/engines/scumm/dialogs.h +++ b/engines/scumm/dialogs.h @@ -82,10 +82,10 @@ public: virtual void reflowLayout(); }; -class MainMenuDialog : public ScummDialog { +class ScummMenuDialog : public ScummDialog { public: - MainMenuDialog(ScummEngine *scumm); - ~MainMenuDialog(); + ScummMenuDialog(ScummEngine *scumm); + ~ScummMenuDialog(); virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); protected: diff --git a/engines/scumm/he/cup_player_he.cpp b/engines/scumm/he/cup_player_he.cpp index e611c85e9d..685bd00065 100644 --- a/engines/scumm/he/cup_player_he.cpp +++ b/engines/scumm/he/cup_player_he.cpp @@ -99,7 +99,7 @@ void CUP_Player::play() { debug(1, "rate %d width %d height %d", _playbackRate, _width, _height); int ticks = _system->getMillis(); - while (_dataSize != 0 && !_vm->_quit) { + while (_dataSize != 0 && !_vm->quit()) { while (parseNextBlockTag(_fileStream)) { if (_fileStream.ioFailed()) { return; @@ -190,7 +190,7 @@ void CUP_Player::waitForSfxChannel(int channel) { CUP_SfxChannel *sfxChannel = &_sfxChannels[channel]; debug(1, "waitForSfxChannel %d", channel); if ((sfxChannel->flags & kSfxFlagLoop) == 0) { - while (_mixer->isSoundHandleActive(sfxChannel->handle) && !_vm->_quit) { + while (_mixer->isSoundHandleActive(sfxChannel->handle) && !_vm->quit()) { _vm->parseEvents(); _system->delayMillis(10); } @@ -496,7 +496,7 @@ void CUP_Player::handleTOIL(Common::SeekableReadStream &dataStream, uint32 dataS for (int i = 0; i < kSfxChannels; ++i) { waitForSfxChannel(i); } - _vm->_quit = true; + _vm->quitGame(); break; case 7: { int channelSync = dataStream.readUint32LE(); diff --git a/engines/scumm/he/script_v100he.cpp b/engines/scumm/he/script_v100he.cpp index f72701c229..5f907d7f04 100644 --- a/engines/scumm/he/script_v100he.cpp +++ b/engines/scumm/he/script_v100he.cpp @@ -2147,10 +2147,10 @@ void ScummEngine_v100he::o100_systemOps() { break; case 71: // Confirm shutdown - shutDown(); + quitGame(); break; case 72: - shutDown(); + quitGame(); break; case 73: copyScriptString(string, sizeof(string)); diff --git a/engines/scumm/he/script_v70he.cpp b/engines/scumm/he/script_v70he.cpp index 3f22c16648..c7256835eb 100644 --- a/engines/scumm/he/script_v70he.cpp +++ b/engines/scumm/he/script_v70he.cpp @@ -634,10 +634,10 @@ void ScummEngine_v70he::o70_systemOps() { break; case 160: // Confirm shutdown - shutDown(); + quitGame(); break; case 244: - shutDown(); + quitGame(); break; case 250: id = pop(); diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp index df3d857642..6f68d56693 100644 --- a/engines/scumm/he/script_v72he.cpp +++ b/engines/scumm/he/script_v72he.cpp @@ -1485,10 +1485,10 @@ void ScummEngine_v72he::o72_systemOps() { break; case 160: // Confirm shutdown - shutDown(); + quitGame(); break; case 244: - shutDown(); + quitGame(); break; case 251: copyScriptString(string, sizeof(string)); diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp index 35028c7e1c..cc98cc00ae 100644 --- a/engines/scumm/input.cpp +++ b/engines/scumm/input.cpp @@ -192,10 +192,6 @@ void ScummEngine::parseEvents() { _keyPressed = Common::KeyState(Common::KEYCODE_6, 54); // '6' break; - case Common::EVENT_QUIT: - _quit = true; - break; - default: break; } @@ -475,7 +471,7 @@ void ScummEngine::processKeyboard(Common::KeyState lastKeyHit) { if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0) runScript(VAR(VAR_SAVELOAD_SCRIPT), 0, 0, 0); - mainMenuDialog(); // Display NewGui + scummMenuDialog(); // Display NewGui if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0) runScript(VAR(VAR_SAVELOAD_SCRIPT2), 0, 0, 0); @@ -514,7 +510,7 @@ void ScummEngine::processKeyboard(Common::KeyState lastKeyHit) { vol = Audio::Mixer::kMaxMixerVolume; ConfMan.setInt("music_volume", vol); - updateSoundSettings(); + syncSoundSettings(); } else if (lastKeyHit.ascii == '-' || lastKeyHit.ascii == '+') { // Change text speed if (lastKeyHit.ascii == '+' && _defaultTalkDelay > 0) diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp index acdc2bc222..8f7617885a 100644 --- a/engines/scumm/resource.cpp +++ b/engines/scumm/resource.cpp @@ -291,7 +291,7 @@ void ScummEngine::readIndexFile() { if (checkTryMedia(_fileHandle)) { displayMessage(NULL, "You're trying to run game encrypted by ActiveMark. This is not supported."); - _quit = true; + quitGame(); return; } diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index f9e4eb415c..5894e837aa 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -275,7 +275,7 @@ bool ScummEngine::loadState(int slot, bool compat) { delete in; // Update volume settings - updateSoundSettings(); + syncSoundSettings(); // Init NES costume data if (_game.platform == Common::kPlatformNES) { diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp index 431321f459..1d90b5e4af 100644 --- a/engines/scumm/script_v5.cpp +++ b/engines/scumm/script_v5.cpp @@ -1769,7 +1769,7 @@ void ScummEngine_v5::o5_systemOps() { pauseGame(); break; case 3: // SO_QUIT - shutDown(); + quitGame(); break; default: error("o5_systemOps: unknown subopcode %d", subOp); diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp index 04ea53137b..f8502cbbe7 100644 --- a/engines/scumm/script_v6.cpp +++ b/engines/scumm/script_v6.cpp @@ -2310,7 +2310,7 @@ void ScummEngine_v6::o6_systemOps() { pauseGame(); break; case 160: // SO_QUIT - shutDown(); + quitGame(); break; default: error("o6_systemOps invalid case %d", subOp); diff --git a/engines/scumm/script_v8.cpp b/engines/scumm/script_v8.cpp index 08629afb07..63e54417a9 100644 --- a/engines/scumm/script_v8.cpp +++ b/engines/scumm/script_v8.cpp @@ -1170,7 +1170,7 @@ void ScummEngine_v8::o8_systemOps() { restart(); break; case 0x29: // SO_SYSTEM_QUIT Quit game - shutDown(); + quitGame(); break; default: error("o8_systemOps: invalid case 0x%x", subOp); @@ -1289,7 +1289,7 @@ void ScummEngine_v8::o8_kernelSetFunctions() { if (ConfMan.getBool("confirm_exit")) confirmExitDialog(); else - _quit = true; + quitGame(); break; case 108: // buildPaletteShadow setShadowPalette(args[1], args[2], args[3], args[4], args[5], args[6]); diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 2f0593dca8..cc7e01fca7 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), _mainMenuDialog(0), _versionDialog(0) { + _pauseDialog(0), _scummMenuDialog(0), _versionDialog(0) { if (_game.platform == Common::kPlatformNES) { _gdi = new GdiNES(this); @@ -143,9 +143,8 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _objs = NULL; _sound = NULL; memset(&vm, 0, sizeof(vm)); - _quit = false; _pauseDialog = NULL; - _mainMenuDialog = NULL; + _scummMenuDialog = NULL; _versionDialog = NULL; _fastMode = 0; _actors = NULL; @@ -561,7 +560,7 @@ ScummEngine::~ScummEngine() { delete _2byteFontPtr; delete _charset; delete _pauseDialog; - delete _mainMenuDialog; + delete _scummMenuDialog; delete _versionDialog; delete _fileHandle; @@ -815,7 +814,6 @@ 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); } @@ -846,9 +844,6 @@ void ScummEngine_vCUPhe::parseEvents() { while (_eventMan->pollEvent(event)) { switch (event.type) { - case Common::EVENT_QUIT: - _quit = true; - break; default: break; @@ -1108,7 +1103,7 @@ int ScummEngine::init() { if (_game.version >= 5 && _game.version <= 7) _sound->setupSound(); - updateSoundSettings(); + syncSoundSettings(); return 0; } @@ -1667,7 +1662,7 @@ void ScummEngine::setupMusic(int midi) { } } -void ScummEngine::updateSoundSettings() { +void ScummEngine::syncSoundSettings() { // Sync the engine with the config manager int soundVolumeMusic = ConfMan.getInt("music_volume"); @@ -1721,7 +1716,7 @@ int ScummEngine::go() { int diff = 0; // Duration of one loop iteration - while (!_quit) { + while (!quit()) { if (_debugger->isAttached()) _debugger->onFrame(); @@ -1754,12 +1749,12 @@ int ScummEngine::go() { diff = _system->getMillis() - diff; - if (_quit) { + if (quit()) { // TODO: Maybe perform an autosave on exit? } } - return 0; + return _eventMan->shouldRTL(); } void ScummEngine::waitForTimer(int msec_delay) { @@ -1772,7 +1767,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(); @@ -1895,7 +1890,7 @@ load_game: checkExecVerbs(); checkAndRunSentenceScript(); - if (_quit) + if (quit()) return; // HACK: If a load was requested, immediately perform it. This avoids @@ -2160,10 +2155,6 @@ 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 @@ -2305,18 +2296,18 @@ void ScummEngine::versionDialog() { runDialog(*_versionDialog); } -void ScummEngine::mainMenuDialog() { - if (!_mainMenuDialog) - _mainMenuDialog = new MainMenuDialog(this); - runDialog(*_mainMenuDialog); - updateSoundSettings(); +void ScummEngine::scummMenuDialog() { + if (!_scummMenuDialog) + _scummMenuDialog = new ScummMenuDialog(this); + runDialog(*_scummMenuDialog); + syncSoundSettings(); } void ScummEngine::confirmExitDialog() { ConfirmDialog d(this, 6); if (runDialog(d)) { - _quit = true; + quitGame(); } } diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 20824ffe74..b1ab9f7386 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -462,7 +462,7 @@ protected: virtual void loadLanguageBundle() {} void loadCJKFont(); void setupMusic(int midi); - void updateSoundSettings(); + virtual void syncSoundSettings(); void setTalkspeed(int talkspeed); int getTalkspeed(); @@ -496,22 +496,18 @@ protected: public: void pauseGame(); void restart(); - void shutDown(); - - /** We keep running until this is set to true. */ - bool _quit; protected: Dialog *_pauseDialog; Dialog *_versionDialog; - Dialog *_mainMenuDialog; + Dialog *_scummMenuDialog; virtual int runDialog(Dialog &dialog); void confirmExitDialog(); void confirmRestartDialog(); void pauseDialog(); void versionDialog(); - void mainMenuDialog(); + void scummMenuDialog(); char displayMessage(const char *altButton, const char *message, ...); diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp index 494357a90c..850b547021 100644 --- a/engines/scumm/smush/smush_player.cpp +++ b/engines/scumm/smush/smush_player.cpp @@ -1333,7 +1333,7 @@ void SmushPlayer::play(const char *filename, int32 speed, int32 offset, int32 st } if (_endOfFile) break; - if (_vm->_quit || _vm->_saveLoadFlag || _vm->_smushVideoShouldFinish) { + if (_vm->quit() || _vm->_saveLoadFlag || _vm->_smushVideoShouldFinish) { _smixer->stop(); _vm->_mixer->stopHandle(_compressedFileSoundHandle); _vm->_mixer->stopHandle(_IACTchannel); |