aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2009-05-24 11:37:24 +0000
committerPaul Gilbert2009-05-24 11:37:24 +0000
commitb993eba6a59f4f1edaac5bf75f8338e3ec7cc799 (patch)
treeefd9d68bc9250206ad4607e4e974ea105a678a9a
parent8ab0f0256e343c0e8ee28ab67f1244171d1e5d4f (diff)
downloadscummvm-rg350-b993eba6a59f4f1edaac5bf75f8338e3ec7cc799.tar.gz
scummvm-rg350-b993eba6a59f4f1edaac5bf75f8338e3ec7cc799.tar.bz2
scummvm-rg350-b993eba6a59f4f1edaac5bf75f8338e3ec7cc799.zip
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
-rw-r--r--engines/cruise/font.cpp17
-rw-r--r--engines/cruise/overlay.cpp10
2 files changed, 6 insertions, 21 deletions
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;
- }
- }
}
}
}