[Scummvm-git-logs] scummvm master -> 28fbde9bff6535e65c412e98c98ff3638541e68a

fracturehill noreply at scummvm.org
Tue Jan 16 22:02:00 UTC 2024


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:
28fbde9bff NANCY: Improve hypertext token heuristic


Commit: 28fbde9bff6535e65c412e98c98ff3638541e68a
    https://github.com/scummvm/scummvm/commit/28fbde9bff6535e65c412e98c98ff3638541e68a
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2024-01-16T23:01:40+01:00

Commit Message:
NANCY: Improve hypertext token heuristic

Fixed a couple issues when handling hypertext tokens
using the new API in Common::Tokenizer:
- The sound file names that were accidentally left in some
dialogue in nancy6 scenes 1953 and 1954 no longer get
rendered as part of the text.
- Short text strings now get rendered correctly. This fixes
the HAM radio puzzle input readout.
- Hypertext tokens now have checks for proper size;
otherwise, the offending token is output to the newly
created kDebugHypertext debug channel.

Changed paths:
    engines/nancy/detection.cpp
    engines/nancy/detection.h
    engines/nancy/misc/hypertext.cpp


diff --git a/engines/nancy/detection.cpp b/engines/nancy/detection.cpp
index 6a29b1b0fea..7f3c4880cb8 100644
--- a/engines/nancy/detection.cpp
+++ b/engines/nancy/detection.cpp
@@ -36,6 +36,7 @@ static const DebugChannelDef debugFlagList[] = {
 	{ Nancy::kDebugActionRecord, "ActionRecord", "Action Record debug" },
 	{ Nancy::kDebugScene, "Scene", "Scene debug" },
 	{ Nancy::kDebugSound, "Sound", "Sound debug" },
+	{ Nancy::kDebugHypertext, "Hypertext", "Hypertext rendering debug" },
 	DEBUG_CHANNEL_END
 };
 
diff --git a/engines/nancy/detection.h b/engines/nancy/detection.h
index a4a9c14b10e..d4d2afb271f 100644
--- a/engines/nancy/detection.h
+++ b/engines/nancy/detection.h
@@ -54,7 +54,8 @@ enum NancyDebugChannels {
 	kDebugActionRecord	= 1 << 1,
 	kDebugScene			= 1 << 2,
 	kDebugSound			= 1 << 3,
-	kDebugVideo			= 1 << 4
+	kDebugVideo			= 1 << 4,
+	kDebugHypertext		= 1 << 5
 };
 
 // Settings found in the original engine
diff --git a/engines/nancy/misc/hypertext.cpp b/engines/nancy/misc/hypertext.cpp
index 4e55bc477cf..3a5bf08b4ba 100644
--- a/engines/nancy/misc/hypertext.cpp
+++ b/engines/nancy/misc/hypertext.cpp
@@ -71,7 +71,7 @@ void HypertextParser::drawAllText(const Common::Rect &textBounds, uint fontID, u
 		while(!tokenizer.empty()) {
 			curToken = tokenizer.nextToken();
 
-			if (curToken.size() <= 2) {
+			if (tokenizer.delimitersAtTokenBegin().lastChar() == '<' && tokenizer.delimitersAtTokenEnd().firstChar() == '>') {
 				switch (curToken.firstChar()) {
 				case 'i' :
 					// CC begin
@@ -80,23 +80,40 @@ void HypertextParser::drawAllText(const Common::Rect &textBounds, uint fontID, u
 					// CC end
 					// fall through
 				case 'e' :
-					// Telephone end
-					// Do nothing and just skip
+					// End conversation. Originally used for quickly ending dialogue when debugging
+					// We do nothing and just skip
+					if (curToken.size() != 1) {
+						break;
+					}
+
 					continue;
 				case 'h' :
 					// Hotspot
+					if (curToken.size() != 1) {
+						break;
+					}
+
 					if (hasHotspot) {
 						// Replace duplicate hotspot token with a newline to copy the original behavior
 						currentLine += '\n';
 					}
+
 					hasHotspot = true;
 					continue;
 				case 'n' :
 					// Newline
+					if (curToken.size() != 1) {
+						break;
+					}
+
 					currentLine += '\n';
 					continue;
 				case 't' :
 					// Tab
+					if (curToken.size() != 1) {
+						break;
+					}
+
 					currentLine += '\t';
 					continue;
 				case 'c' :
@@ -117,7 +134,14 @@ void HypertextParser::drawAllText(const Common::Rect &textBounds, uint fontID, u
 
 					colorTextChanges.push({true, numNonSpaceChars, (byte)(curToken[1] - 48)});
 					continue;
+				default:
+					break;
 				}
+
+				// Ignore non-tokens when they're between braces. This fixes nancy6 scenes 1953 & 1954,
+				// where some sound names slipped through into the text data.
+				debugC(Nancy::kDebugHypertext, "Unrecognized hypertext tag <%s>", curToken.c_str());
+				continue;
 			}
 
 			// Count the number of non-space characters. We use this to keep track




More information about the Scummvm-git-logs mailing list