[Scummvm-git-logs] scummvm master -> 6b14c33da0a8d0fbe16c82c714b47255736ead8e

phcoder noreply at scummvm.org
Wed May 3 20:31:49 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
6b14c33da0 SHERLOCK: Fix lines displayed out of visible space


Commit: 6b14c33da0a8d0fbe16c82c714b47255736ead8e
    https://github.com/scummvm/scummvm/commit/6b14c33da0a8d0fbe16c82c714b47255736ead8e
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-05-03T22:31:45+02:00

Commit Message:
SHERLOCK: Fix lines displayed out of visible space

Changed paths:
    engines/sherlock/scalpel/scalpel_talk.cpp
    engines/sherlock/scalpel/scalpel_user_interface.cpp


diff --git a/engines/sherlock/scalpel/scalpel_talk.cpp b/engines/sherlock/scalpel/scalpel_talk.cpp
index 58e407de9d0..3b41bd8bcc5 100644
--- a/engines/sherlock/scalpel/scalpel_talk.cpp
+++ b/engines/sherlock/scalpel/scalpel_talk.cpp
@@ -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;
 	}
diff --git a/engines/sherlock/scalpel/scalpel_user_interface.cpp b/engines/sherlock/scalpel/scalpel_user_interface.cpp
index 60a0b4c231b..14f2c60edc0 100644
--- a/engines/sherlock/scalpel/scalpel_user_interface.cpp
+++ b/engines/sherlock/scalpel/scalpel_user_interface.cpp
@@ -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());
 	}
 




More information about the Scummvm-git-logs mailing list