Add patch for bug #1452272 - COMI: Verb strings aren't wrapped

svn-id: r22793
This commit is contained in:
Travis Howell 2006-05-31 10:48:40 +00:00
parent 4abec6fdb6
commit 3b1062d2d4
6 changed files with 39 additions and 17 deletions

View File

@ -822,7 +822,7 @@ public:
int32 offset;
};
int _verbCharset;
int _verbCharset, _verbLineSpacing;
bool _existLanguageFile;
char *_languageBuffer;
LangIndexNode *_languageIndex;

View File

@ -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()
};

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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