aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorMartin Kiewitz2010-04-25 09:35:34 +0000
committerMartin Kiewitz2010-04-25 09:35:34 +0000
commitaaaab9ec34bdb52d40b33295293fdbeab4568a93 (patch)
tree7aacb80ccc00624e24060bf0138f6debef95c627 /engines/sci
parent725fb248ea17245f71e1e8c81f82f29fc8f1bdbc (diff)
downloadscummvm-rg350-aaaab9ec34bdb52d40b33295293fdbeab4568a93.tar.gz
scummvm-rg350-aaaab9ec34bdb52d40b33295293fdbeab4568a93.tar.bz2
scummvm-rg350-aaaab9ec34bdb52d40b33295293fdbeab4568a93.zip
SCI: fix regression of r48659 - now calculating menu width and splitting text on kernelDrawMenuBar() as well - fixes menu not displaying all the time in hoyle 1&2
svn-id: r48791
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/graphics/menu.cpp22
-rw-r--r--engines/sci/graphics/menu.h3
2 files changed, 17 insertions, 8 deletions
diff --git a/engines/sci/graphics/menu.cpp b/engines/sci/graphics/menu.cpp
index 46df316932..0241721aa1 100644
--- a/engines/sci/graphics/menu.cpp
+++ b/engines/sci/graphics/menu.cpp
@@ -339,14 +339,11 @@ void GfxMenu::drawBar() {
}
}
-// This helper calculates all text widths for all menus/items
-void GfxMenu::calculateTextWidth() {
+// This helper calculates all text widths for all menus (only)
+void GfxMenu::calculateMenuWidth() {
GuiMenuList::iterator menuIterator;
GuiMenuList::iterator menuEnd = _list.end();
GuiMenuEntry *menuEntry;
- GuiMenuItemList::iterator itemIterator;
- GuiMenuItemList::iterator itemEnd = _itemList.end();
- GuiMenuItemEntry *itemEntry;
int16 dummyHeight;
menuIterator = _list.begin();
@@ -357,6 +354,16 @@ void GfxMenu::calculateTextWidth() {
menuIterator++;
}
+}
+
+// This helper calculates all text widths for all menus/items
+void GfxMenu::calculateMenuAndItemWidth() {
+ GuiMenuItemList::iterator itemIterator;
+ GuiMenuItemList::iterator itemEnd = _itemList.end();
+ GuiMenuItemEntry *itemEntry;
+ int16 dummyHeight;
+
+ calculateMenuWidth();
itemIterator = _itemList.begin();
while (itemIterator != itemEnd) {
@@ -680,7 +687,7 @@ GuiMenuItemEntry *GfxMenu::interactiveWithKeyboard() {
// We don't 100% follow sierra here: we select last item instead of selecting first item of first menu everytime
// Also sierra sci didnt allow mouse interaction, when menu was activated via keyboard
- calculateTextWidth();
+ calculateMenuAndItemWidth();
_oldPort = _ports->setPort(_ports->_menuPort);
_barSaveHandle = _paint16->bitsSave(_ports->_menuRect, SCI_SCREEN_MASK_VISUAL);
@@ -801,7 +808,7 @@ GuiMenuItemEntry *GfxMenu::interactiveWithMouse() {
bool firstMenuChange = true;
GuiMenuItemEntry *curItemEntry = NULL;
- calculateTextWidth();
+ calculateMenuAndItemWidth();
_oldPort = _ports->setPort(_ports->_menuPort);
_barSaveHandle = _paint16->bitsSave(_ports->_menuRect, SCI_SCREEN_MASK_VISUAL);
@@ -874,6 +881,7 @@ void GfxMenu::kernelDrawStatus(const char *text, int16 colorPen, int16 colorBack
void GfxMenu::kernelDrawMenuBar(bool clear) {
if (!clear) {
Port *oldPort = _ports->setPort(_ports->_menuPort);
+ calculateMenuWidth();
drawBar();
_paint16->bitsShow(_ports->_menuBarRect);
_ports->setPort(oldPort);
diff --git a/engines/sci/graphics/menu.h b/engines/sci/graphics/menu.h
index 3730cb49ae..8f23b46ff8 100644
--- a/engines/sci/graphics/menu.h
+++ b/engines/sci/graphics/menu.h
@@ -99,7 +99,8 @@ public:
private:
GuiMenuItemEntry *findItem(uint16 menuId, uint16 itemId);
- void calculateTextWidth();
+ void calculateMenuWidth();
+ void calculateMenuAndItemWidth();
void drawMenu(uint16 oldMenuId, uint16 newMenuId);
void invertMenuSelection(uint16 itemId);
void interactiveShowMouse();