[Scummvm-cvs-logs] SF.net SVN: scummvm:[47792] scummvm/trunk/engines/sci

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Mon Feb 1 10:53:42 CET 2010


Revision: 47792
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47792&view=rev
Author:   m_kiewitz
Date:     2010-02-01 09:53:42 +0000 (Mon, 01 Feb 2010)

Log Message:
-----------
SCI: class menu renamed to GfxMenu - now getting called directly, also fix for loading savedgames

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kmenu.cpp
    scummvm/trunk/engines/sci/engine/savegame.cpp
    scummvm/trunk/engines/sci/engine/state.h
    scummvm/trunk/engines/sci/graphics/gui.cpp
    scummvm/trunk/engines/sci/graphics/gui.h
    scummvm/trunk/engines/sci/graphics/menu.cpp
    scummvm/trunk/engines/sci/graphics/menu.h

Modified: scummvm/trunk/engines/sci/engine/kmenu.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmenu.cpp	2010-02-01 04:14:16 UTC (rev 47791)
+++ scummvm/trunk/engines/sci/engine/kmenu.cpp	2010-02-01 09:53:42 UTC (rev 47792)
@@ -29,6 +29,7 @@
 #include "sci/engine/kernel.h"
 #include "sci/graphics/gui.h"
 #include "sci/graphics/cursor.h"
+#include "sci/graphics/menu.h"
 
 namespace Sci {
 
@@ -36,7 +37,7 @@
 	Common::String title = s->strSplit(s->_segMan->getString(argv[0]).c_str());
 	Common::String content = s->_segMan->getString(argv[1]);
 
-	s->_gui->menuAdd(title, content, argv[1]);
+	s->_gfxMenu->kernelAddEntry(title, content, argv[1]);
 	return s->r_acc;
 }
 
@@ -51,7 +52,7 @@
 		attributeId = argv[argPos].toUint16();
 		if ((argPos + 1) >= argc)
 			error("Too few parameters for kSetMenu");
-		s->_gui->menuSet(menuId, itemId, attributeId, argv[argPos + 1]);
+		s->_gfxMenu->kernelSetAttribute(menuId, itemId, attributeId, argv[argPos + 1]);
 		argPos += 2;
 	}
 	return s->r_acc;
@@ -62,7 +63,7 @@
 	uint16 itemId = argv[0].toUint16() & 0xFF;
 	uint16 attributeId = argv[1].toUint16();
 
-	return s->_gui->menuGet(menuId, itemId, attributeId);
+	return s->_gfxMenu->kernelGetAttribute(menuId, itemId, attributeId);
 }
 
 
@@ -93,7 +94,7 @@
 	//bool pauseSound = argc > 1 ? (argv[1].isNull() ? false : true) : false;
 
 	// TODO: pauseSound implementation
-	return s->_gui->menuSelect(eventObject);
+	return s->_gfxMenu->kernelSelect(eventObject);
 }
 
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2010-02-01 04:14:16 UTC (rev 47791)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2010-02-01 09:53:42 UTC (rev 47792)
@@ -943,6 +943,14 @@
 	// Create a new EngineState object
 	retval = new EngineState(s->resMan, s->_kernel, s->_voc, s->_segMan, s->_gui, s->_audio);
 	retval->_event = new SciEvent();
+
+	retval->_gfxAnimate = s->_gfxAnimate;
+	retval->_gfxCache = s->_gfxCache;
+	retval->_gfxControls = s->_gfxControls;
+	retval->_gfxMenu = s->_gfxMenu;
+	retval->_gfxPalette = s->_gfxPalette;
+	retval->_gfxPorts = s->_gfxPorts;
+	retval->_gfxScreen = s->_gfxScreen;
 	
 #ifdef ENABLE_SCI32
 	// Copy the Gui32 pointer over to the new EngineState, if it exists

Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h	2010-02-01 04:14:16 UTC (rev 47791)
+++ scummvm/trunk/engines/sci/engine/state.h	2010-02-01 09:53:42 UTC (rev 47792)
@@ -50,10 +50,10 @@
 namespace Sci {
 
 class SciEvent;
-class Menubar;
 class GfxAnimate;
 class GfxCache;
 class GfxControls;
+class GfxMenu;
 class GfxPalette;
 class GfxPorts;
 class GfxScreen;
@@ -160,6 +160,7 @@
 	GfxAnimate *_gfxAnimate; // Animate for 16-bit gfx
 	GfxCache *_gfxCache;
 	GfxControls *_gfxControls; // Controls for 16-bit gfx
+	GfxMenu *_gfxMenu; // Menu for 16-bit gfx
 	GfxPalette *_gfxPalette;
 	GfxPorts *_gfxPorts; // Port managment for 16-bit gfx
 	GfxScreen *_gfxScreen;

Modified: scummvm/trunk/engines/sci/graphics/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.cpp	2010-02-01 04:14:16 UTC (rev 47791)
+++ scummvm/trunk/engines/sci/graphics/gui.cpp	2010-02-01 09:53:42 UTC (rev 47792)
@@ -61,7 +61,8 @@
 	_text16 = new GfxText16(_s->resMan, _cache, _ports, _paint16, _screen);
 	_controls = new GfxControls(_s->_segMan, _ports, _paint16, _text16, _screen);
 	_s->_gfxControls = _controls;
-	_menu = new Menu(_s->_event, _s->_segMan, this, _ports, _paint16, _text16, _screen, _cursor);
+	_menu = new GfxMenu(_s->_event, _s->_segMan, this, _ports, _paint16, _text16, _screen, _cursor);
+	_s->_gfxMenu = _menu;
 }
 
 SciGui::~SciGui() {
@@ -277,25 +278,10 @@
 
 void SciGui::menuReset() {
 	delete _menu;
-	_menu = new Menu(_s->_event, _s->_segMan, this, _ports, _paint16, _text16, _screen, _cursor);
+	_menu = new GfxMenu(_s->_event, _s->_segMan, this, _ports, _paint16, _text16, _screen, _cursor);
+	_s->_gfxMenu = _menu;
 }
 
-void SciGui::menuAdd(Common::String title, Common::String content, reg_t contentVmPtr) {
-	_menu->add(title, content, contentVmPtr);
-}
-
-void SciGui::menuSet(uint16 menuId, uint16 itemId, uint16 attributeId, reg_t value) {
-	_menu->setAttribute(menuId, itemId, attributeId, value);
-}
-
-reg_t SciGui::menuGet(uint16 menuId, uint16 itemId, uint16 attributeId) {
-	return _menu->getAttribute(menuId, itemId, attributeId);
-}
-
-reg_t SciGui::menuSelect(reg_t eventObject) {
-	return _menu->select(eventObject);
-}
-
 void SciGui::drawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo) {
 	Port *oldPort = _ports->setPort((Port *)_ports->_picWind);
 

Modified: scummvm/trunk/engines/sci/graphics/gui.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.h	2010-02-01 04:14:16 UTC (rev 47791)
+++ scummvm/trunk/engines/sci/graphics/gui.h	2010-02-01 09:53:42 UTC (rev 47792)
@@ -50,7 +50,7 @@
 class GfxPaint16;
 class GfxAnimate;
 class GfxControls;
-class Menu;
+class GfxMenu;
 class GfxText16;
 class Transitions;
 
@@ -76,10 +76,6 @@
 	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);
-	virtual reg_t menuSelect(reg_t eventObject);
 
 	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);
@@ -149,7 +145,7 @@
 	AudioPlayer *_audio;
 	GfxAnimate *_animate;
 	GfxControls *_controls;
-	Menu *_menu;
+	GfxMenu *_menu;
 	GfxText16 *_text16;
 	Transitions *_transitions;
 	int16 _palVaryId;

Modified: scummvm/trunk/engines/sci/graphics/menu.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/menu.cpp	2010-02-01 04:14:16 UTC (rev 47791)
+++ scummvm/trunk/engines/sci/graphics/menu.cpp	2010-02-01 09:53:42 UTC (rev 47792)
@@ -43,7 +43,7 @@
 
 namespace Sci {
 
-Menu::Menu(SciEvent *event, SegManager *segMan, SciGui *gui, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen, Cursor *cursor)
+GfxMenu::GfxMenu(SciEvent *event, SegManager *segMan, SciGui *gui, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen, Cursor *cursor)
 	: _event(event), _segMan(segMan), _gui(gui), _ports(ports), _paint16(paint16), _text16(text16), _screen(screen), _cursor(cursor) {
 
 	_listCount = 0;
@@ -57,11 +57,11 @@
 	_oldPort = NULL;
 }
 
-Menu::~Menu() {
+GfxMenu::~GfxMenu() {
 	// TODO: deallocate _list and _itemList
 }
 
-void Menu::add(Common::String title, Common::String content, reg_t contentVmPtr) {
+void GfxMenu::kernelAddEntry(Common::String title, Common::String content, reg_t contentVmPtr) {
 	GuiMenuEntry *menuEntry;
 	uint16 itemCount = 0;
 	GuiMenuItemEntry *itemEntry;
@@ -225,7 +225,7 @@
 	} while (curPos < contentSize);
 }
 
-GuiMenuItemEntry *Menu::findItem(uint16 menuId, uint16 itemId) {
+GuiMenuItemEntry *GfxMenu::findItem(uint16 menuId, uint16 itemId) {
 	GuiMenuItemList::iterator listIterator;
 	GuiMenuItemList::iterator listEnd = _itemList.end();
 	GuiMenuItemEntry *listEntry;
@@ -241,7 +241,7 @@
 	return NULL;
 }
 
-void Menu::setAttribute(uint16 menuId, uint16 itemId, uint16 attributeId, reg_t value) {
+void GfxMenu::kernelSetAttribute(uint16 menuId, uint16 itemId, uint16 attributeId, reg_t value) {
 	EngineState *s = ((SciEngine *)g_engine)->getEngineState();	// HACK: needed for strSplit()
 	GuiMenuItemEntry *itemEntry = findItem(menuId, itemId);
 	if (!itemEntry)
@@ -273,7 +273,7 @@
 	}
 }
 
-reg_t Menu::getAttribute(uint16 menuId, uint16 itemId, uint16 attributeId) {
+reg_t GfxMenu::kernelGetAttribute(uint16 menuId, uint16 itemId, uint16 attributeId) {
 	GuiMenuItemEntry *itemEntry = findItem(menuId, itemId);
 	if (!itemEntry)
 		error("Tried to getAttribute() on non-existant menu-item %d:%d", menuId, itemId);
@@ -297,7 +297,7 @@
 	return NULL_REG;
 }
 
-void Menu::drawBar() {
+void GfxMenu::drawBar() {
 	GuiMenuEntry *listEntry;
 	GuiMenuList::iterator listIterator;
 	GuiMenuList::iterator listEnd = _list.end();
@@ -318,7 +318,7 @@
 }
 
 // This helper calculates all text widths for all menus/items
-void Menu::calculateTextWidth() {
+void GfxMenu::calculateTextWidth() {
 	GuiMenuList::iterator menuIterator;
 	GuiMenuList::iterator menuEnd = _list.end();
 	GuiMenuEntry *menuEntry;
@@ -345,7 +345,7 @@
 	}
 }
 
-reg_t Menu::select(reg_t eventObject) {
+reg_t GfxMenu::kernelSelect(reg_t eventObject) {
 	int16 eventType = GET_SEL32V(_segMan, eventObject, type);
 	int16 keyPress, keyModifier;
 	Common::Point mousePosition;
@@ -434,7 +434,7 @@
 	return NULL_REG;
 }
 
-GuiMenuItemEntry *Menu::interactiveGetItem(uint16 menuId, uint16 itemId, bool menuChanged) {
+GuiMenuItemEntry *GfxMenu::interactiveGetItem(uint16 menuId, uint16 itemId, bool menuChanged) {
 	GuiMenuItemList::iterator itemIterator = _itemList.begin();
 	GuiMenuItemList::iterator itemEnd = _itemList.end();
 	GuiMenuItemEntry *itemEntry;
@@ -463,7 +463,7 @@
 	return firstItemEntry;
 }
 
-void Menu::drawMenu(uint16 oldMenuId, uint16 newMenuId) {
+void GfxMenu::drawMenu(uint16 oldMenuId, uint16 newMenuId) {
 	GuiMenuEntry *listEntry;
 	GuiMenuList::iterator listIterator;
 	GuiMenuList::iterator listEnd = _list.end();
@@ -569,7 +569,7 @@
 	_paint16->bitsShow(_menuRect);
 }
 
-void Menu::invertMenuSelection(uint16 itemId) {
+void GfxMenu::invertMenuSelection(uint16 itemId) {
 	Common::Rect itemRect = _menuRect;
 
 	if (itemId == 0)
@@ -583,17 +583,17 @@
 	_paint16->bitsShow(itemRect);
 }
 
-void Menu::interactiveShowMouse() {
+void GfxMenu::interactiveShowMouse() {
 	_mouseOldState = _cursor->isVisible();
 	_cursor->show();
 }
 
-void Menu::interactiveRestoreMouse() {
+void GfxMenu::interactiveRestoreMouse() {
 	if (!_mouseOldState)
 		_cursor->hide();
 }
 
-uint16 Menu::mouseFindMenuSelection(Common::Point mousePosition) {
+uint16 GfxMenu::mouseFindMenuSelection(Common::Point mousePosition) {
 	GuiMenuEntry *listEntry;
 	GuiMenuList::iterator listIterator;
 	GuiMenuList::iterator listEnd = _list.end();
@@ -611,7 +611,7 @@
 	return 0;
 }
 
-uint16 Menu::mouseFindMenuItemSelection(Common::Point mousePosition, uint16 menuId) {
+uint16 GfxMenu::mouseFindMenuItemSelection(Common::Point mousePosition, uint16 menuId) {
 	GuiMenuItemEntry *listItemEntry;
 	GuiMenuItemList::iterator listItemIterator;
 	GuiMenuItemList::iterator listItemEnd = _itemList.end();
@@ -639,7 +639,7 @@
 	return itemId;
 }
 
-GuiMenuItemEntry *Menu::interactiveWithKeyboard() {
+GuiMenuItemEntry *GfxMenu::interactiveWithKeyboard() {
 	sciEvent curEvent;
 	uint16 newMenuId = _curMenuId;
 	uint16 newItemId = _curItemId;
@@ -763,7 +763,7 @@
 // Mouse button is currently pressed - we are now interpreting mouse coordinates till mouse button is released
 //  The menu item that is selected at that time is chosen. If no menu item is selected we cancel
 //  No keyboard interaction is allowed, cause that wouldnt make any sense at all
-GuiMenuItemEntry *Menu::interactiveWithMouse() {
+GuiMenuItemEntry *GfxMenu::interactiveWithMouse() {
 	sciEvent curEvent;
 	uint16 newMenuId = 0, newItemId = 0;
 	uint16 curMenuId = 0, curItemId = 0;

Modified: scummvm/trunk/engines/sci/graphics/menu.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/menu.h	2010-02-01 04:14:16 UTC (rev 47791)
+++ scummvm/trunk/engines/sci/graphics/menu.h	2010-02-01 09:53:42 UTC (rev 47792)
@@ -76,18 +76,18 @@
 };
 typedef Common::List<GuiMenuItemEntry *> GuiMenuItemList;
 
-class Menu {
+class GfxMenu {
 public:
-	Menu(SciEvent *event, SegManager *segMan, SciGui *gui, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen, Cursor *cursor);
-	~Menu();
+	GfxMenu(SciEvent *event, SegManager *segMan, SciGui *gui, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen, Cursor *cursor);
+	~GfxMenu();
 
 	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);
+	void kernelAddEntry(Common::String title, Common::String content, reg_t contentVmPtr);
+	void kernelSetAttribute(uint16 menuId, uint16 itemId, uint16 attributeId, reg_t value);
+	reg_t kernelGetAttribute(uint16 menuId, uint16 itemId, uint16 attributeId);
 
 	void drawBar();
-	reg_t select(reg_t eventObject);
+	reg_t kernelSelect(reg_t eventObject);
 
 private:
 	GuiMenuItemEntry *findItem(uint16 menuId, uint16 itemId);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list