From 15c533d2c2b1464f2d55d3f6c48a9e21c85a2e7f Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 19 May 2010 12:34:10 +0000 Subject: Implement FR #2841445: FW: Restart doesn't work svn-id: r49096 --- engines/cine/cine.cpp | 19 +++++++++++++------ engines/cine/cine.h | 2 ++ engines/cine/main_loop.cpp | 2 +- engines/cine/various.cpp | 3 +-- engines/cine/various.h | 1 - 5 files changed, 17 insertions(+), 10 deletions(-) (limited to 'engines/cine') diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp index c33349173a..c50af52901 100644 --- a/engines/cine/cine.cpp +++ b/engines/cine/cine.cpp @@ -90,13 +90,20 @@ Common::Error CineEngine::run() { } g_saveFileMan = _saveFileMan; - initialize(); + _restartRequested = false; - CursorMan.showMouse(true); - mainLoop(1); + do { + initialize(); + + _restartRequested = false; + + CursorMan.showMouse(true); + mainLoop(1); + + delete renderer; + delete[] collisionPage; + } while (_restartRequested); - delete renderer; - delete[] collisionPage; delete g_sound; return Common::kNoError; @@ -186,7 +193,7 @@ void CineEngine::initialize() { currentDatName[0] = 0; _preLoad = false; - if (ConfMan.hasKey("save_slot")) { + if (ConfMan.hasKey("save_slot") && !_restartRequested) { char saveNameBuffer[256]; sprintf(saveNameBuffer, "%s.%1d", _targetName.c_str(), ConfMan.getInt("save_slot")); diff --git a/engines/cine/cine.h b/engines/cine/cine.h index 77d4866363..6f7b409ad7 100644 --- a/engines/cine/cine.h +++ b/engines/cine/cine.h @@ -134,6 +134,8 @@ public: StringPtrHashMap _volumeEntriesMap; TextHandler _textHandler; + bool _restartRequested; + private: void initialize(); void resetEngine(); diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp index 47cade105c..414aed394c 100644 --- a/engines/cine/main_loop.cpp +++ b/engines/cine/main_loop.cpp @@ -422,7 +422,7 @@ void CineEngine::mainLoop(int bootScriptIdx) { manageEvents(); - } while (!shouldQuit() && _danKeysPressed != 7); + } while (!shouldQuit() && !_restartRequested); hideMouse(); g_sound->stopMusic(); diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index 6e4637e0ca..9a10c2b5d7 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -78,7 +78,6 @@ uint16 waitForPlayerClick; uint16 menuCommandLen; bool _paletteNeedUpdate; uint16 _messageLen; -byte _danKeysPressed; int16 playerCommand; @@ -375,7 +374,7 @@ void CineEngine::makeSystemMenu() { { getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY); if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) { - //reinitEngine(); + _restartRequested = true; } break; } diff --git a/engines/cine/various.h b/engines/cine/various.h index d07fc73b13..3f362b1ad6 100644 --- a/engines/cine/various.h +++ b/engines/cine/various.h @@ -92,7 +92,6 @@ extern uint16 waitForPlayerClick; extern uint16 menuCommandLen; extern bool _paletteNeedUpdate; extern uint16 _messageLen; -extern byte _danKeysPressed; extern int16 playerCommand; -- cgit v1.2.3