From 6161d7906efc1a99c05aeef91e60bcc44aeb8ac4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 7 Dec 2011 20:49:11 +1100 Subject: TSAGE: Fix for displaying text correctly in Ringworld Spanish version. --- engines/tsage/graphics.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index f0a5973e6b..171167c2ea 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -1254,7 +1254,11 @@ void GfxFont::setFontNumber(uint32 fontNumber) { if (!_fontData) _fontData = g_resourceManager->getResource(RES_FONT, _fontNumber, 0); - _numChars = READ_LE_UINT16(_fontData + 4); + // Since some TsAGE game versions don't have a valid character count at offset 4, use the offset of the + // first charactre data to calculate the number of characters in the offset table preceeding it + _numChars = (READ_LE_UINT32(_fontData + 12) - 12) / 4; + assert(_numChars <= 256); + _fontSize.y = READ_LE_UINT16(_fontData + 6); _fontSize.x = READ_LE_UINT16(_fontData + 8); _bpp = READ_LE_UINT16(_fontData + 10); -- cgit v1.2.3