diff options
author | Travis Howell | 2006-05-31 10:48:40 +0000 |
---|---|---|
committer | Travis Howell | 2006-05-31 10:48:40 +0000 |
commit | 3b1062d2d49c7017204efbe9395cca369e071aa0 (patch) | |
tree | dcf055276e024c493ff5e10599986dbe5d9b28ba /engines | |
parent | 4abec6fdb6e788559e2d2a16b6624ca19f509fa6 (diff) | |
download | scummvm-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')
-rw-r--r-- | engines/scumm/intern.h | 2 | ||||
-rw-r--r-- | engines/scumm/saveload.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/saveload.h | 2 | ||||
-rw-r--r-- | engines/scumm/script_v8.cpp | 12 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/verbs.cpp | 37 |
6 files changed, 39 insertions, 17 deletions
diff --git a/engines/scumm/intern.h b/engines/scumm/intern.h index b58d4fe9c6..d44fb63341 100644 --- a/engines/scumm/intern.h +++ b/engines/scumm/intern.h @@ -822,7 +822,7 @@ public: int32 offset; }; - int _verbCharset; + int _verbCharset, _verbLineSpacing; bool _existLanguageFile; char *_languageBuffer; LangIndexNode *_languageIndex; diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index 6f548ff499..6c8fecd2a9 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -1197,6 +1197,8 @@ void ScummEngine_v7::saveOrLoad(Serializer *s) { const SaveLoadEntry V7Entries[] = { MKLINE(ScummEngine_v7, _subtitleQueuePos, sleInt32, VER(61)), + MKLINE(ScummEngine_v7, _verbCharset, sleInt32, VER(68)), + MKLINE(ScummEngine_v7, _verbLineSpacing, sleInt32, VER(68)), MKEND() }; diff --git a/engines/scumm/saveload.h b/engines/scumm/saveload.h index 4dbb5196b1..c4723b2d31 100644 --- a/engines/scumm/saveload.h +++ b/engines/scumm/saveload.h @@ -47,7 +47,7 @@ namespace Scumm { * only saves/loads those which are valid for the version of the savegame * which is being loaded/saved currently. */ -#define CURRENT_VER 67 +#define CURRENT_VER 68 /** * An auxillary macro, used to specify savegame versions. We use this instead diff --git a/engines/scumm/script_v8.cpp b/engines/scumm/script_v8.cpp index 4e52ce3bfd..55c1aa376c 100644 --- a/engines/scumm/script_v8.cpp +++ b/engines/scumm/script_v8.cpp @@ -719,10 +719,9 @@ void ScummEngine_v8::o8_cursorCommand() { case 0xE6: // SO_CURSOR_TRANSPARENT Set cursor transparent color setCursorTransparency(pop()); break; - case 0xE7: { // SO_CHARSET_SET + case 0xE7: // SO_CHARSET_SET _verbCharset = pop(); break; - } case 0xE8: // SO_CHARSET_COLOR getStackList(args, ARRAYSIZE(args)); for (i = 0; i < 16; i++) @@ -1147,12 +1146,7 @@ void ScummEngine_v8::o8_verbOps() { vs->charset_nr = pop(); break; case 0xA7: // SO_VERB_LINE_SPACING Choose linespacing for verb - // FIXME - TODO - // Note: it seems that var596 stores the "line spacing". It is used by various - // scripts that place verbs for that. - // Also, var595 contains the vertical position at which to start placing verbs (330) - a = pop(); - debug(0, "SO_VERB_LINE_SPACING %d: not yet implemented", a); + _verbLineSpacing = pop(); break; default: error("o8_verbops: default case 0x%x", subOp); @@ -1466,7 +1460,7 @@ void ScummEngine_v8::o8_getStringWidth() { msg = transBuf; // Temporary set the specified charset id - _charset->setCurID(_string[charset].charset); + _charset->setCurID(charset); // Determine the strings width width = _charset->getStringWidth(0, msg); // Revert to old font diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 6f5e0f0317..8c3562c281 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -920,6 +920,7 @@ ScummEngine_v90he::~ScummEngine_v90he() { ScummEngine_v7::ScummEngine_v7(OSystem *syst, const DetectorResult &dr) : ScummEngine_v6(syst, dr) { _verbCharset = 0; + _verbLineSpacing = 10; _existLanguageFile = false; _languageBuffer = NULL; _languageIndex = NULL; 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 |