aboutsummaryrefslogtreecommitdiff
path: root/engines/lure/surface.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2008-01-18 10:49:48 +0000
committerPaul Gilbert2008-01-18 10:49:48 +0000
commite6c20003c04fdfba9b72a2d577fb95c02fac786e (patch)
tree0eb40b1ef2470075963669bb094c3efb1ba04eec /engines/lure/surface.cpp
parent586ef72e969776c51625836274e6b14d0cb4a48b (diff)
downloadscummvm-rg350-e6c20003c04fdfba9b72a2d577fb95c02fac786e.tar.gz
scummvm-rg350-e6c20003c04fdfba9b72a2d577fb95c02fac786e.tar.bz2
scummvm-rg350-e6c20003c04fdfba9b72a2d577fb95c02fac786e.zip
Enhanced Surface::writeSubstring to crop any string that exceeds the width of the surface - this fixes a visual glitch in the German version where some lines were so long they were exceeding the size of the screen
svn-id: r30547
Diffstat (limited to 'engines/lure/surface.cpp')
-rw-r--r--engines/lure/surface.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp
index a093142964..64b7be9b1b 100644
--- a/engines/lure/surface.cpp
+++ b/engines/lure/surface.cpp
@@ -263,11 +263,16 @@ void Surface::writeSubstring(uint16 x, uint16 y, Common::String line, int len,
colour = LureEngine::getReference().isEGA() ? EGA_DIALOG_TEXT_COLOUR : VGA_DIALOG_TEXT_COLOUR;
for (int index = 0; (index < len) && (*sPtr != '\0'); ++index, ++sPtr) {
+ int charSize = varLength ? fontSize[(uint8)*sPtr - 32] + 2 : FONT_WIDTH;
+ if (x + charSize >= width())
+ // Passed the right hand edge of the surface
+ break;
+
+ // Write next character
writeChar(x, y, (uint8) *sPtr, transparent, colour);
// Move to after the character in preparation for the next character
- if (!varLength) x += FONT_WIDTH;
- else x += fontSize[(uint8)*sPtr - 32] + 2;
+ x += charSize;
}
}