aboutsummaryrefslogtreecommitdiff
path: root/engines/draci
diff options
context:
space:
mode:
authorDenis Kasak2009-07-25 23:43:21 +0000
committerDenis Kasak2009-07-25 23:43:21 +0000
commit3f571c7eae6ebdce030bf81cb0d7667dfc076bc7 (patch)
treedc7d0d4489192a366bd092ca13e493e3d14b923c /engines/draci
parent20a744bdd2bc889fdb1a460768c13f8be2d60d09 (diff)
downloadscummvm-rg350-3f571c7eae6ebdce030bf81cb0d7667dfc076bc7.tar.gz
scummvm-rg350-3f571c7eae6ebdce030bf81cb0d7667dfc076bc7.tar.bz2
scummvm-rg350-3f571c7eae6ebdce030bf81cb0d7667dfc076bc7.zip
Handled the '|' char correctly when drawing text (it serves as both a newline and end-of-string marker).
svn-id: r42788
Diffstat (limited to 'engines/draci')
-rw-r--r--engines/draci/font.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/engines/draci/font.cpp b/engines/draci/font.cpp
index f1ef984adf..23d0740268 100644
--- a/engines/draci/font.cpp
+++ b/engines/draci/font.cpp
@@ -211,15 +211,24 @@ void Font::drawString(Surface *dst, const byte *str, uint len,
assert(y >= 0);
int curx = x;
+ int cury = y;
for (unsigned int i = 0; i < len; ++i) {
+
+ // If we encounter the '|' char (newline and end of string marker),
+ // skip it and go to the start of the next line
+ if (str[i] == '|') {
+ cury += getFontHeight() + 1;
+ curx = x;
+ continue;
+ }
// Return early if there's no more space on the screen
- if (curx >= dst->w) {
+ if (curx >= dst->w || cury >= dst->h) {
return;
}
-
- drawChar(dst, str[i], curx, y, markDirty);
+
+ drawChar(dst, str[i], curx, cury, markDirty);
curx += getCharWidth(str[i]) + spacing;
}
}