diff options
author | Torbjörn Andersson | 2007-03-22 18:49:42 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2007-03-22 18:49:42 +0000 |
commit | 86a60b633d1b4835a9152427fb7e3fe3e4034672 (patch) | |
tree | 2e3e5787b1ff4040bc6578abcc5f966762cbe79c /engines | |
parent | 2964bed5d203cc99a63681d5fe2438f6731ac051 (diff) | |
download | scummvm-rg350-86a60b633d1b4835a9152427fb7e3fe3e4034672.tar.gz scummvm-rg350-86a60b633d1b4835a9152427fb7e3fe3e4034672.tar.bz2 scummvm-rg350-86a60b633d1b4835a9152427fb7e3fe3e4034672.zip |
Fixed long-standing font bug. We were using the control panel font for LINC
space and terminals, and the LINC font for the control panel. Since these fonts
contain different sets of characters, this would often cause the wrong
character to be displayed, particularly in non-English languages. This also
explains why we had to use the "wrong" font for the control panel recently.
The functions to patch the LINC character set (actually the control character
set) should no longer be needed, and have been removed.
Should fix bug #1669564.
svn-id: r26275
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sky/control.cpp | 6 | ||||
-rw-r--r-- | engines/sky/text.cpp | 195 | ||||
-rw-r--r-- | engines/sky/text.h | 2 |
3 files changed, 5 insertions, 198 deletions
diff --git a/engines/sky/control.cpp b/engines/sky/control.cpp index d40aad5ad5..b795bf3c7b 100644 --- a/engines/sky/control.cpp +++ b/engines/sky/control.cpp @@ -437,7 +437,7 @@ void Control::doLoadSavePanel(void) { _savedMouse = _skyMouse->giveCurrentMouseType(); _savedCharSet = _skyText->giveCurrentCharSet(); - _skyText->fnSetFont(1); + _skyText->fnSetFont(2); _skyMouse->spriteMouse(MOUSE_NORMAL, 0, 0); _lastButton = -1; _curButtonText = 0; @@ -462,7 +462,7 @@ void Control::doControlPanel(void) { initPanel(); _savedCharSet = _skyText->giveCurrentCharSet(); - _skyText->fnSetFont(1); + _skyText->fnSetFont(2); _skyScreen->clearScreen(); if (SkyEngine::_systemVars.gameVersion < 331) @@ -1493,7 +1493,7 @@ uint16 Control::quickXRestore(uint16 slot) { _mouseClicked = false; _savedCharSet = _skyText->giveCurrentCharSet(); - _skyText->fnSetFont(1); + _skyText->fnSetFont(2); _system->copyRectToScreen(_screenBuf, GAME_SCREEN_WIDTH, 0, 0, FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT); _system->updateScreen(); diff --git a/engines/sky/text.cpp b/engines/sky/text.cpp index a3ec4d1593..93af603257 100644 --- a/engines/sky/text.cpp +++ b/engines/sky/text.cpp @@ -62,8 +62,6 @@ Text::Text(Disk *skyDisk, SkyCompact *skyCompact) { _linkCharacterSet.addr = _skyDisk->loadFile(60521); _linkCharacterSet.charHeight = 12; _linkCharacterSet.charSpacing = 1; - - patchLINCCharset(); } else { _controlCharacterSet.addr = NULL; _linkCharacterSet.addr = NULL; @@ -85,195 +83,6 @@ Text::~Text(void) { free(_linkCharacterSet.addr); } -void Text::patchChar(byte *charSetPtr, int width, int height, int c, const uint16 *data) { - byte *ptr = charSetPtr + (CHAR_SET_HEADER + (height << 2) * c); - - charSetPtr[c] = width; - - for (int i = 0; i < height; i++) { - ptr[i * 4 + 0] = (data[i] & 0xFF00) >> 8; - ptr[i * 4 + 1] = data[i] & 0x00FF; - ptr[i * 4 + 2] = (data[i + height] & 0xFF00) >> 8; - ptr[i * 4 + 3] = data[i + height] & 0x00FF; - } -} - -void Text::patchLINCCharset() { - // The LINC terminal charset looks strange in some cases. This - // function attempts to patch up the worst blemishes. - - byte *charSetPtr = _controlCharacterSet.addr; - int charHeight = _controlCharacterSet.charHeight; - - // In v0.0288, the character spacing is too wide. Decrease the width - // for every character by one, except for space which needs to be one - // pixel wider than before. - - if (SkyEngine::_systemVars.gameVersion == 288 || SkyEngine::_systemVars.gameVersion == 303) { - for (int i = 1; i < CHAR_SET_HEADER; i++) - charSetPtr[i]--; - charSetPtr[0]++; - } - - // NOTE: I have only tested this part of the code with v0.0372 - - // Several characters are different in this charset than in the other - // two. This is particularly noticeable when using a non-English - // version. - - // Since the same character data is used both in LINC terminals and - // in LINC-space, we need to provide a mask (for the black outline) - // even though it's only visible in the latter. We store the mask - // as the second half of the array to make it more human-readable. - // In the actual game data, the character and mask are interleaved. - - const uint16 slash[] = { - 0x0000, 0x0000, 0x0000, 0x0800, 0x1000, 0x1000, - 0x2000, 0x2000, 0x4000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0800, 0x1C00, 0x3800, 0x3800, - 0x7000, 0x7000, 0xE000, 0x4000, 0x0000, 0x0000 - }; - - const uint16 lt[] = { - 0x0000, 0x0000, 0x0800, 0x1000, 0x2000, 0x4000, - 0x2000, 0x1000, 0x0800, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0800, 0x1C00, 0x3800, 0x7000, 0xE000, - 0x7000, 0x3800, 0x1C00, 0x0800, 0x0000, 0x0000 - }; - - const uint16 gt[] = { - 0x0000, 0x0000, 0x4000, 0x2000, 0x1000, 0x0800, - 0x1000, 0x2000, 0x4000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x4000, 0xE000, 0x7000, 0x3800, 0x1C00, - 0x3800, 0x7000, 0xE000, 0x4000, 0x0000, 0x0000 - }; - - const uint16 a_umlaut[] = { - 0x0000, 0x0000, 0x2800, 0x0000, 0x3000, 0x0800, - 0x3800, 0x4800, 0x3800, 0x0000, 0x0000, 0x0000, - 0x0000, 0x2800, 0x7C00, 0x3800, 0x7800, 0x3C00, - 0x7C00, 0xFC00, 0x7C00, 0x3800, 0x0000, 0x0000 - }; - - const uint16 o_umlaut[] = { - 0x0000, 0x0000, 0x4800, 0x0000, 0x3000, 0x4800, - 0x4800, 0x4800, 0x3000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x4800, 0xFC00, 0x7800, 0x7800, 0xFC00, - 0xFC00, 0xFC00, 0x7800, 0x3000, 0x0000, 0x0000 - }; - - const uint16 u_umlaut[] = { - 0x0000, 0x0000, 0x4800, 0x0000, 0x4800, 0x4800, - 0x4800, 0x4800, 0x3800, 0x0000, 0x0000, 0x0000, - 0x0000, 0x4800, 0xFC00, 0x4800, 0xFC00, 0xFC00, - 0xFC00, 0xFC00, 0x7C00, 0x3800, 0x0000, 0x0000 - }; - - const uint16 A_umlaut[] = { - 0x0000, 0x4800, 0x0000, 0x3000, 0x4800, 0x4800, - 0x7800, 0x4800, 0x4800, 0x0000, 0x0000, 0x0000, - 0x4800, 0xFC00, 0x7800, 0x7800, 0xFC00, 0xFC00, - 0xFC00, 0xFC00, 0xFC00, 0x4800, 0x0000, 0x0000 - }; - - const uint16 O_umlaut[] = { - 0x0000, 0x4800, 0x0000, 0x3000, 0x4800, 0x4800, - 0x4800, 0x4800, 0x3000, 0x0000, 0x0000, 0x0000, - 0x4800, 0xFC00, 0x7800, 0x7800, 0xFC00, 0xFC00, - 0xFC00, 0xFC00, 0x7800, 0x3000, 0x0000, 0x0000 - }; - - const uint16 U_umlaut[] = { - 0x0000, 0x4800, 0x0000, 0x4800, 0x4800, 0x4800, - 0x4800, 0x4800, 0x3000, 0x0000, 0x0000, 0x0000, - 0x4800, 0xFC00, 0x4800, 0xFC00, 0xFC00, 0xFC00, - 0xFC00, 0xFC00, 0x7800, 0x3000, 0x0000, 0x0000 - }; - - const uint16 normal_j[] = { - 0x0000, 0x0000, 0x0000, 0x0800, 0x0000, 0x0800, - 0x0800, 0x0800, 0x0800, 0x4800, 0x3000, 0x0000, - 0x0000, 0x0000, 0x0800, 0x1C00, 0x0800, 0x1C00, - 0x1C00, 0x1C00, 0x5C00, 0xFC00, 0x7800, 0x3000 - }; - - const uint16 german_sz[] = { - 0x0000, 0x0000, 0x2000, 0x5000, 0x5000, 0x4800, - 0x4800, 0x4800, 0x5000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x2000, 0x7000, 0xF800, 0xF800, 0xFC00, - 0xFC00, 0xFC00, 0xF800, 0x7000, 0x0000, 0x0000 - }; - - const uint16 normal_1[] = { - 0x0000, 0x0000, 0x0000, 0x1000, 0x7000, 0x1000, - 0x1000, 0x1000, 0x7c00, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x1000, 0x7800, 0xF800, 0x7800, - 0x3800, 0x7c00, 0xFE00, 0x7c00, 0x0000, 0x0000 - }; - - // The next five are needed for at least the French version - - const uint16 e_acute[] = { - 0x0000, 0x1000, 0x2000, 0x0000, 0x3000, 0x4800, - 0x7800, 0x4000, 0x3000, 0x0000, 0x0000, 0x0000, - 0x1000, 0x3800, 0x7000, 0x7000, 0x7800, 0xFC00, - 0xFC00, 0xF800, 0x7800, 0x3000, 0x0000, 0x0000 - }; - - const uint16 e_grave[] = { - 0x0000, 0x2000, 0x1000, 0x0000, 0x3000, 0x4800, - 0x7800, 0x4000, 0x3000, 0x0000, 0x0000, 0x0000, - 0x2000, 0x7000, 0x3800, 0x3800, 0x7800, 0xFC00, - 0xFC00, 0xF800, 0x7800, 0x3000, 0x0000, 0x0000 - }; - - const uint16 e_circumflex[] = { - 0x0000, 0x1000, 0x2800, 0x0000, 0x3000, 0x4800, - 0x7800, 0x4000, 0x3000, 0x0000, 0x0000, 0x0000, - 0x1000, 0x3800, 0x7C00, 0x7800, 0x7800, 0xFC00, - 0xFC00, 0xF800, 0x7800, 0x3000, 0x0000, 0x0000 - }; - - const uint16 o_circumflex[] = { - 0x0000, 0x1000, 0x2800, 0x0000, 0x3000, 0x4800, - 0x4800, 0x4800, 0x3000, 0x0000, 0x0000, 0x0000, - 0x1000, 0x3800, 0x7C00, 0x3800, 0x7800, 0xFC00, - 0xFC00, 0xFC00, 0x7800, 0x3000, 0x0000, 0x0000 - }; - - const uint16 u_circumflex[] = { - 0x0000, 0x1000, 0x2800, 0x0000, 0x4800, 0x4800, - 0x4800, 0x4800, 0x3800, 0x0000, 0x0000, 0x0000, - 0x1000, 0x3800, 0x7C00, 0x7800, 0xFC00, 0xFC00, - 0xFC00, 0xFC00, 0x7C00, 0x3800, 0x0000, 0x0000 - }; - - patchChar(charSetPtr, 5, charHeight, 3, u_umlaut); - patchChar(charSetPtr, 5, charHeight, 8, german_sz); - patchChar(charSetPtr, 5, charHeight, 9, o_umlaut); - patchChar(charSetPtr, 5, charHeight, 93, U_umlaut); - patchChar(charSetPtr, 5, charHeight, 74, normal_j); - patchChar(charSetPtr, 6, charHeight, 17, normal_1); - - patchChar(charSetPtr, 5, charHeight, 11, e_acute); - patchChar(charSetPtr, 5, charHeight, 61, e_grave); - patchChar(charSetPtr, 5, charHeight, 29, e_circumflex); - patchChar(charSetPtr, 5, charHeight, 32, o_circumflex); - patchChar(charSetPtr, 5, charHeight, 30, u_circumflex); - - if (SkyEngine::_systemVars.gameVersion <= 303) { - patchChar(charSetPtr, 5, charHeight, 10, a_umlaut); - } else { - patchChar(charSetPtr, 5, charHeight, 94, A_umlaut); - patchChar(charSetPtr, 5, charHeight, 95, O_umlaut); - - // Used by, for instance, the BRIEFING.DOC file in all (?) languages - patchChar(charSetPtr, 5, charHeight, 96, lt); - patchChar(charSetPtr, 5, charHeight, 97, gt); - patchChar(charSetPtr, 5, charHeight, 98, slash); - } -} - void Text::fnSetFont(uint32 fontNr) { struct charSet *newCharSet; @@ -283,10 +92,10 @@ void Text::fnSetFont(uint32 fontNr) { newCharSet = &_mainCharacterSet; break; case 1: - newCharSet = &_controlCharacterSet; + newCharSet = &_linkCharacterSet; break; case 2: - newCharSet = &_linkCharacterSet; + newCharSet = &_controlCharacterSet; break; default: error("Tried to set invalid font (%d)", fontNr); diff --git a/engines/sky/text.h b/engines/sky/text.h index ab7e0a1000..2cade27f5d 100644 --- a/engines/sky/text.h +++ b/engines/sky/text.h @@ -68,8 +68,6 @@ private: bool getTextBit(uint8 **data, uint32 *bitPos); void makeGameCharacter(uint8 textChar, uint8 *charSetPtr, uint8 *&data, uint8 color, uint16 bufPitch); - void patchChar(byte *charSetPtr, int width, int height, int c, const uint16 *data); - void patchLINCCharset(); bool patchMessage(uint32 textNum); Disk *_skyDisk; |