aboutsummaryrefslogtreecommitdiff
path: root/engines/saga
diff options
context:
space:
mode:
authorTorbjörn Andersson2016-03-27 15:06:59 +0200
committerTorbjörn Andersson2016-03-27 15:23:17 +0200
commitc5b8adb370d9d707aee4b00cf1c711dcd7419d17 (patch)
tree64db0f50a4c62084f46a0c7477d1fe00f1828fe7 /engines/saga
parentc1b04c11e9509658d74f5c05796e77fca5ead7e6 (diff)
downloadscummvm-rg350-c5b8adb370d9d707aee4b00cf1c711dcd7419d17.tar.gz
scummvm-rg350-c5b8adb370d9d707aee4b00cf1c711dcd7419d17.tar.bz2
scummvm-rg350-c5b8adb370d9d707aee4b00cf1c711dcd7419d17.zip
SAGA: Fix dialog text positions in non-English version (#7064)
This fix applies to drawPanelText(), where we used to hard-code the text positions. Now we define the dimensions of the area where the text is drawn (like we do for button texts) and calculate the position based on the dimensions of the text string. The drawPanelText() function is used for the Save, Quit, Protect and Option dialogs, but for everything except the Option dialog it already centered the text to the dialog. I decided to use this centering mechanism for the title of the ITE Option dialog, even though that changes the X coordinate by one pixel. Other than that, it only affects the following texts: ITE: Show Dialog / Reading Speed, Music and Sound IHNM: Reading Speed, Music, Sound, Voices I have verified that this looks at least ok for the English and German versions of ITE, and the English, German, French and Spanish versions of IHNM, so I'm reasonably confident that this change is ok.
Diffstat (limited to 'engines/saga')
-rw-r--r--engines/saga/displayinfo.h18
-rw-r--r--engines/saga/interface.cpp24
2 files changed, 28 insertions, 14 deletions
diff --git a/engines/saga/displayinfo.h b/engines/saga/displayinfo.h
index a0cdf5733b..67448936ce 100644
--- a/engines/saga/displayinfo.h
+++ b/engines/saga/displayinfo.h
@@ -177,11 +177,11 @@ static PanelButton ITE_OptionPanelButtons[] = {
{kPanelButtonOption, 241,98, 57,17, kTextSave,'s',0, 0,0,0}, //save
{kPanelButtonOptionSaveFiles, 166,20, 112,74, 0,'-',0, 0,0,0}, //savefiles
- {kPanelButtonOptionText,106,4, 0,0, kTextGameOptions,'-',0, 0,0,0}, // text: game options
- {kPanelButtonOptionText,11,22, 0,0, kTextReadingSpeed,'-',0, 0,0,0}, // text: read speed
- {kPanelButtonOptionText,28,22, 0,0, kTextShowDialog,'-',0, 0,0,0}, // text: read speed
- {kPanelButtonOptionText,73,41, 0,0, kTextMusic,'-',0, 0,0,0}, // text: music
- {kPanelButtonOptionText,69,60, 0,0, kTextSound,'-',0, 0,0,0}, // text: noise
+ {kPanelButtonOptionText,-1,4, 0,0, kTextGameOptions,'-',0, 0,0,0}, // text: game options
+ {kPanelButtonOptionText,5,18, 109,17, kTextReadingSpeed,'-',0, 0,0,0}, // text: read speed
+ {kPanelButtonOptionText,5,18, 109,17, kTextShowDialog,'-',0, 0,0,0}, // text: read speed
+ {kPanelButtonOptionText,5,37, 109,17, kTextMusic,'-',0, 0,0,0}, // text: music
+ {kPanelButtonOptionText,5,56, 109,17, kTextSound,'-',0, 0,0,0}, // text: noise
};
static PanelButton ITE_QuitPanelButtons[] = {
@@ -326,10 +326,10 @@ static PanelButton IHNM_ConversePanelButtons[] = {
static PanelButton IHNM_OptionPanelButtons[] = {
{kPanelButtonOptionSlider, 421,16, 16,138, 0,'-',0, 0,0,0}, //slider-scroller
- {kPanelButtonOptionText,28,36, 0,0, kTextReadingSpeed,'-',0, 0,0,0}, // text: read speed
- {kPanelButtonOptionText,60,61, 0,0, kTextMusic,'-',0, 0,0,0}, // text: music
- {kPanelButtonOptionText,60,86, 0,0, kTextSound,'-',0, 0,0,0}, // text: noise
- {kPanelButtonOptionText,56,111, 0,0, kTextVoices,'-',0, 0,0,0}, // text: voices
+ {kPanelButtonOptionText,11,30, 139,21, kTextReadingSpeed,'-',0, 0,0,0}, // text: read speed
+ {kPanelButtonOptionText,11,55, 139,21, kTextMusic,'-',0, 0,0,0}, // text: music
+ {kPanelButtonOptionText,11,80, 139,21, kTextSound,'-',0, 0,0,0}, // text: noise
+ {kPanelButtonOptionText,11,105, 139,21, kTextVoices,'-',0, 0,0,0}, // text: voices
{kPanelButtonOption, 154,30, 79,23, kTextReadingSpeed,'r',0, 0,0,0}, //read speed
{kPanelButtonOption, 154,55, 79,23, kTextMusic,'m',0, 0,0,0}, //music
{kPanelButtonOption, 154,80, 79,23, kTextSound,'n',0, 0,0,0}, //sound-noise
diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp
index ad940aaf8b..b580e2131a 100644
--- a/engines/saga/interface.cpp
+++ b/engines/saga/interface.cpp
@@ -867,7 +867,7 @@ void Interface::calcOptionSaveSlider() {
void Interface::drawPanelText(InterfacePanel *panel, PanelButton *panelButton) {
const char *text;
- int textWidth;
+ int textWidth, textHeight;
Rect rect;
Point textPoint;
KnownColor textShadowKnownColor = kKnownColorVerbTextShadow;
@@ -900,12 +900,26 @@ void Interface::drawPanelText(InterfacePanel *panel, PanelButton *panelButton) {
}
panel->calcPanelButtonRect(panelButton, rect);
+ if (_vm->getGameId() == GID_ITE) {
+ textWidth = _vm->_font->getStringWidth(kKnownFontMedium, text, 0, kFontNormal);
+ textHeight = _vm->_font->getHeight(kKnownFontMedium);
+ } else {
+ textWidth = _vm->_font->getStringWidth(kKnownFontVerb, text, 0, kFontNormal);
+ textHeight = _vm->_font->getHeight(kKnownFontVerb);
+ }
if (panelButton->xOffset < 0) {
- if (_vm->getGameId() == GID_ITE)
- textWidth = _vm->_font->getStringWidth(kKnownFontMedium, text, 0, kFontNormal);
- else
- textWidth = _vm->_font->getStringWidth(kKnownFontVerb, text, 0, kFontNormal);
+ // Special case: Centered to dialog. This is used for things like the
+ // title of a dialog.
rect.left += 2 + (panel->imageWidth - 1 - textWidth) / 2;
+ } else {
+ // The standard case is used for the things that look a bit like buttons
+ // but are not clickable, e.g. texts like "Music", "Sound", etc.
+ if (_vm->getGameId() == GID_ITE) {
+ rect.left = rect.right - textWidth - 3;
+ } else {
+ rect.left = (rect.right + rect.left - textWidth) / 2;
+ }
+ rect.top = (rect.top + rect.bottom - textHeight) / 2;
}
textPoint.x = rect.left;