[Scummvm-git-logs] scummvm master -> f89b0e8c45ba5fedff1d1baf5ce8fab0129ceb14

dreammaster dreammaster at scummvm.org
Sat Nov 5 01:53:47 CET 2016


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:
f89b0e8c45 TITANIC: Fixes to show speaking NPC image in conversation view


Commit: f89b0e8c45ba5fedff1d1baf5ce8fab0129ceb14
    https://github.com/scummvm/scummvm/commit/f89b0e8c45ba5fedff1d1baf5ce8fab0129ceb14
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-11-04T20:53:42-04:00

Commit Message:
TITANIC: Fixes to show speaking NPC image in conversation view

Changed paths:
    engines/titanic/pet_control/pet_conversations.cpp
    engines/titanic/pet_control/pet_text.cpp
    engines/titanic/pet_control/pet_text.h



diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp
index b534136..03cdefb 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 78dceb7..97bb0be 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 0a6bb2d..a48ab91 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





More information about the Scummvm-git-logs mailing list