aboutsummaryrefslogtreecommitdiff
path: root/engines
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
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')
-rw-r--r--engines/titanic/pet_control/pet_conversations.cpp2
-rw-r--r--engines/titanic/pet_control/pet_text.cpp16
-rw-r--r--engines/titanic/pet_control/pet_text.h2
3 files changed, 11 insertions, 9 deletions
diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp
index b534136eaf..03cdefbd34 100644
--- a/engines/titanic/pet_control/pet_conversations.cpp
+++ b/engines/titanic/pet_control/pet_conversations.cpp
@@ -120,7 +120,7 @@ void CPetConversations::draw(CScreenManager *screenManager) {
if (startIndex >= 0) {
int npcNum = _log.getNPCNum(1, startIndex);
if (npcNum > 0 && npcNum < 10)
- _npcNum = npcNum;
+ _npcNum = npcNum - 1;
}
_logChanged = false;
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) {
diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h
index 0a6bb2d03d..a48ab91117 100644
--- a/engines/titanic/pet_control/pet_text.h
+++ b/engines/titanic/pet_control/pet_text.h
@@ -247,7 +247,7 @@ public:
* Get an NPC Number embedded within on-screen text.
* Used by the PET log to encode which NPC spoke
*/
- int getNPCNum(uint npcId, uint startIndex);
+ int getNPCNum(uint ident, uint startIndex);
/**
* Replaces any occurances of line colors that appear in the