SHERLOCK: Fix lines displayed out of visible space

This commit is contained in:
Vladimir Serbinenko 2023-05-03 11:19:31 +02:00
parent 1dc7fac7cc
commit 6b14c33da0
2 changed files with 11 additions and 6 deletions

View file

@ -199,6 +199,8 @@ void ScalpelTalk::talkInterface(const byte *&str) {
People &people = *_vm->_people;
ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen;
UserInterface &ui = *_vm->_ui;
int lineHeight = _vm->getLanguage() == Common::Language::ZH_TWN ? 16 : 9;
int maxLines = _vm->getLanguage() == Common::Language::ZH_TWN ? 3 : 5;
if (_vm->getLanguage() == Common::DE_DEU)
skipBadText(str);
@ -228,7 +230,7 @@ void ScalpelTalk::talkInterface(const byte *&str) {
_openTalkWindow = true;
}
_yp += 9;
_yp += lineHeight;
}
// Find amount of text that will fit on the line
@ -289,12 +291,12 @@ void ScalpelTalk::talkInterface(const byte *&str) {
if (str[0] == ' ')
++str;
_yp += _vm->getLanguage() == Common::Language::ZH_TWN ? 16 : 9;
_yp += lineHeight;
++_line;
// Certain different conditions require a wait
if ((_line == 4 && str < _scriptEnd && str[0] != _opcodes[OP_SFX_COMMAND] && str[0] != _opcodes[OP_PAUSE] && _speaker != -1) ||
(_line == 5 && str < _scriptEnd && str[0] != _opcodes[OP_PAUSE] && _speaker == -1) ||
if ((_line == (maxLines - 1) && str < _scriptEnd && str[0] != _opcodes[OP_SFX_COMMAND] && str[0] != _opcodes[OP_PAUSE] && _speaker != -1) ||
(_line == maxLines && str < _scriptEnd && str[0] != _opcodes[OP_PAUSE] && _speaker == -1) ||
_endStr) {
_wait = 1;
}

View file

@ -1953,6 +1953,9 @@ void ScalpelUserInterface::printObjectDesc(const Common::String &str, bool first
ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen;
Talk &talk = *_vm->_talk;
int lineHeight = (_vm->getLanguage() == Common::Language::ZH_TWN ? 16 : 9);
int maxLineCount = (_vm->getLanguage() == Common::Language::ZH_TWN ? 3 : 5);
if (str.hasPrefix("_")) {
_lookScriptFlag = true;
events.setCursor(MAGNIFY);
@ -2046,9 +2049,9 @@ void ScalpelUserInterface::printObjectDesc(const Common::String &str, bool first
// Loop through displaying up to five lines
Common::String remainder;
Common::Array<Common::String> lines = screen.wordWrap(str, 300, remainder, Common::String::npos, ONSCREEN_FILES_COUNT);
Common::Array<Common::String> lines = screen.wordWrap(str, 300, remainder, Common::String::npos, maxLineCount);
for (uint lineNum = 0; lineNum < lines.size(); ++lineNum) {
screen.gPrint(Common::Point(16, CONTROLS_Y + 12 + lineNum * (_vm->getLanguage() == Common::Language::ZH_TWN ? 16 : 9)),
screen.gPrint(Common::Point(16, CONTROLS_Y + 12 + lineNum * lineHeight),
INV_FOREGROUND, "%s", lines[lineNum].c_str());
}