Ticket #8260: linc-charset-fixes.diff

File linc-charset-fixes.diff, 4.0 KB (added by eriktorbjorn, 21 years ago)

Patch against a July 15 CVS snapshot

  • scummvm/sky/text.cpp

    diff -ur ScummVM-cvs20030715/scummvm/sky/text.cpp ScummVM-cvs20030715+hack/scummvm/sky/text.cpp
    old new  
    5050                _controlCharacterSet.charHeight = 12;
    5151                _controlCharacterSet.charSpacing = 0;
    5252
    53                 // In version 0.0288, decrease the character width for the
    54                 // LINC terminal font by one for every character, except
    55                 // space which has to be one pixel wider instead.
    56                 if (SkyState::_systemVars.gameVersion == 288) {
    57                         for (int i = 1; i < CHAR_SET_HEADER; i++)
    58                                 _controlCharacterSet.addr[i]--;
    59                         _controlCharacterSet.addr[0]++;
    60                 }
    61                
    6253                _linkCharacterSet.addr = _skyDisk->loadFile(60521, NULL);
    6354                _linkCharacterSet.charHeight = 12;
    6455                _linkCharacterSet.charSpacing = 1;
     56
     57                patchLINCCharset();
    6558        } else {
    6659                _controlCharacterSet.addr = NULL;
    6760                _linkCharacterSet.addr = NULL;
     
    7972        if (_preAfterTableArea) free(_preAfterTableArea);
    8073}
    8174
     75void SkyText::patchChar(byte *charSetPtr, int width, int height, int c, const uint16 *data) {
     76        byte *ptr = charSetPtr + (CHAR_SET_HEADER + (height << 2) * c);
     77
     78        charSetPtr[c] = width;
     79
     80        for (int i = 0; i < height; i++) {
     81                ptr[i * 4 + 0] = ptr[i * 4 + 2] = (data[i] & 0xFF00) >> 8;
     82                ptr[i * 4 + 1] = ptr[i * 4 + 3] = data[i] & 0x00FF;
     83        }
     84}
     85
     86void SkyText::patchLINCCharset() {
     87        // The LINC terminal charset looks strange in some cases. This
     88        // function attempts to patch up the worst blemishes.
     89
     90        byte *charSetPtr = _controlCharacterSet.addr;
     91        int charHeight = _controlCharacterSet.charHeight;
     92
     93        // In v0.0288, decrease the character spacing is too wide. Decrease
     94        // the width for every character by one, except for space which needs
     95        // to be one pixel wider than before.
     96
     97        if (SkyState::_systemVars.gameVersion == 288) {
     98                for (int i = 1; i < CHAR_SET_HEADER; i++)
     99                        charSetPtr[i]--;
     100                charSetPtr[0]++;
     101        }
     102
     103        // NOTE: I have only tested this part of the code with v0.0372
     104
     105        // Several characters are different in this charset than in the other
     106        // two. This is particularly noticeable when using a non-English
     107        // version.
     108
     109        const uint16 slash[] = {
     110                0x0000, 0x0000, 0x0000, 0x0800, 0x1000, 0x1000,
     111                0x2000, 0x2000, 0x4000, 0x0000, 0x0000, 0x0000
     112        };
     113
     114        const uint16 lt[] = {
     115                0x0000, 0x0000, 0x0800, 0x1000, 0x2000, 0x4000,
     116                0x2000, 0x1000, 0x0800, 0x0000, 0x0000, 0x0000
     117        };
     118
     119        const uint16 gt[] = {
     120                0x0000, 0x0000, 0x4000, 0x2000, 0x1000, 0x0800,
     121                0x1000, 0x2000, 0x4000, 0x0000, 0x0000, 0x0000
     122        };
     123
     124        const uint16 o_umlaut[] = {
     125                0x0000, 0x0000, 0x4800, 0x0000, 0x3000, 0x4800,
     126                0x4800, 0x4800, 0x3000, 0x0000, 0x0000, 0x0000
     127        };
     128
     129        const uint16 O_umlaut[] = {
     130                0x0000, 0x4800, 0x0000, 0x3000, 0x4800, 0x4800,
     131                0x4800, 0x4800, 0x3000, 0x0000, 0x0000, 0x0000
     132        };
     133
     134        const uint16 A_umlaut[] = {
     135                0x0000, 0x4800, 0x0000, 0x3000, 0x4800, 0x4800,
     136                0x7800, 0x4800, 0x4800, 0x0000, 0x0000, 0x0000
     137        };
     138
     139        // Used by, for instance, the BRIEFING.DOC file in all (?) languages
     140        patchChar(charSetPtr, 5, charHeight, 96, lt);
     141        patchChar(charSetPtr, 5, charHeight, 97, gt);
     142        patchChar(charSetPtr, 5, charHeight, 98, slash);
     143
     144        // Needed for the Swedish translation. Possibly others as well.
     145        patchChar(charSetPtr, 5, charHeight, 9, o_umlaut);
     146        patchChar(charSetPtr, 5, charHeight, 94, A_umlaut);
     147        patchChar(charSetPtr, 5, charHeight, 95, O_umlaut);
     148}
     149
    82150void SkyText::fnSetFont(uint32 fontNr) {
    83151
    84152        struct charSet *newCharSet;
  • scummvm/sky/text.h

    diff -ur ScummVM-cvs20030715/scummvm/sky/text.h ScummVM-cvs20030715+hack/scummvm/sky/text.h
    old new  
    4848        uint32 giveCurrentCharSet(void) { return _curCharSet; };
    4949
    5050protected:
     51        void patchChar(byte *charSetPtr, int width, int height, int c, const uint16 *data);
     52        void patchLINCCharset();
     53
    5154        bool getTBit();
    5255        void initHuffTree();
    5356        char getTextChar();