aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/verbs.cpp
diff options
context:
space:
mode:
authorTravis Howell2006-05-31 10:48:40 +0000
committerTravis Howell2006-05-31 10:48:40 +0000
commit3b1062d2d49c7017204efbe9395cca369e071aa0 (patch)
treedcf055276e024c493ff5e10599986dbe5d9b28ba /engines/scumm/verbs.cpp
parent4abec6fdb6e788559e2d2a16b6624ca19f509fa6 (diff)
downloadscummvm-rg350-3b1062d2d49c7017204efbe9395cca369e071aa0.tar.gz
scummvm-rg350-3b1062d2d49c7017204efbe9395cca369e071aa0.tar.bz2
scummvm-rg350-3b1062d2d49c7017204efbe9395cca369e071aa0.zip
Add patch for bug #1452272 - COMI: Verb strings aren't wrapped
svn-id: r22793
Diffstat (limited to 'engines/scumm/verbs.cpp')
-rw-r--r--engines/scumm/verbs.cpp37
1 files changed, 31 insertions, 6 deletions
diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp
index 6462526fe6..110b7d0708 100644
--- a/engines/scumm/verbs.cpp
+++ b/engines/scumm/verbs.cpp
@@ -687,25 +687,50 @@ void ScummEngine_v7::drawVerb(int verb, int mode) {
while (*msg == 0xFF)
msg += 4;
- enqueueText(msg, vs->curRect.left, vs->curRect.top, color, vs->charset_nr, vs->center);
-
// Set the specified charset id
+ int oldID = _charset->getCurID();
_charset->setCurID(vs->charset_nr);
// Compute the text rect
vs->curRect.right = 0;
vs->curRect.bottom = 0;
- while (*msg) {
- const int charWidth = _charset->getCharWidth(*msg);
- const int charHeight = _charset->getCharHeight(*msg);
+ const byte *msg2 = msg;
+ while (*msg2) {
+ const int charWidth = _charset->getCharWidth(*msg2);
+ const int charHeight = _charset->getCharHeight(*msg2);
vs->curRect.right += charWidth;
if (vs->curRect.bottom < charHeight)
vs->curRect.bottom = charHeight;
- msg++;
+ msg2++;
}
vs->curRect.right += vs->curRect.left;
vs->curRect.bottom += vs->curRect.top;
vs->oldRect = vs->curRect;
+
+ const int maxWidth = _screenWidth - vs->curRect.left;
+ if (_charset->getStringWidth(0, buf) > maxWidth && _game.version == 8) {
+ byte tmpBuf[384];
+ memcpy(tmpBuf, msg, 384);
+
+ int len = resStrLen(tmpBuf) - 1;
+ while (len >= 0) {
+ if (tmpBuf[len] == ' ') {
+ tmpBuf[len] = 0;
+ if (_charset->getStringWidth(0, tmpBuf) <= maxWidth) {
+ break;
+ }
+ }
+ --len;
+ }
+ enqueueText(tmpBuf, vs->curRect.left, vs->curRect.top, color, vs->charset_nr, vs->center);
+ if (len >= 0) {
+ enqueueText(&msg[len + 1], vs->curRect.left, vs->curRect.top + _verbLineSpacing, color, vs->charset_nr, vs->center);
+ vs->curRect.bottom += _verbLineSpacing;
+ }
+ } else {
+ enqueueText(msg, vs->curRect.left, vs->curRect.top, color, vs->charset_nr, vs->center);
+ }
+ _charset->setCurID(oldID);
}
}
#endif