aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scumm/script_v2.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp
index 423ce5c945..7b6eba0005 100644
--- a/scumm/script_v2.cpp
+++ b/scumm/script_v2.cpp
@@ -987,7 +987,20 @@ void Scumm_v2::o2_drawSentence() {
else
_string[2].color = 13;
- sentence[41] = 0; // Maximal length: 40 characters
+ char *ptr = sentence;
+ int n = 0;
+
+ // Maximum length: 40 printable characters
+ while (*ptr != 0) {
+ if (*ptr != '@')
+ n++;
+ if (n > 40) {
+ *ptr = 0;
+ break;
+ }
+ ptr++;
+ }
+
_messagePtr = (byte*)sentence;
sentenceline.top = virtscr[2].topline;