aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2009-07-11 00:47:32 +0000
committerWillem Jan Palenstijn2009-07-11 00:47:32 +0000
commitad67a714dd9e4373cb5a1d78fba2b00e1db32352 (patch)
treead5f18a7544dc3dd4ad1d46a8082d33eaa71eecc /engines
parent8eee50103ce40287058966e201d65aade5f1f688 (diff)
downloadscummvm-rg350-ad67a714dd9e4373cb5a1d78fba2b00e1db32352.tar.gz
scummvm-rg350-ad67a714dd9e4373cb5a1d78fba2b00e1db32352.tar.bz2
scummvm-rg350-ad67a714dd9e4373cb5a1d78fba2b00e1db32352.zip
Fix SAGA outline generation algorithm for characters
that are copies of earlier characters. (5 characters in IHNM.) This fixes #1904624. svn-id: r42361
Diffstat (limited to 'engines')
-rw-r--r--engines/saga/font.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/engines/saga/font.cpp b/engines/saga/font.cpp
index 175ab01478..1c1c3100c4 100644
--- a/engines/saga/font.cpp
+++ b/engines/saga/font.cpp
@@ -165,6 +165,25 @@ void Font::createOutline(FontData *font) {
index += indexOffset;
}
+ bool skip = false;
+
+ if (i > 0 && font->normal.fontCharEntry[i].width != 0 && font->normal.fontCharEntry[i].index < font->normal.fontCharEntry[i-1].index) {
+ // Some characters are copies of earlier characters.
+ // Look up the original, and make sure not to grow the size of
+ // the outline font twice.
+ skip = true;
+ bool found = false;
+ for (int j = 0; j < i; j++) {
+ if (font->normal.fontCharEntry[i].index == font->normal.fontCharEntry[j].index) {
+ index = font->outline.fontCharEntry[j].index;
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ error("Invalid index backreference in font char %d", i);
+ }
+
font->outline.fontCharEntry[i].index = index;
font->outline.fontCharEntry[i].tracking = font->normal.fontCharEntry[i].tracking;
font->outline.fontCharEntry[i].flag = font->normal.fontCharEntry[i].flag;
@@ -173,14 +192,16 @@ void Font::createOutline(FontData *font) {
newByteWidth = getByteLen(font->normal.fontCharEntry[i].width + 2);
oldByteWidth = getByteLen(font->normal.fontCharEntry[i].width);
- if (newByteWidth > oldByteWidth) {
+ if (!skip && newByteWidth > oldByteWidth) {
indexOffset++;
}
}
font->outline.fontCharEntry[i].width = font->normal.fontCharEntry[i].width + 2;
font->outline.fontCharEntry[i].byteWidth = newByteWidth;
- newRowLength += newByteWidth;
+
+ if (!skip)
+ newRowLength += newByteWidth;
}
debug(2, "New row length: %d", newRowLength);
@@ -196,6 +217,10 @@ void Font::createOutline(FontData *font) {
// Generate outline font representation
for (i = 0; i < FONT_CHARCOUNT; i++) {
+ if (i > 0 && font->normal.fontCharEntry[i].index < font->normal.fontCharEntry[i-1].index) {
+ // Skip copies
+ continue;
+ }
for (row = 0; row < font->normal.header.charHeight; row++) {
for (currentByte = 0; currentByte < font->outline.fontCharEntry[i].byteWidth; currentByte++) {
basePointer = font->outline.font + font->outline.fontCharEntry[i].index + currentByte;