From ab22c27f7a7aa71bbb796e8eebde758ec02fe5b3 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Tue, 9 Feb 2016 14:54:46 +0100 Subject: 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 --- engines/agi/menu.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'engines/agi') 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 { -- cgit v1.2.3