From c0df1248b5a73f4b0f02d0712907878aa265dff4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 13 Mar 2015 21:54:20 -0400 Subject: MADS: Properly handle reloading scenes when closing dialogs --- engines/mads/nebular/dialogs_nebular.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'engines/mads/nebular/dialogs_nebular.cpp') diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 23aef6bdb5..6c57c85408 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -344,7 +344,7 @@ void DialogsNebular::showDialog() { void DialogsNebular::showScummVMSaveDialog() { Nebular::GameNebular &game = *(Nebular::GameNebular *)_vm->_game; - Scene *scene = &(game._scene); + Scene &scene = game._scene; GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); int slot = dialog->runModalWithCurrentTarget(); @@ -356,24 +356,31 @@ void DialogsNebular::showScummVMSaveDialog() { desc = dialog->createDefaultSaveDescription(slot); } - scene->_spriteSlots.reset(); - scene->loadScene(scene->_currentSceneId, game._aaName, true); - scene->_userInterface.noInventoryAnim(); + scene._spriteSlots.reset(); + scene.loadScene(scene._currentSceneId, game._aaName, true); + scene._userInterface.noInventoryAnim(); game._scene.drawElements(kTransitionFadeIn, false); game.saveGame(slot, desc); } + + // Flag for scene loading that we're returning from a dialog + scene._currentSceneId = RETURNING_FROM_DIALOG; } void DialogsNebular::showScummVMRestoreDialog() { Nebular::GameNebular &game = *(Nebular::GameNebular *)_vm->_game; GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); + Scene &scene = game._scene; int slot = dialog->runModalWithCurrentTarget(); if (slot >= 0) { game._loadGameSlot = slot; - game._scene._currentSceneId = -1; + game._scene._currentSceneId = RETURNING_FROM_LOADING; game._currentSectionNumber = -1; + } else { + // Flag for scene loading that we're returning from a dialog + scene._currentSceneId = RETURNING_FROM_DIALOG; } } @@ -637,6 +644,7 @@ void GameDialog::display() { GameDialog::~GameDialog() { _vm->_screen.resetClipBounds(); + _vm->_game->_scene._currentSceneId = RETURNING_FROM_DIALOG; } void GameDialog::clearLines() { -- cgit v1.2.3