diff options
author | Borja Lorente | 2016-08-02 13:58:16 +0200 |
---|---|---|
committer | Borja Lorente | 2016-08-14 19:00:37 +0200 |
commit | d1a31ff5dbb3fb9cd7a3cda2945ee7f9183a6497 (patch) | |
tree | f10187f6f635b836874b36f1a37fe3afd5f6aa70 /engines/macventure | |
parent | f0dde375c13a262d5d71cdf74114b64754fa0755 (diff) | |
download | scummvm-rg350-d1a31ff5dbb3fb9cd7a3cda2945ee7f9183a6497.tar.gz scummvm-rg350-d1a31ff5dbb3fb9cd7a3cda2945ee7f9183a6497.tar.bz2 scummvm-rg350-d1a31ff5dbb3fb9cd7a3cda2945ee7f9183a6497.zip |
MACVENTURE: Fix startup loading bug
Diffstat (limited to 'engines/macventure')
-rw-r--r-- | engines/macventure/gui.cpp | 7 | ||||
-rw-r--r-- | engines/macventure/gui.h | 2 | ||||
-rw-r--r-- | engines/macventure/macventure.cpp | 17 |
3 files changed, 21 insertions, 5 deletions
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp index d615493b60..b3f282f4c9 100644 --- a/engines/macventure/gui.cpp +++ b/engines/macventure/gui.cpp @@ -951,6 +951,13 @@ Graphics::MacWindow * Gui::findWindow(WindowReference reference) { return nullptr; } +void Gui::ensureInventoryOpen(WindowReference reference, ObjID id) { + assert(reference < 0x80 && reference >= kInventoryStart); + if (reference - kInventoryStart == _inventoryWindows.size()) { + createInventoryWindow(id); + } +} + WindowReference Gui::getObjWindow(ObjID objID) { switch (objID) { case 0xfffc: return kExitsWindow; diff --git a/engines/macventure/gui.h b/engines/macventure/gui.h index 31cacd76ef..18be9b93e2 100644 --- a/engines/macventure/gui.h +++ b/engines/macventure/gui.h @@ -106,7 +106,6 @@ public: void updateWindow(WindowReference winID, bool containerOpen); void invertWindowColors(WindowReference winID); - WindowReference createInventoryWindow(ObjID objRef); bool tryCloseWindow(WindowReference winID); @@ -138,6 +137,7 @@ public: void bringToFront(WindowReference window); void setWindowTitle(WindowReference winID, Common::String string); void updateWindowInfo(WindowReference ref, ObjID objID, const Common::Array<ObjID> &children); + void ensureInventoryOpen(WindowReference reference, ObjID id); void addChild(WindowReference target, ObjID child); void removeChild(WindowReference target, ObjID child); diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp index 6a7c1474a8..b52379d6ed 100644 --- a/engines/macventure/macventure.cpp +++ b/engines/macventure/macventure.cpp @@ -24,6 +24,7 @@ #include "common/debug-channels.h" #include "common/debug.h" #include "common/error.h" +#include "common/config-manager.h" #include "engines/util.h" #include "macventure/macventure.h" @@ -129,11 +130,18 @@ Common::Error MacVentureEngine::run() { _destObject = 0; _prepared = true; - _cmdReady = true; + int directSaveSlotLoading = ConfMan.getInt("save_slot"); + if (directSaveSlotLoading >= 0) { + if (loadGameState(directSaveSlotLoading).getCode() != Common::kNoError) { + 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); + } _selectedControl = kStartOrResume; - ObjID playerParent = _world->getObjAttr(1, kAttrParentObject); - _currentSelection.push_back(playerParent);// Push the parent of the player - _world->setObjAttr(playerParent, kAttrContainerOpen, 1); _gui->addChild(kSelfWindow, 1); _gui->updateWindow(kSelfWindow, false); @@ -194,6 +202,7 @@ void MacVentureEngine::resetInternals() { void MacVentureEngine::resetGui() { _gui->updateWindowInfo(kMainGameWindow, getParent(1), _world->getChildren(getParent(1), true)); // HACK! should update all inventories + _gui->ensureInventoryOpen(kInventoryStart, 1); _gui->updateWindowInfo(kInventoryStart, 1, _world->getChildren(1, true)); updateControls(); updateExits(); |