diff options
author | Paul Gilbert | 2015-03-07 17:01:07 -0500 |
---|---|---|
committer | Paul Gilbert | 2015-03-07 17:01:07 -0500 |
commit | c80c74e49926daed108f73e115fda7ba5901eb61 (patch) | |
tree | 9a8eb56a34d1b7f0908271e405f7f7bc3fa53d9c | |
parent | a22d7f2d5f27701766dbf36d50e0a31ea7b26d69 (diff) | |
download | scummvm-rg350-c80c74e49926daed108f73e115fda7ba5901eb61.tar.gz scummvm-rg350-c80c74e49926daed108f73e115fda7ba5901eb61.tar.bz2 scummvm-rg350-c80c74e49926daed108f73e115fda7ba5901eb61.zip |
MADS: Refactoring of text/animation views to show outside game loop
-rw-r--r-- | engines/mads/game.cpp | 25 | ||||
-rw-r--r-- | engines/mads/nebular/game_nebular.cpp | 56 | ||||
-rw-r--r-- | engines/mads/nebular/menu_nebular.cpp | 2 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes8.cpp | 6 |
4 files changed, 50 insertions, 39 deletions
diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 3b8b053fec..74c2a3f416 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -105,8 +105,6 @@ Game::~Game() { } void Game::run() { - initializeGlobals(); - // If requested, load a savegame instead of showing the intro if (ConfMan.hasKey("save_slot")) { int saveSlot = ConfMan.getInt("save_slot"); @@ -116,15 +114,19 @@ void Game::run() { _statusFlag = true; - if (_loadGameSlot == -1) { - startGame(); - } + while (!_vm->shouldQuit()) { + initializeGlobals(); - // Get the initial starting time for the first scene - _scene._frameStartTime = _vm->_events->getFrameCounter(); + if (_loadGameSlot == -1) { + startGame(); + } + + // Get the initial starting time for the first scene + _scene._frameStartTime = _vm->_events->getFrameCounter(); - if (!_vm->shouldQuit()) - gameLoop(); + if (!_vm->shouldQuit()) + gameLoop(); + } } void Game::splitQuote(const Common::String &source, Common::String &line1, Common::String &line2) { @@ -140,7 +142,7 @@ void Game::splitQuote(const Common::String &source, Common::String &line1, Commo } void Game::gameLoop() { - while (!_vm->shouldQuit() && _statusFlag) { + while (!_vm->shouldQuit() && _statusFlag && !_winStatus) { if (_loadGameSlot != -1) { loadGame(_loadGameSlot); _loadGameSlot = -1; @@ -168,7 +170,8 @@ void Game::gameLoop() { } void Game::sectionLoop() { - while (!_vm->shouldQuit() && _statusFlag && (_sectionNumber == _currentSectionNumber)) { + while (!_vm->shouldQuit() && _statusFlag && !_winStatus && + (_sectionNumber == _currentSectionNumber)) { _kernelMode = KERNEL_ROOM_PRELOAD; _player._spritesChanged = true; _quoteEmergency = false; diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 965ef7fad2..8c8d4ab974 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -61,6 +61,35 @@ ProtectionResult GameNebular::checkCopyProtection() { } void GameNebular::startGame() { + // First handle any ending credits from a just finished game session. + // Note that, with the exception of the decompression ending, which doesn't + // use animations, the remaining animations will automatically launch their + // own text view credits when the animation is completed + switch (_winStatus) { + case 1: + // No shields failure ending + AnimationView::execute(_vm, "rexend1"); + break; + case 2: + // Shields, but no targetting failure ending + AnimationView::execute(_vm, "rexend2"); + break; + case 3: + // Completed game successfully, so activate quotes item on the main menu + ConfMan.setBool("ShowQuotes", true); + ConfMan.flushToDisk(); + + AnimationView::execute(_vm, "rexend3"); + break; + case 4: + // Decompression ending + TextView::execute(_vm, "ending4"); + break; + } + + checkShowDialog(); + _winStatus = 0; + /* // Check copy protection ProtectionResult protectionResult = checkCopyProtection(); @@ -310,32 +339,9 @@ void GameNebular::setSectionHandler() { } void GameNebular::checkShowDialog() { - // Handling to start endgame sequences if the win/lose type has been set - switch (_winStatus) { - case 1: - // No shields failure ending - AnimationView::execute(_vm, "rexend1"); - break; - case 2: - // Shields, but no targetting failure ending - AnimationView::execute(_vm, "rexend2"); - break; - case 3: - // Completed game successfully, so activate quotes item on the main menu - ConfMan.setBool("ShowQuotes", true); - ConfMan.flushToDisk(); - - AnimationView::execute(_vm, "rexend3"); - break; - case 4: - // Decompression ending - TextView::execute(_vm, "ending4"); - break; - } - _winStatus = 0; - // Loop for showing dialogs, if any need to be shown - if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globals[kCopyProtectFailed]) { + if (_vm->_dialogs->_pendingDialog && (_player._stepEnabled || _winStatus) + && !_globals[kCopyProtectFailed]) { _player.releasePlayerSprites(); // Make a thumbnail in case it's needed for making a savegame diff --git a/engines/mads/nebular/menu_nebular.cpp b/engines/mads/nebular/menu_nebular.cpp index 2fdef3443d..358a978cfa 100644 --- a/engines/mads/nebular/menu_nebular.cpp +++ b/engines/mads/nebular/menu_nebular.cpp @@ -136,12 +136,14 @@ void MainMenu::doFrame() { addSpriteSlot(); } + _vm->_events->setCursor(CURSOR_ARROW); _vm->_events->showCursor(); } else { if ((_menuItemIndex == -1) || (_frameIndex == 0)) { if (++_menuItemIndex == 6) { // Reached end of display animation + _vm->_events->setCursor(CURSOR_ARROW); _vm->_events->showCursor(); return; } else if (_menuItemIndex == 4 && !shouldShowQuotes()) { diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 4b8d7d5dd8..8a30f88548 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -719,7 +719,7 @@ void Scene803::step() { else _game._winStatus = 3; - _vm->quitGame(); + return; } } @@ -957,7 +957,7 @@ void Scene804::step() { assert(!_globals[kCopyProtectFailed]); _game._winStatus = 4; - _vm->quitGame(); + return; } break; @@ -969,7 +969,7 @@ void Scene804::step() { assert(!_globals[kCopyProtectFailed]); _game._winStatus = 4; - _vm->quitGame(); + return; } } |