aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/pet_control/pet_conversations.cpp11
-rw-r--r--engines/titanic/pet_control/pet_conversations.h5
-rw-r--r--engines/titanic/pet_control/pet_text.cpp25
-rw-r--r--engines/titanic/pet_control/pet_text.h10
4 files changed, 50 insertions, 1 deletions
diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp
index 090952dbe2..76d293208b 100644
--- a/engines/titanic/pet_control/pet_conversations.cpp
+++ b/engines/titanic/pet_control/pet_conversations.cpp
@@ -88,7 +88,11 @@ bool CPetConversations::reset() {
_textInput.setColor(col);
_textInput.setLineColor(0, col);
- warning("TODO: Setup log shaded palette?");
+ // Replace the log colors with new 1st class ones
+ uint colors1[5], colors2[5];
+ copyColors(2, colors1);
+ copyColors(1, colors2);
+ _log.remapColors(5, colors1, colors2);
_log.setColor(getColor(2));
}
@@ -479,4 +483,9 @@ CString CPetConversations::getActiveNPCName() const {
return CString();
}
+void CPetConversations::copyColors(uint tableNum, uint colors[5]) {
+ const uint *src = getColorTable(tableNum);
+ Common::copy(src, src + 5, colors);
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h
index 1bc59419f1..57c7fbd9b2 100644
--- a/engines/titanic/pet_control/pet_conversations.h
+++ b/engines/titanic/pet_control/pet_conversations.h
@@ -126,6 +126,11 @@ private:
* Returns the name of the currently active NPC, if any
*/
CString getActiveNPCName() const;
+
+ /**
+ * Create a color table
+ */
+ void copyColors(uint tableNum, uint colors[5]);
public:
CPetConversations();
virtual ~CPetConversations() {}
diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp
index a1cc75cb42..1065e6f825 100644
--- a/engines/titanic/pet_control/pet_text.cpp
+++ b/engines/titanic/pet_control/pet_text.cpp
@@ -234,6 +234,31 @@ void CPetText::setColor(byte r, byte g, byte b) {
_textB = b;
}
+void CPetText::remapColors(uint count, uint *srcColors, uint *destColors) {
+ if (_lineCount >= 0) {
+ int lineNum = 0;
+ int index1 = 0;
+
+ for (int lineNum = 0; lineNum <= _lineCount; ++lineNum) {
+ // Get the rgb values
+ uint r = _array[lineNum]._rgb[1];
+ uint g = _array[lineNum]._rgb[2];
+ uint b = _array[lineNum]._rgb[3];
+ uint color = r | (g << 8) | (b << 16);
+
+ for (uint index = 0; index < count; ++index) {
+ if (color == srcColors[index]) {
+ // Found a match, so replace the color
+ setLineColor(lineNum, destColors[lineNum]);
+ break;
+ }
+ }
+ }
+ }
+
+ _stringsMerged = false;
+}
+
void CPetText::setMaxCharsPerLine(int maxChars) {
if (maxChars >= -1 && maxChars < 257)
_maxCharsPerLine = maxChars;
diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h
index adbd1401ea..930bf3da8b 100644
--- a/engines/titanic/pet_control/pet_text.h
+++ b/engines/titanic/pet_control/pet_text.h
@@ -242,7 +242,17 @@ public:
*/
void hideCursor();
+ /**
+ * 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);
+
+ /**
+ * Replaces any occurances of line colors that appear in the
+ * first list with the entry at the same index in the dest list
+ */
+ void remapColors(uint count, uint *srcColors, uint *destColors);
};
} // End of namespace Titanic