[Scummvm-cvs-logs] scummvm master -> ab22c27f7a7aa71bbb796e8eebde758ec02fe5b3

m-kiewitz m_kiewitz at users.sourceforge.net
Tue Feb 9 14:55:15 CET 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ab22c27f7a AGI: Cut menu in case menu names are too long


Commit: ab22c27f7a7aa71bbb796e8eebde758ec02fe5b3
    https://github.com/scummvm/scummvm/commit/ab22c27f7a7aa71bbb796e8eebde758ec02fe5b3
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2016-02-09T14:54:46+01:00

Commit Message:
AGI: Cut menu in case menu names are too long

Required for games that add to many names or add names, that are
too long. The code needs to get adjusted anyway for different
platforms, so for now just cut the menu names instead
Required for at least the fan game Get Outta Space Quest

Changed paths:
    engines/agi/menu.cpp



diff --git a/engines/agi/menu.cpp b/engines/agi/menu.cpp
index 803efd7..cef60ca 100644
--- a/engines/agi/menu.cpp
+++ b/engines/agi/menu.cpp
@@ -64,6 +64,8 @@ GfxMenu::~GfxMenu() {
 }
 
 void GfxMenu::addMenu(const char *menuText) {
+	int16 curColumnEnd = _setupMenuColumn;
+
 	// already submitted? in that case no further changes possible
 	if (_submitted)
 		return;
@@ -72,6 +74,18 @@ void GfxMenu::addMenu(const char *menuText) {
 
 	menuEntry->text = menuText;
 	menuEntry->textLen = menuEntry->text.size();
+
+	// Cut menu name in case menu bar is full
+	// Happens in at least the fan game Get Outta Space Quest
+	// Original interpreter had graphical issues in this case
+	// TODO: this whole code needs to get reworked anyway to support different types of menu bars depending on platform
+	curColumnEnd += menuEntry->textLen;
+	while ((menuEntry->textLen) && (curColumnEnd > 40)) {
+		menuEntry->text.deleteLastChar();
+		menuEntry->textLen--;
+		curColumnEnd--;
+	}
+
 	menuEntry->row = 0;
 	menuEntry->column = _setupMenuColumn;
 	menuEntry->itemCount = 0;
@@ -365,6 +379,10 @@ void GfxMenu::drawMenuName(int16 menuNr, bool inverted) {
 	GuiMenuEntry *menuEntry = _array[menuNr];
 	bool disabledLook = false;
 
+	// Don't draw in case there is no text
+	if (!menuEntry->text.size())
+		return;
+
 	if (!inverted) {
 		_text->charAttrib_Set(0, _text->calculateTextBackground(15));
 	} else {






More information about the Scummvm-git-logs mailing list