aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBorja Lorente2016-08-12 12:42:24 +0200
committerBorja Lorente2016-08-19 16:29:17 +0200
commit479f01b5a708ed1e3294ef1d553d37d270cb97c4 (patch)
tree155dc427b43668184f6bfa8ff1c00bd97f97f158
parent8417e6f22deaf026c3c59cfc9175d357c6ec286a (diff)
downloadscummvm-rg350-479f01b5a708ed1e3294ef1d553d37d270cb97c4.tar.gz
scummvm-rg350-479f01b5a708ed1e3294ef1d553d37d270cb97c4.tar.bz2
scummvm-rg350-479f01b5a708ed1e3294ef1d553d37d270cb97c4.zip
MACVENTURE: Implement gui reloading
-rw-r--r--engines/macventure/gui.cpp21
-rw-r--r--engines/macventure/gui.h3
-rw-r--r--engines/macventure/macventure.cpp1
3 files changed, 20 insertions, 5 deletions
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index b66e2ee598..85f1cdbea7 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -112,6 +112,7 @@ Gui::Gui(MacVentureEngine *engine, Common::MacResManager *resman) {
_cursor = new Cursor(this);
_consoleText = new ConsoleText(this);
+ _graphics = NULL;
initGUI();
}
@@ -136,10 +137,7 @@ Gui::~Gui() {
if (_dialog)
delete _dialog;
- Common::HashMap<ObjID, ImageAsset*>::const_iterator it = _assets.begin();
- for (; it != _assets.end(); it++) {
- delete it->_value;
- }
+ clearAssets();
}
void Gui::initGUI() {
@@ -169,8 +167,12 @@ void Gui::initGUI() {
}
-void Gui::draw() {
+void Gui::reloadInternals() {
+ loadGraphics();
+ clearAssets();
+}
+void Gui::draw() {
// Will be performance-improved after the milestone
_wm.setFullRefresh(true);
@@ -352,9 +354,18 @@ void Gui::loadBorder(Graphics::MacWindow * target, MVWindowType type, bool activ
}
void Gui::loadGraphics() {
+ if (_graphics)
+ delete _graphics;
_graphics = new Container(_engine->getFilePath(kGraphicPathID));
}
+void Gui::clearAssets() {
+ Common::HashMap<ObjID, ImageAsset*>::const_iterator it = _assets.begin();
+ for (; it != _assets.end(); it++) {
+ delete it->_value;
+ }
+}
+
bool Gui::loadMenus() {
if (kLoadStaticMenus) {
diff --git a/engines/macventure/gui.h b/engines/macventure/gui.h
index 185171f6b9..5835202904 100644
--- a/engines/macventure/gui.h
+++ b/engines/macventure/gui.h
@@ -98,6 +98,8 @@ public:
Gui(MacVentureEngine *engine, Common::MacResManager *resman);
~Gui();
+ void reloadInternals();
+
void draw();
void drawMenu();
void drawTitle();
@@ -211,6 +213,7 @@ private: // Methods
void loadBorders(Graphics::MacWindow *target, MVWindowType type);
void loadBorder(Graphics::MacWindow *target, MVWindowType type, bool active);
void loadGraphics();
+ void clearAssets();
// Drawers
void drawWindows();
diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp
index b96a8bfeec..21fb709994 100644
--- a/engines/macventure/macventure.cpp
+++ b/engines/macventure/macventure.cpp
@@ -248,6 +248,7 @@ void MacVentureEngine::resetInternals() {
}
void MacVentureEngine::resetGui() {
+ _gui->reloadInternals();
_gui->updateWindowInfo(kMainGameWindow, getParent(1), _world->getChildren(getParent(1), true));
// HACK! should update all inventories
_gui->ensureInventoryOpen(kInventoryStart, 1);