diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index b209dfc6080..db2d776fbfb 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -35,6 +35,7 @@ #include "sci/engine/kernel_types.h" #include "sci/engine/message.h" #include "sci/graphics/gui.h" +#include "sci/graphics/menu.h" #include "sci/sound/music.h" namespace Sci { @@ -270,8 +271,8 @@ int game_init(EngineState *s) { } // Initialize menu TODO: Actually this should be another init() - if (s->_gui) - s->_gui->menuReset(); + if (s->_gfxMenu) + s->_gfxMenu->reset(); s->successor = NULL; // No successor diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp index c1ccd48264a..937f0d83715 100644 --- a/engines/sci/graphics/gui.cpp +++ b/engines/sci/graphics/gui.cpp @@ -276,12 +276,6 @@ void SciGui::drawMenuBar(bool clear) { } } -void SciGui::menuReset() { - delete _menu; - _menu = new GfxMenu(_s->_event, _s->_segMan, this, _ports, _paint16, _text16, _screen, _cursor); - _s->_gfxMenu = _menu; -} - void SciGui::drawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo) { Port *oldPort = _ports->setPort((Port *)_ports->_picWind); diff --git a/engines/sci/graphics/gui.h b/engines/sci/graphics/gui.h index 7c461de19bc..35caf414571 100644 --- a/engines/sci/graphics/gui.h +++ b/engines/sci/graphics/gui.h @@ -75,7 +75,6 @@ public: virtual void drawStatus(const char *text, int16 colorPen, int16 colorBack); virtual void drawMenuBar(bool clear); - virtual void menuReset(); virtual void drawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo); virtual void drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, bool hiresMode = false, reg_t upscaledHiresHandle = NULL_REG); diff --git a/engines/sci/graphics/menu.cpp b/engines/sci/graphics/menu.cpp index 7f5bd969aff..cff22eaefb8 100644 --- a/engines/sci/graphics/menu.cpp +++ b/engines/sci/graphics/menu.cpp @@ -59,6 +59,12 @@ GfxMenu::GfxMenu(SciEvent *event, SegManager *segMan, SciGui *gui, GfxPorts *por GfxMenu::~GfxMenu() { // TODO: deallocate _list and _itemList + reset(); +} + +void GfxMenu::reset() { + _list.clear(); + _itemList.clear(); } void GfxMenu::kernelAddEntry(Common::String title, Common::String content, reg_t contentVmPtr) {