diff options
author | Walter van Niftrik | 2016-03-06 13:36:35 +0100 |
---|---|---|
committer | Walter van Niftrik | 2016-03-09 10:03:13 +0100 |
commit | a73dcdf224ae88c7bcf73d754781052835af4cd0 (patch) | |
tree | 32cbc11bc95fb795c6df90eca3183cf0f464a281 /engines/adl/adl.cpp | |
parent | af42795ffa9331a16c1c6fa819f5c3960fd3cfe1 (diff) | |
download | scummvm-rg350-a73dcdf224ae88c7bcf73d754781052835af4cd0.tar.gz scummvm-rg350-a73dcdf224ae88c7bcf73d754781052835af4cd0.tar.bz2 scummvm-rg350-a73dcdf224ae88c7bcf73d754781052835af4cd0.zip |
ADL: Move functionality into base class
Diffstat (limited to 'engines/adl/adl.cpp')
-rw-r--r-- | engines/adl/adl.cpp | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp index c395fbb81b..701f902ade 100644 --- a/engines/adl/adl.cpp +++ b/engines/adl/adl.cpp @@ -72,6 +72,8 @@ bool AdlEngine::hasFeature(EngineFeature f) const { Common::Error AdlEngine::run() { _display = new Display(); + loadData(); + int saveSlot = ConfMan.getInt("save_slot"); if (saveSlot >= 0) { if (loadGameState(saveSlot).getCode() != Common::kNoError) @@ -83,7 +85,54 @@ Common::Error AdlEngine::run() { initState(); } - runGame(); + _display->setMode(DISPLAY_MODE_MIXED); + printASCIIString("\r\r\r\r\r"); + + while (1) { + uint verb = 0, noun = 0; + + // When restoring from the launcher, we don't read + // input on the first iteration. This is needed to + // ensure that restoring from the launcher and + // restoring in-game brings us to the same game state. + // (Also see comment below.) + if (!_isRestoring) { + clearScreen(); + showRoom(); + + _canSaveNow = _canRestoreNow = true; + getInput(verb, noun); + _canSaveNow = _canRestoreNow = false; + + if (shouldQuit()) + break; + + if (!doOneCommand(_roomCommands, verb, noun)) + printEngineMessage(IDI_MSG_DONT_UNDERSTAND); + } + + if (_isRestoring) { + // We restored from the GMM or launcher. As restoring + // with "RESTORE GAME" does not end command processing, + // we don't break it off here either. This essentially + // means that restoring a game will always run through + // the global commands and increase the move counter + // before the first user input. + printASCIIString("\r"); + _isRestoring = false; + verb = _restoreVerb; + noun = _restoreNoun; + } + + // Restarting does end command processing + if (_isRestarting) { + _isRestarting = false; + continue; + } + + doAllCommands(_globalCommands, verb, noun); + _state.moves++; + } return Common::kNoError; } |