aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/gui_v1.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2008-04-18 15:58:49 +0000
committerJohannes Schickel2008-04-18 15:58:49 +0000
commitba90659705cec3894615b77b1dcf3f3fe768c8bd (patch)
tree01a28caef6e4ec48aacc14d0975462e8c5961486 /engines/kyra/gui_v1.cpp
parent7d6a349afa3e9d8596b4536139d3657370d443c3 (diff)
downloadscummvm-rg350-ba90659705cec3894615b77b1dcf3f3fe768c8bd.tar.gz
scummvm-rg350-ba90659705cec3894615b77b1dcf3f3fe768c8bd.tar.bz2
scummvm-rg350-ba90659705cec3894615b77b1dcf3f3fe768c8bd.zip
Some kyra1 menu tweaking, now all languages should use the same clean layout instead of variable width button system (widths even changed at runtime, which looked rather strange).
svn-id: r31559
Diffstat (limited to 'engines/kyra/gui_v1.cpp')
-rw-r--r--engines/kyra/gui_v1.cpp77
1 files changed, 3 insertions, 74 deletions
diff --git a/engines/kyra/gui_v1.cpp b/engines/kyra/gui_v1.cpp
index bf1d29b493..12c9648f10 100644
--- a/engines/kyra/gui_v1.cpp
+++ b/engines/kyra/gui_v1.cpp
@@ -472,80 +472,6 @@ int GUI_v1::buttonMenuCallback(Button *caller) {
return 0;
}
-void GUI_v1::initMenuLayout(Menu &menu) {
- assert(menu.numberOfItems < 7);
-
- int widthBackup = _screen->_charWidth;
- _screen->_charWidth = -2;
-
- menu.x = (320 - menu.width)/2;
-
- int menu_x2 = menu.width + menu.x - 1;
- int maxOffset = 0;
- int x1, x2, y1, y2;
-
- for (int i = 0; i < menu.numberOfItems; i++) {
- if (menu.item[i].x == -1)
- menu.item[i].x = (menu.width - menu.item[i].width)/2;
- if (menu.item[i].y == -1)
- menu.item[i].y = (menu.height - menu.item[i].height)/2;
-
- if (menu.item[i].labelString) {
- x1 = menu.x + menu.item[i].x + 25;
- y1 = (200 - menu.height)/2 + menu.item[i].y;
-
- x2 = x1 + menu.item[i].width;
- y2 = y1 + menu.item[i].height;
-
- int textWidth = _screen->getTextWidth(menu.item[i].labelString) + 25;
- int textX = menu.item[i].labelX + menu.x;
-
- if (textWidth + textX > x1) {
- int offset = ((textWidth + textX) - x1);
- if (maxOffset < offset)
- maxOffset = offset;
- }
- }
-
- if (menu.item[i].itemString) {
- int textWidth = _screen->getTextWidth(menu.item[i].itemString) + 15;
-
- if (menu.item[i].width < textWidth) {
- menu.item[i].width = textWidth;
-
- if ( menu.x + menu.item[i].x + menu.item[i].width > menu_x2)
- menu.item[i].x -= (menu.x + menu.item[i].x + menu.item[i].width) - menu_x2 + 10;
- }
- }
-
- }
-
- if (maxOffset > 0) {
- maxOffset = maxOffset/2;
- for (int i = 0; i < menu.numberOfItems; i++) {
- menu.item[i].x += maxOffset + 10;
- menu.item[i].labelX -= maxOffset;
- }
- menu.width += maxOffset;
- }
-
- if (menu.menuNameString != 0) {
- int menuNameStringLength = _screen->getTextWidth(menu.menuNameString);
- if (menuNameStringLength > menu.width)
- menu.width = menuNameStringLength;
- }
-
- if (menu.width > 310)
- menu.width = 310;
-
- menu.x = (320 - menu.width)/2;
-
- if (menu.y == -1)
- menu.y = (200 - menu.height)/2;
-
- _screen->_charWidth = widthBackup;
-}
-
void GUI_v1::getInput() {
Common::Event event;
static uint32 lastScreenUpdate = 0;
@@ -1014,6 +940,9 @@ void GUI_v1::setupControls(Menu &menu) {
menu.item[3].itemString = "ERROR";
break;
}
+ } else {
+ menu.item[4].enabled = 0;
+ menu.item[4].labelString = 0;
}
switch (_vm->_configTextspeed) {