aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2016-02-09 14:54:46 +0100
committerMartin Kiewitz2016-02-09 14:54:46 +0100
commitab22c27f7a7aa71bbb796e8eebde758ec02fe5b3 (patch)
tree6766c6917c3a265c21fee5ffee4a76df35b64120 /engines
parent4d5cc05eeec4f268533124911082aa0c146b0ed5 (diff)
downloadscummvm-rg350-ab22c27f7a7aa71bbb796e8eebde758ec02fe5b3.tar.gz
scummvm-rg350-ab22c27f7a7aa71bbb796e8eebde758ec02fe5b3.tar.bz2
scummvm-rg350-ab22c27f7a7aa71bbb796e8eebde758ec02fe5b3.zip
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
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/menu.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/engines/agi/menu.cpp b/engines/agi/menu.cpp
index 803efd757e..cef60ca161 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 {