Ticket #8625: dialog_charset_glitch.patch

File dialog_charset_glitch.patch, 2.2 KB (added by SF/tobigun, 17 years ago)
  • engines/scumm/string.cpp

     
    646646
    647647void ScummEngine::drawString(int a, const byte *msg) {
    648648        byte buf[270];
    649         byte *space;
     649        //byte *space;
    650650        int i, c;
    651651        byte fontHeight = 0;
    652652        uint color;
     
    688688
    689689        fontHeight = _charset->getFontHeight();
    690690
     691        //* REPLACED: Is trimming necessary? Trimming deletes spaces when
     692        //* editing a savegame name in the original SAVE/LOAD-dialog of Scumm-V3 games, e.g. Indy3.
     693        //* When entering a name in those dialogs trailing spaces will not be shown because they are trimmed.
     694        //* If it's needed, trim only if (_charset->_center == true) or
     695        //* trim a copy of buf to determine the string-width for centering.
     696        //* Disabling this section also fixes the Indy3 Grail Diary issue mentioned below.
     697        //
    691698        // trim from the right
    692         byte *tmp = buf;
    693         space = NULL;
    694         while (*tmp) {
    695                 if (*tmp == ' ') {
    696                         if (!space)
    697                                 space = tmp;
    698                 } else {
    699                         space = NULL;
    700                 }
    701                 tmp++;
    702         }
    703         if (space)
    704                 *space = '\0';
     699        //byte *tmp = buf;
     700        //space = NULL;
     701        //while (*tmp) {
     702        //      if (*tmp == ' ') {
     703        //              if (!space)
     704        //                      space = tmp;
     705        //      } else {
     706        //              space = NULL;
     707        //      }
     708        //      tmp++;
     709        //}
     710        //if (space)
     711        //      *space = '\0';
     712
    705713        if (_charset->_center) {
    706714                _charset->_left -= _charset->getStringWidth(a, buf) / 2;
    707715        }
    708716
    709717        if (!buf[0]) {
    710                 buf[0] = ' ';
    711                 buf[1] = 0;
     718                //* REPLACED: Does not work with the original SAVE/LOAD-dialog (e.g. indy3).
     719                //* If you clicked on an empty savegame slot the name was displayed as " " instead
     720                //* of "".
     721                //buf[0] = ' ';
     722                //buf[1] = 0;
     723
     724                _charset->_str.left = _charset->_left;
     725                _charset->_str.top = _charset->_top;
     726                _charset->_str.right = _charset->_left;
     727                _charset->_str.bottom = _charset->_top;
    712728        }
    713729
    714730        for (i = 0; (c = buf[i++]) != 0;) {
     
    798814                _nextTop = _charset->_top;
    799815        }
    800816
    801         _string[a].xpos = _charset->_str.right + 8;     // Indy3: Fixes Grail Diary text positioning
     817        _string[a].xpos = _charset->_str.right; // + 8; Indy3: Fixes Grail Diary text positioning
    802818}
    803819
    804820int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize) {