[Scummvm-git-logs] scummvm master -> ec4bce9c2fc857bd3514d37771b97391a67b0f5c

sluicebox 22204938+sluicebox at users.noreply.github.com
Thu Jul 9 19:10:39 UTC 2020


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ec4bce9c2f SCI: Fix font parsing when bitmaps are unordered


Commit: ec4bce9c2fc857bd3514d37771b97391a67b0f5c
    https://github.com/scummvm/scummvm/commit/ec4bce9c2fc857bd3514d37771b97391a67b0f5c
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2020-07-09T12:09:39-07:00

Commit Message:
SCI: Fix font parsing when bitmaps are unordered

GfxFontFromResource::getCharData() calculates the size of a character's
bitmap by assuming that it's followed by the next character's bitmap,
but the bitmap order isn't relied upon by Sierra's interpreter or the
major resource viewers. Several Polish games have fonts whose bitmaps
appear in arbitrary orders and also have extra bytes between them.

Fixed by calculating bitmap size by dimensions, which is what the
drawing code uses anyway.

Fixes Polish versions of KQ5, LSL1VGA, LSL5, and LSL6. Bug #10509

Changed paths:
    engines/sci/graphics/font.cpp


diff --git a/engines/sci/graphics/font.cpp b/engines/sci/graphics/font.cpp
index 97627ec00b..b6fb15c9cd 100644
--- a/engines/sci/graphics/font.cpp
+++ b/engines/sci/graphics/font.cpp
@@ -260,8 +260,9 @@ SciSpan<const byte> GfxFontFromResource::getCharData(uint16 chr) {
 		return SciSpan<const byte>();
 	}
 
-	const uint32 size = (chr + 1 >= _numChars ? _resourceData.size() : _chars[chr + 1].offset) - _chars[chr].offset - 2;
-	return _resourceData.subspan(_chars[chr].offset + 2, size);
+	const uint32 bytesPerRow = (_chars[chr].width + 7) / 8;
+	const uint32 charDataSize = bytesPerRow * _chars[chr].height;
+	return _resourceData.subspan(_chars[chr].offset + 2, charDataSize);
 }
 
 void GfxFontFromResource::draw(uint16 chr, int16 top, int16 left, byte color, bool greyedOutput) {




More information about the Scummvm-git-logs mailing list