| 75 | void 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 | |
| 86 | void 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 | |