aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/gui.cpp
diff options
context:
space:
mode:
authorOystein Eftevaag2006-04-25 15:42:37 +0000
committerOystein Eftevaag2006-04-25 15:42:37 +0000
commitd5c8a791a6abc578deacded063ac50d58d3fadad (patch)
treec038cb7258995ec2a7ce77227bd5d5e47d7f0b20 /engines/kyra/gui.cpp
parent6b225b40faaba652ba5f8b87ba5107720c6c5079 (diff)
downloadscummvm-rg350-d5c8a791a6abc578deacded063ac50d58d3fadad.tar.gz
scummvm-rg350-d5c8a791a6abc578deacded063ac50d58d3fadad.tar.bz2
scummvm-rg350-d5c8a791a6abc578deacded063ac50d58d3fadad.zip
Fixes some coordinate initialization in the menus, and makes sure the initial savegame is created when kyrandia is started for the first time
svn-id: r22153
Diffstat (limited to 'engines/kyra/gui.cpp')
-rw-r--r--engines/kyra/gui.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp
index 51fc7b3e1c..c287fbea64 100644
--- a/engines/kyra/gui.cpp
+++ b/engines/kyra/gui.cpp
@@ -660,7 +660,7 @@ void KyraEngine::calcCoords(Menu &menu) {
assert(menu.nrOfItems < 7);
int maxOffset = 0;
- int x1, x2, y1, y2, textX;
+ int x1, x2, y1, y2;
for (int i = 0; i < menu.nrOfItems; i++) {
if (menu.item[i].x == -1)
menu.item[i].x = (menu.width - menu.item[i].width)/2;
@@ -673,16 +673,13 @@ void KyraEngine::calcCoords(Menu &menu) {
y2 = y1 + menu.item[i].height - 1;
int textWidth = _screen->getTextWidth(menu.item[i].labelString);
-
- if (menu.item[i].field_12 != -1)
- textX = x1 + menu.item[i].field_12 + 3;
- else
- textX = _text->getCenterStringX(menu.item[i].labelString, x1, x2);
-
+ int menu_x1 = (320 - menu.width) / 2;
+ int textX = menu.item[i].labelX + menu_x1;
int offset;
+
if (textWidth + textX > x1) {
- offset = x1 - (textWidth + textX) / 2 + 10;
- menu.width += offset;
+ offset = (textWidth + textX) - x1;
+ menu.width += offset/2;
if (maxOffset < offset)
maxOffset = offset;
@@ -692,7 +689,7 @@ void KyraEngine::calcCoords(Menu &menu) {
if (maxOffset > 0)
for (int i = 0; i < menu.nrOfItems; i++)
- menu.item[i].x += maxOffset * 2;
+ menu.item[i].x += maxOffset - 10;
if (menu.width > 310)
menu.width = 310;
@@ -1072,11 +1069,11 @@ int KyraEngine::gui_gameControlsMenu(Button *button) {
_screen->savePageToDisk("SEENPAGE.TMP", 0);
if (_features & GF_TALKIE) {
- _menu[5].width = 230;
+ //_menu[5].width = 230;
for (int i = 0; i < 5; i++) {
- _menu[5].item[i].labelX = 24;
- _menu[5].item[i].x = 115;
+ //_menu[5].item[i].labelX = 24;
+ //_menu[5].item[i].x = 115;
_menu[5].item[i].width = 94;
}