aboutsummaryrefslogtreecommitdiff
path: root/engines/neverhood/gamemodule.cpp
diff options
context:
space:
mode:
authorjohndoe1232013-01-23 11:24:17 +0000
committerWillem Jan Palenstijn2013-05-08 20:47:42 +0200
commit379a8cbbe031c0c637029946b4cebea1e3e72bd5 (patch)
tree6ae88b35f4dc0d3c5ee8ddaddec9b2dfb0539fad /engines/neverhood/gamemodule.cpp
parent490d447ed19d481c9e15847c9bb43223b71c7847 (diff)
downloadscummvm-rg350-379a8cbbe031c0c637029946b4cebea1e3e72bd5.tar.gz
scummvm-rg350-379a8cbbe031c0c637029946b4cebea1e3e72bd5.tar.bz2
scummvm-rg350-379a8cbbe031c0c637029946b4cebea1e3e72bd5.zip
NEVERHOOD: Add support for loading/saving games with the game's own menu
- Add LoadGameMenu class
Diffstat (limited to 'engines/neverhood/gamemodule.cpp')
-rw-r--r--engines/neverhood/gamemodule.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp
index fa8a6d5d29..48462a2282 100644
--- a/engines/neverhood/gamemodule.cpp
+++ b/engines/neverhood/gamemodule.cpp
@@ -75,7 +75,7 @@ enum {
GameModule::GameModule(NeverhoodEngine *vm)
: Module(vm, NULL), _moduleNum(-1), _prevChildObject(NULL), _prevModuleNum(-1),
- _restartGameRequested(false), _mainMenuRequested(false), _gameWasLoaded(false) {
+ _restoreGameRequested(false), _restartGameRequested(false), _mainMenuRequested(false), _gameWasLoaded(false) {
// Other initializations moved to actual engine class
_vm->_soundMan->playSoundThree(0x002D0031, 0x8861079);
@@ -464,13 +464,8 @@ void GameModule::startup() {
#endif
}
-void GameModule::restoreGame() {
- delete _childObject;
- delete _prevChildObject;
- _childObject = NULL;
- _prevChildObject = NULL;
- _prevModuleNum = 0;
- createModuleByHash(getGlobalVar(V_MODULE_NAME));
+void GameModule::requestRestoreGame() {
+ _restoreGameRequested = true;
}
void GameModule::requestRestartGame(bool requestMainMenu) {
@@ -478,11 +473,27 @@ void GameModule::requestRestartGame(bool requestMainMenu) {
_mainMenuRequested = requestMainMenu;
}
-void GameModule::checkMainMenu() {
+void GameModule::redrawPrevChildObject() {
+ if (_prevChildObject) {
+ _prevChildObject->draw();
+ _vm->_screen->update();
+ }
+}
+
+void GameModule::checkRequests() {
if (_restartGameRequested) {
_restartGameRequested = false;
_vm->_gameVars->clear();
- restoreGame();
+ requestRestoreGame();
+ }
+ if (_restoreGameRequested) {
+ _restoreGameRequested = false;
+ delete _childObject;
+ delete _prevChildObject;
+ _childObject = NULL;
+ _prevChildObject = NULL;
+ _prevModuleNum = 0;
+ createModuleByHash(getGlobalVar(V_MODULE_NAME));
}
if (_mainMenuRequested)
openMainMenu();