aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2009-11-11 21:22:04 +0000
committerMartin Kiewitz2009-11-11 21:22:04 +0000
commit1bc60e9d8515c91576debcba6d618bc74258db11 (patch)
tree1314582c6f9b32f2f2a474a46b06258c03840c92
parent958ad94d8c54e97dacde560418758eb044945544 (diff)
downloadscummvm-rg350-1bc60e9d8515c91576debcba6d618bc74258db11.tar.gz
scummvm-rg350-1bc60e9d8515c91576debcba6d618bc74258db11.tar.bz2
scummvm-rg350-1bc60e9d8515c91576debcba6d618bc74258db11.zip
SCI/newgui: call menuReset() on game_init(), fixes double menu in pq2
svn-id: r45843
-rw-r--r--engines/sci/engine/game.cpp2
-rw-r--r--engines/sci/gui/gui.cpp6
-rw-r--r--engines/sci/gui/gui.h1
-rw-r--r--engines/sci/gui/gui_menu.cpp1
-rw-r--r--engines/sci/gui/gui_menu.h1
-rw-r--r--engines/sci/gui32/gui32.cpp3
-rw-r--r--engines/sci/gui32/gui32.h1
7 files changed, 15 insertions, 0 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index 9e782decc2..11df3e55f7 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -386,6 +386,8 @@ int game_init(EngineState *s) {
if (s->gfx_state && _reset_graphics_input(s))
return 1;
#endif
+ // Initialize menu TODO: Actually this should be another init()
+ s->_gui->menuReset();
s->successor = NULL; // No successor
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp
index 7b5769130c..f84a0f973a 100644
--- a/engines/sci/gui/gui.cpp
+++ b/engines/sci/gui/gui.cpp
@@ -317,6 +317,12 @@ void SciGui::drawMenuBar(bool clear) {
}
}
+void SciGui::menuReset() {
+ delete _menu;
+ _menu = new SciGuiMenu(_s->_segMan, _gfx, _text, _screen, _cursor);
+ _menu->init(_s->gfx_state);
+}
+
void SciGui::menuAdd(Common::String title, Common::String content, reg_t contentVmPtr) {
_menu->add(title, content, contentVmPtr);
}
diff --git a/engines/sci/gui/gui.h b/engines/sci/gui/gui.h
index 13756f37ae..150c84bed3 100644
--- a/engines/sci/gui/gui.h
+++ b/engines/sci/gui/gui.h
@@ -81,6 +81,7 @@ public:
virtual void drawStatus(const char *text, int16 colorPen, int16 colorBack);
virtual void drawMenuBar(bool clear);
+ virtual void menuReset();
virtual void menuAdd(Common::String title, Common::String content, reg_t contentVmPtr);
virtual void menuSet(uint16 menuId, uint16 itemId, uint16 attributeId, reg_t value);
virtual reg_t menuGet(uint16 menuId, uint16 itemId, uint16 attributeId);
diff --git a/engines/sci/gui/gui_menu.cpp b/engines/sci/gui/gui_menu.cpp
index 0a1e049e09..713bfa0f45 100644
--- a/engines/sci/gui/gui_menu.cpp
+++ b/engines/sci/gui/gui_menu.cpp
@@ -55,6 +55,7 @@ SciGuiMenu::SciGuiMenu(SegManager *segMan, SciGuiGfx *gfx, SciGuiText *text, Sci
}
SciGuiMenu::~SciGuiMenu() {
+ // TODO: deallocate _list and _itemList
}
void SciGuiMenu::init(GfxState *gfxstate) {
diff --git a/engines/sci/gui/gui_menu.h b/engines/sci/gui/gui_menu.h
index d6e3555df0..59765f8d0f 100644
--- a/engines/sci/gui/gui_menu.h
+++ b/engines/sci/gui/gui_menu.h
@@ -83,6 +83,7 @@ public:
~SciGuiMenu();
void init(GfxState *gfxstate);
+ void reset();
void add(Common::String title, Common::String content, reg_t contentVmPtr);
void setAttribute(uint16 menuId, uint16 itemId, uint16 attributeId, reg_t value);
reg_t getAttribute(uint16 menuId, uint16 itemId, uint16 attributeId);
diff --git a/engines/sci/gui32/gui32.cpp b/engines/sci/gui32/gui32.cpp
index b93d6c1449..7f32dcc1d8 100644
--- a/engines/sci/gui32/gui32.cpp
+++ b/engines/sci/gui32/gui32.cpp
@@ -837,6 +837,9 @@ void SciGui32::drawMenuBar(bool clear) {
gfxop_update(_s->gfx_state);
}
+void SciGui32::menuReset() {
+}
+
void SciGui32::menuAdd(Common::String title, Common::String content, reg_t entriesBase) {
int titlebarFont = _s->titlebar_port->_font;
diff --git a/engines/sci/gui32/gui32.h b/engines/sci/gui32/gui32.h
index c92ce53b40..51f57c0615 100644
--- a/engines/sci/gui32/gui32.h
+++ b/engines/sci/gui32/gui32.h
@@ -60,6 +60,7 @@ public:
void drawStatus(const char *text, int16 colorPen, int16 colorBack);
void drawMenuBar(bool clear);
+ void menuReset();
void menuAdd(Common::String title, Common::String content, reg_t entriesBase);
void menuSet(uint16 menuId, uint16 itemId, uint16 attributeId, reg_t value);
reg_t menuGet(uint16 menuId, uint16 itemId, uint16 attributeId);