[Scummvm-git-logs] scummvm master -> 9a09449e8807d2f9d867370eacdfc1ee53466aeb
bluegr
bluegr at gmail.com
Sat Aug 21 19:29:14 UTC 2021
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:
9a09449e88 PRINCE: Fix display of multiple phrases (#3298)
Commit: 9a09449e8807d2f9d867370eacdfc1ee53466aeb
https://github.com/scummvm/scummvm/commit/9a09449e8807d2f9d867370eacdfc1ee53466aeb
Author: aviloria (aviloria at yahoo.com)
Date: 2021-08-21T22:29:11+03:00
Commit Message:
PRINCE: Fix display of multiple phrases (#3298)
When examining an object, if the description has multiple phrases, only the first one was displayed on the screen (but speech audio continues).
Thant's because multiple phrases are encoded in the same string using '\0' separator, so strcpy/strncpy should be avoided.
Changed paths:
engines/prince/script.cpp
diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp
index 299ce8a958..d7436f0b2a 100644
--- a/engines/prince/script.cpp
+++ b/engines/prince/script.cpp
@@ -1025,7 +1025,11 @@ void Interpreter::O_GETMOBTEXT() {
int32 mob = readScriptFlagValue();
debugInterpreter("O_GETMOBTEXT mob %d", mob);
_currentString = _vm->_locationNr * 100 + mob + 60001;
- strncpy((char *)_stringBuf, _vm->_mobList[mob]._examText.c_str(), 1023);
+ // Use memcpy() instead of strncpy() because the examination text can contain
+ // different phrases separated by '\0' characters, followed by an ID.
+ // The examination text ends for a mob if the ID is 0xFF.
+ // Strings are properly extracted by the interpreter in that format.
+ memcpy((char *)_stringBuf, _vm->_mobList[mob]._examText.c_str(), 1023);
_string = _stringBuf;
}
More information about the Scummvm-git-logs
mailing list