From a871e0115174040ca8a331ec80616605d3cad1a2 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Wed, 3 Dec 2008 21:30:41 +0000 Subject: Converted the credits scroller to use readLine_NEW() instead of readLine_OLD(). svn-id: r35224 --- engines/sword2/screen.cpp | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'engines/sword2/screen.cpp') diff --git a/engines/sword2/screen.cpp b/engines/sword2/screen.cpp index d656674a98..b552f385a9 100644 --- a/engines/sword2/screen.cpp +++ b/engines/sword2/screen.cpp @@ -932,7 +932,32 @@ void Screen::rollCredits() { while (1) { char buffer[80]; - char *line = f.readLine_OLD(buffer, sizeof(buffer)); + char *line = f.readLine_NEW(buffer, sizeof(buffer)); + + if (line) { + // Replace invalid character codes prevent the 'dud' + // symbol from showing up in the credits. + + for (byte *ptr = (byte *)line; *ptr; ptr++) { + switch (*ptr) { + case 9: + // The German credits contain these. + // Convert them to spaces. + *ptr = 32; + break; + case 10: + // LF is treated as end of line. + *ptr = 0; + break; + case 170: + // The Spanish credits contain these. + // Convert them to periods. + *ptr = '.'; + default: + break; + } + } + } if (!line || *line == 0) { if (!hasCenterMark) { @@ -950,21 +975,6 @@ void Screen::rollCredits() { continue; } - // Replace invalid character codes to avoid the credits to show - // the 'dud' symbol. - - for (byte *ptr = (byte *)line; *ptr; ptr++) { - // The German credits contains character code 9. We - // replace them with spaces. - if (*ptr == 9) - *ptr = 32; - - // The Spanish credits contains character code 170. We - // replace them with dots. - if (*ptr == 170) - *ptr = '.'; - } - char *center_mark = strchr(line, '^'); if (center_mark) { -- cgit v1.2.3