Ticket #2539: 1452272-2.diff

File 1452272-2.diff, 4.8 KB (added by cyxx, 18 years ago)

Patch for issue v3 (svn 30th May 2006)

  • scumm/intern.h

     
    822822                int32 offset;
    823823        };
    824824       
    825         int _verbCharset;
     825        int _verbCharset, _verbLineSpacing;
    826826        bool _existLanguageFile;
    827827        char *_languageBuffer;
    828828        LangIndexNode *_languageIndex;
  • scumm/scumm.cpp

     
    920920ScummEngine_v7::ScummEngine_v7(OSystem *syst, const DetectorResult &dr)
    921921        : ScummEngine_v6(syst, dr) {
    922922        _verbCharset = 0;
     923        _verbLineSpacing = 10;
    923924        _existLanguageFile = false;
    924925        _languageBuffer = NULL;
    925926        _languageIndex = NULL;
  • scumm/verbs.cpp

     
    687687                while (*msg == 0xFF)
    688688                        msg += 4;
    689689
    690                 enqueueText(msg, vs->curRect.left, vs->curRect.top, color, vs->charset_nr, vs->center);
    691 
    692690                // Set the specified charset id
     691                int oldID = _charset->getCurID();
    693692                _charset->setCurID(vs->charset_nr);
    694693
    695694                // Compute the text rect
    696695                vs->curRect.right = 0;
    697696                vs->curRect.bottom = 0;
    698                 while (*msg) {
    699                         const int charWidth = _charset->getCharWidth(*msg);
    700                         const int charHeight = _charset->getCharHeight(*msg);
     697                const byte *msg2 = msg;
     698                while (*msg2) {
     699                        const int charWidth = _charset->getCharWidth(*msg2);
     700                        const int charHeight = _charset->getCharHeight(*msg2);
    701701                        vs->curRect.right += charWidth;
    702702                        if (vs->curRect.bottom < charHeight)
    703703                                vs->curRect.bottom = charHeight;
    704                         msg++;
     704                        msg2++;
    705705                }
    706706                vs->curRect.right += vs->curRect.left;
    707707                vs->curRect.bottom += vs->curRect.top;
    708708                vs->oldRect = vs->curRect;
     709
     710                const int maxWidth = _screenWidth - vs->curRect.left;
     711                if (_charset->getStringWidth(0, buf) > maxWidth && _game.version == 8) {
     712                        byte tmpBuf[384];
     713                        memcpy(tmpBuf, msg, 384);
     714
     715                        int len = resStrLen(tmpBuf) - 1;
     716                        while (len >= 0) {
     717                                if (tmpBuf[len] == ' ') {
     718                                        tmpBuf[len] = 0;
     719                                        if (_charset->getStringWidth(0, tmpBuf) <= maxWidth) {
     720                                                break;
     721                                        }
     722                                }
     723                                --len;
     724                        }
     725                        enqueueText(tmpBuf, vs->curRect.left, vs->curRect.top, color, vs->charset_nr, vs->center);
     726                        if (len >= 0) {
     727                                enqueueText(&msg[len + 1], vs->curRect.left, vs->curRect.top + _verbLineSpacing, color, vs->charset_nr, vs->center);
     728                                vs->curRect.bottom += _verbLineSpacing;
     729                        }
     730                } else {
     731                        enqueueText(msg, vs->curRect.left, vs->curRect.top, color, vs->charset_nr, vs->center);
     732                }
     733                _charset->setCurID(oldID);
    709734        }
    710735}
    711736#endif
  • scumm/saveload.cpp

     
    11971197
    11981198        const SaveLoadEntry V7Entries[] = {
    11991199                MKLINE(ScummEngine_v7, _subtitleQueuePos, sleInt32, VER(61)),
     1200                MKLINE(ScummEngine_v7, _verbCharset, sleInt32, VER(68)),
     1201                MKLINE(ScummEngine_v7, _verbLineSpacing, sleInt32, VER(68)),
    12001202                MKEND()
    12011203        };
    12021204
  • scumm/script_v8.cpp

     
    719719        case 0xE6:              // SO_CURSOR_TRANSPARENT Set cursor transparent color
    720720                setCursorTransparency(pop());
    721721                break;
    722         case 0xE7: {    // SO_CHARSET_SET
     722        case 0xE7:              // SO_CHARSET_SET
    723723                _verbCharset = pop();
    724724                break;
    725         }
    726725        case 0xE8:              // SO_CHARSET_COLOR
    727726                getStackList(args, ARRAYSIZE(args));
    728727                for (i = 0; i < 16; i++)
     
    11471146                vs->charset_nr = pop();
    11481147                break;
    11491148        case 0xA7:              // SO_VERB_LINE_SPACING Choose linespacing for verb
    1150                 // FIXME - TODO
    1151                 // Note: it seems that var596 stores the "line spacing". It is used by various
    1152                 // scripts that place verbs for that.
    1153                 // Also, var595 contains the vertical position at which to start placing verbs (330)
    1154                 a = pop();
    1155                 debug(0, "SO_VERB_LINE_SPACING %d: not yet implemented", a);
     1149                _verbLineSpacing = pop();
    11561150                break;
    11571151        default:
    11581152                error("o8_verbops: default case 0x%x", subOp);
     
    14661460        msg = transBuf;
    14671461
    14681462        // Temporary set the specified charset id
    1469         _charset->setCurID(_string[charset].charset);
     1463        _charset->setCurID(charset);
    14701464        // Determine the strings width
    14711465        width = _charset->getStringWidth(0, msg);
    14721466        // Revert to old font
  • scumm/saveload.h

     
    4747 * only saves/loads those which are valid for the version of the savegame
    4848 * which is being loaded/saved currently.
    4949 */
    50 #define CURRENT_VER 67
     50#define CURRENT_VER 68
    5151
    5252/**
    5353 * An auxillary macro, used to specify savegame versions. We use this instead