aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/support
diff options
context:
space:
mode:
authorPaul Gilbert2016-04-25 20:38:23 -0400
committerPaul Gilbert2016-07-10 16:12:02 -0400
commit1512545f28c805fd4083be746220f77b72463130 (patch)
tree9d9e6ea5e6499d0e90b5bebeba3d58e3731b3455 /engines/titanic/support
parent36faf0890fec6bab90531ade42c0eb924b31b64a (diff)
downloadscummvm-rg350-1512545f28c805fd4083be746220f77b72463130.tar.gz
scummvm-rg350-1512545f28c805fd4083be746220f77b72463130.tar.bz2
scummvm-rg350-1512545f28c805fd4083be746220f77b72463130.zip
TITANIC: Resolve color handling code in CPetText
Diffstat (limited to 'engines/titanic/support')
-rw-r--r--engines/titanic/support/font.cpp10
-rw-r--r--engines/titanic/support/font.h2
2 files changed, 7 insertions, 5 deletions
diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp
index e903abaf97..819eaadb33 100644
--- a/engines/titanic/support/font.cpp
+++ b/engines/titanic/support/font.cpp
@@ -84,9 +84,9 @@ int STFont::getTextBounds(const CString &str, int maxWidth, Point *sizeOut) cons
// Loop through the characters of the string
if (!str.empty()) {
for (const char *strP = str.c_str(); *strP; ++strP) {
- if (*strP == 26) {
+ if (*strP == TEXTCMD_26) {
strP += 3;
- } else if (*strP == 27) {
+ } else if (*strP == TEXTCMD_SET_COLOR) {
strP += 4;
} else {
if (*strP == ' ') {
@@ -116,7 +116,7 @@ int STFont::stringWidth(const CString &text) const {
if (c == 26) {
// Skip over command parameter bytes
srcP += 3;
- } else if (c == 27) {
+ } else if (c == TEXTCMD_SET_COLOR) {
// Skip over command parameter bytes
srcP += 4;
} else if (c != '\n') {
@@ -211,9 +211,9 @@ void STFont::checkLineWrap(Point &textSize, int maxWidth, const char *&str) cons
if (*srcPtr == ' ' && flag)
break;
- if (*srcPtr == 26)
+ if (*srcPtr == TEXTCMD_26)
srcPtr += 3;
- else if (*srcPtr == 27)
+ else if (*srcPtr == TEXTCMD_SET_COLOR)
srcPtr += 4;
else
totalWidth += _chars[*srcPtr]._width;
diff --git a/engines/titanic/support/font.h b/engines/titanic/support/font.h
index 4bb1b2e6d6..087680e933 100644
--- a/engines/titanic/support/font.h
+++ b/engines/titanic/support/font.h
@@ -30,6 +30,8 @@
namespace Titanic {
+enum TextCommand { TEXTCMD_26 = 26, TEXTCMD_SET_COLOR = 27 };
+
class CVideoSurface;
class STFont {