diff options
Diffstat (limited to 'engines/saga/interface.cpp')
-rw-r--r-- | engines/saga/interface.cpp | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp index 44581f26fc..c663313f01 100644 --- a/engines/saga/interface.cpp +++ b/engines/saga/interface.cpp @@ -332,6 +332,9 @@ void Interface::saveReminderCallback(void *refCon) { } void Interface::updateSaveReminder() { + // CHECKME: This is potentially called from a different thread because it is + // called from a timer callback. However, it does not seem to take any + // precautions to avoid race conditions. if (_active && _panelMode == kPanelMain) { _saveReminderState = _saveReminderState % _vm->getDisplayInfo().saveReminderNumSprites + 1; drawStatusBar(); @@ -864,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; @@ -897,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; @@ -1153,7 +1170,7 @@ void Interface::processStatusTextInput(Common::KeyState keystate) { _statusTextInputPos--; _statusTextInputString[_statusTextInputPos] = 0; default: - if (_statusTextInputPos >= STATUS_TEXT_INPUT_MAX) { + if (_statusTextInputPos >= STATUS_TEXT_INPUT_MAX - 1) { // -1 because of the null termination break; } if (Common::isAlnum(keystate.ascii) || (keystate.ascii == ' ')) { @@ -1859,8 +1876,10 @@ void Interface::drawStatusBar() { int stringWidth; int color; // The default colors in the Spanish version of IHNM are shifted by one - // Fixes bug #1848016 - "IHNM: Wrong Subtitles Color (Spanish)" - int offset = (_vm->getLanguage() == Common::ES_ESP) ? 1 : 0; + // Fixes bug #1848016 - "IHNM: Wrong Subtitles Color (Spanish)". This + // also applies to the German and French versions (bug #7064 - "IHNM: + // text mistake in german version"). + int offset = (_vm->getFeatures() & GF_IHNM_COLOR_FIX) ? 1 : 0; // Disable the status text in IHNM when the chapter is 8 if (_vm->getGameId() == GID_IHNM && _vm->_scene->currentChapterNumber() == 8) @@ -2280,6 +2299,9 @@ void Interface::drawPanelButtonText(InterfacePanel *panel, PanelButton *panelBut break; } if (_vm->getGameId() == GID_ITE) { + if (textId > kTextEnterProtectAnswer) + error("This should not happen. Please report to ScummVM Team how you achieved this error."); + text = _vm->getTextString(textId); textFont = kKnownFontMedium; textShadowKnownColor = kKnownColorVerbTextShadow; |