aboutsummaryrefslogtreecommitdiff
path: root/engines/macventure/macventure.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/macventure/macventure.cpp')
-rw-r--r--engines/macventure/macventure.cpp51
1 files changed, 33 insertions, 18 deletions
diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp
index 37e1472338..0a27babb26 100644
--- a/engines/macventure/macventure.cpp
+++ b/engines/macventure/macventure.cpp
@@ -153,15 +153,7 @@ Common::Error MacVentureEngine::run() {
_soundManager = new SoundManager(this, _mixer);
- _paused = false;
- _halted = false;
- _cmdReady = false;
- _haltedAtEnd = false;
- _haltedInSelection = false;
- _clickToContinue = true;
- _gameState = kGameStateInit;
- _destObject = 0;
- _prepared = true;
+ setInitialFlags();
int directSaveSlotLoading = ConfMan.getInt("save_slot");
if (directSaveSlotLoading >= 0) {
@@ -169,10 +161,7 @@ Common::Error MacVentureEngine::run() {
error("Could not load game from slot '%d'", directSaveSlotLoading);
}
} else {
- _cmdReady = true;
- ObjID playerParent = _world->getObjAttr(1, kAttrParentObject);
- _currentSelection.push_back(playerParent);// Push the parent of the player
- _world->setObjAttr(playerParent, kAttrContainerOpen, 1);
+ setNewGameState();
}
_selectedControl = kStartOrResume;
@@ -208,17 +197,42 @@ Common::Error MacVentureEngine::run() {
}
}
}
- _gui->draw();
-
- g_system->updateScreen();
- g_system->delayMillis(50);
+ refreshScreen();
}
return Common::kNoError;
}
+void MacVentureEngine::refreshScreen() {
+ _gui->draw();
+ g_system->updateScreen();
+ g_system->delayMillis(50);
+}
+
void MacVentureEngine::newGame() {
- warning("New Game not implemented!");
+ _world->startNewGame();
+ reset();
+ setInitialFlags();
+ setNewGameState();
+}
+
+void MacVentureEngine::setInitialFlags() {
+ _paused = false;
+ _halted = false;
+ _cmdReady = false;
+ _haltedAtEnd = false;
+ _haltedInSelection = false;
+ _clickToContinue = true;
+ _gameState = kGameStateInit;
+ _destObject = 0;
+ _prepared = true;
+}
+
+void MacVentureEngine::setNewGameState() {
+ _cmdReady = true;
+ ObjID playerParent = _world->getObjAttr(1, kAttrParentObject);
+ _currentSelection.push_back(playerParent);// Push the parent of the player
+ _world->setObjAttr(playerParent, kAttrContainerOpen, 1);
}
void MacVentureEngine::reset() {
@@ -241,6 +255,7 @@ void MacVentureEngine::resetGui() {
_gui->updateWindowInfo(kInventoryStart, 1, _world->getChildren(1, true));
updateControls();
updateExits();
+ refreshScreen();
}
void MacVentureEngine::requestQuit() {