aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/pet_control/pet_text.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-11-04 20:53:42 -0400
committerPaul Gilbert2016-11-04 20:53:42 -0400
commitf89b0e8c45ba5fedff1d1baf5ce8fab0129ceb14 (patch)
tree2d05ffd62d1c23935fea270e6c1e871028c80674 /engines/titanic/pet_control/pet_text.cpp
parent3fb2beb57ebdd75b4cfa18f68c9a871b47e61aca (diff)
downloadscummvm-rg350-f89b0e8c45ba5fedff1d1baf5ce8fab0129ceb14.tar.gz
scummvm-rg350-f89b0e8c45ba5fedff1d1baf5ce8fab0129ceb14.tar.bz2
scummvm-rg350-f89b0e8c45ba5fedff1d1baf5ce8fab0129ceb14.zip
TITANIC: Fixes to show speaking NPC image in conversation view
Diffstat (limited to 'engines/titanic/pet_control/pet_text.cpp')
-rw-r--r--engines/titanic/pet_control/pet_text.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp
index 78dceb7a31..97bb0be02d 100644
--- a/engines/titanic/pet_control/pet_text.cpp
+++ b/engines/titanic/pet_control/pet_text.cpp
@@ -173,7 +173,7 @@ void CPetText::draw(CScreenManager *screenManager) {
tempRect.grow(-2);
int oldFontNumber = screenManager->setFontNumber(_fontNumber);
- screenManager->writeString(SURFACE_BACKBUFFER, tempRect, _scrollTop, _lines, _textCursor);
+ _linesStart = screenManager->writeString(SURFACE_BACKBUFFER, tempRect, _scrollTop, _lines, _textCursor);
screenManager->setFontNumber(oldFontNumber);
}
@@ -450,7 +450,7 @@ void CPetText::hideCursor() {
}
}
-int CPetText::getNPCNum(uint npcId, uint startIndex) {
+int CPetText::getNPCNum(uint ident, uint startIndex) {
if (!_stringsMerged) {
mergeStrings();
if (!_stringsMerged)
@@ -461,18 +461,20 @@ int CPetText::getNPCNum(uint npcId, uint startIndex) {
if (startIndex < 5 || startIndex >= size)
return -1;
- // Loop through string
- for (const char *strP = _lines.c_str(); size >= 5; ++strP, --size) {
+ // Loop backwards from the starting index to find an NPC ident sequence
+ for (const char *strP = _lines.c_str() + startIndex;
+ strP >= (_lines.c_str() + 5); --strP) {
if (*strP == 26) {
byte id = *(strP - 2);
- if (id == npcId)
+ if (id == ident)
return *(strP - 1);
+ strP -= 3;
} else if (*strP == 27) {
- strP += 4;
+ strP -= 4;
}
}
- return - 1;
+ return -1;
}
void CPetText::setFontNumber(int fontNumber) {