From b993eba6a59f4f1edaac5bf75f8338e3ec7cc799 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 May 2009 11:37:24 +0000 Subject: Removed the line feed workaround, and added explicit int16 castings to the FROM_LE_16 macros in the font system - this fixes a bug in the engine, allowing it to properly handle all non-printable characters correctly svn-id: r40858 --- engines/cruise/font.cpp | 17 ++++++----------- engines/cruise/overlay.cpp | 10 ---------- 2 files changed, 6 insertions(+), 21 deletions(-) (limited to 'engines') diff --git a/engines/cruise/font.cpp b/engines/cruise/font.cpp index de82b4b436..196ff4fb01 100644 --- a/engines/cruise/font.cpp +++ b/engines/cruise/font.cpp @@ -72,7 +72,7 @@ int32 getTextLineCount(int32 rightBorder_X, int16 wordSpacingWidth, lineLength = rightBorder_X; localString = tempPtr; } else if (charData >= 0) { - lineLength += wordSpacingWidth + FROM_LE_16(fontData[charData].charWidth); + lineLength += wordSpacingWidth + (int16)FROM_LE_16(fontData[charData].charWidth); } else if (ch == ' ') { lineLength += wordSpacingWidth + 5; localString = tempPtr; @@ -258,7 +258,7 @@ int32 prepareWordRender(int32 inRightBorder_X, int16 wordSpacingWidth, } else { if (charData) { if (pixelCount + wordSpacingWidth + - FROM_LE_16(fontData[charData].charWidth) >= inRightBorder_X) { + (int16)FROM_LE_16(fontData[charData].charWidth) >= inRightBorder_X) { finish = 1; if (temp_pc) { pixelCount = temp_pc; @@ -266,7 +266,7 @@ int32 prepareWordRender(int32 inRightBorder_X, int16 wordSpacingWidth, } } else { pixelCount += wordSpacingWidth + - FROM_LE_16(fontData[charData].charWidth); + (int16)FROM_LE_16(fontData[charData].charWidth); } } } @@ -422,21 +422,16 @@ gfxEntryStruct *renderText(int inRightBorder_X, const char *string) { FROM_LE_16(fe.v1), stringRenderBufferSize, stringWidth / 2, - FROM_LE_16(fe.charWidth)); + (int16)FROM_LE_16(fe.charWidth)); drawPosPixel_X += - wordSpacingWidth + FROM_LE_16(fe.charWidth); + wordSpacingWidth + (int16)FROM_LE_16(fe.charWidth); } } } else { stringFinished = 1; // character = 0x00 } - - // check if string already reached the end - if (ptrStringEnd <= string) { - break; - } - } while (!stringFinished); + } while ((string < ptrStringEnd) && !stringFinished); // var_8 = 0; heightOffset += wordSpacingHeight + lineHeight; diff --git a/engines/cruise/overlay.cpp b/engines/cruise/overlay.cpp index b5bb145b91..bac3ce15b8 100644 --- a/engines/cruise/overlay.cpp +++ b/engines/cruise/overlay.cpp @@ -567,16 +567,6 @@ int loadOverlay(const char *scriptName) { } s2.read(ovlData->stringTable[i].string, ovlData->stringTable[i].length); - - // WORKAROUND: English version, idx 16, num #60 has a line feed character - // in the middle of a word - if ((scriptIdx == 16) && (i == 60) && (_vm->getLanguage() == Common::EN_ANY)) { - char *p = strchr(ovlData->stringTable[i].string, '\xa'); - if (p != NULL) { - // Delete the line feed character by shifting remainder of message - while ((*p = *(p + 1)) != '\0') ++p; - } - } } } } -- cgit v1.2.3