[Scummvm-cvs-logs] CVS: scummvm/scumm scumm.h,1.23,1.24 string.cpp,1.17,1.18
Max Horn
fingolfin at users.sourceforge.net
Fri Sep 20 16:51:13 CEST 2002
Update of /cvsroot/scummvm/scummvm/scumm
In directory usw-pr-cvs1:/tmp/cvs-serv18003/scumm
Modified Files:
scumm.h string.cpp
Log Message:
Patch #612277: text rendering crash + spacing issue
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- scumm.h 19 Sep 2002 23:49:38 -0000 1.23
+++ scumm.h 20 Sep 2002 23:40:55 -0000 1.24
@@ -220,7 +220,7 @@
void drawBits();
void printChar(int chr);
void printCharOld(int chr);
- int getSpacing(char chr, byte *charset);
+ int getSpacing(byte chr, byte *charset);
int getStringWidth(int a, byte *str, int pos);
void addLinebreaks(int a, byte *str, int pos, int maxwidth);
};
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- string.cpp 19 Sep 2002 23:49:38 -0000 1.17
+++ string.cpp 20 Sep 2002 23:40:55 -0000 1.18
@@ -71,6 +71,7 @@
}
width += getSpacing(chr, ptr);
}
+
return width;
}
@@ -125,6 +126,7 @@
if (chr == ' ')
lastspace = pos - 1;
+
curw += getSpacing(chr, ptr);
if (lastspace == -1)
continue;
@@ -1019,20 +1021,20 @@
}
// do spacing for variable width old-style font
-int CharsetRenderer::getSpacing(char chr, byte *ptr)
+int CharsetRenderer::getSpacing(byte chr, byte *charset)
{
- int spacing;
+ int spacing = 0;
if (_vm->_features & GF_OLD256) {
- spacing = *(ptr - 11 + chr);
+ spacing = *(charset - 11 + chr);
} else {
- int offs = READ_LE_UINT32(ptr + chr * 4 + 4);
+ int offs = READ_LE_UINT32(charset + chr * 4 + 4);
if (offs) {
- spacing = ptr[offs];
- if (ptr[offs + 2] >= 0x80) {
- spacing += ptr[offs + 2] - 0x100;
+ spacing = charset[offs];
+ if (charset[offs + 2] >= 0x80) {
+ spacing += charset[offs + 2] - 0x100;
} else {
- spacing += ptr[offs + 2];
+ spacing += charset[offs + 2];
}
}
}
More information about the Scummvm-git-logs
mailing list