[Scummvm-cvs-logs] scummvm master -> 511d9f1e402834cae8f74d3ccca02b660fd03701

bluegr bluegr at gmail.com
Tue Aug 23 14:53:24 CEST 2016


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:
511d9f1e40 SCI32: Fix crash in Torin, chapter 4, catapult scene (via ScreenItem)


Commit: 511d9f1e402834cae8f74d3ccca02b660fd03701
    https://github.com/scummvm/scummvm/commit/511d9f1e402834cae8f74d3ccca02b660fd03701
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-08-23T15:52:54+03:00

Commit Message:
SCI32: Fix crash in Torin, chapter 4, catapult scene (via ScreenItem)

loopNo/celNo are set to unsigned integers in ScreenItem::setFromObject
in SSCI, thus their value will be adjusted when it's negative, like in
this case

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



diff --git a/engines/sci/graphics/screen_item32.cpp b/engines/sci/graphics/screen_item32.cpp
index 7383dc2..f4ed269 100644
--- a/engines/sci/graphics/screen_item32.cpp
+++ b/engines/sci/graphics/screen_item32.cpp
@@ -178,7 +178,9 @@ void ScreenItem::setFromObject(SegManager *segMan, const reg_t object, const boo
 			const uint8 loopCount = view->data[2];
 			const uint8 loopSize = view->data[12];
 
-			if (_celInfo.loopNo >= loopCount) {
+			// loopNo is set to be an unsigned integer in SSCI, so if it's a
+			// negative value, it'll be fixed accordingly
+			if ((uint16)_celInfo.loopNo >= loopCount) {
 				const int maxLoopNo = loopCount - 1;
 				_celInfo.loopNo = maxLoopNo;
 				writeSelectorValue(segMan, object, SELECTOR(loop), maxLoopNo);
@@ -189,8 +191,11 @@ void ScreenItem::setFromObject(SegManager *segMan, const reg_t object, const boo
 			if (seekEntry != -1) {
 				loopData = view->data + headerSize + (seekEntry * loopSize);
 			}
+
+			// celNo is set to be an unsigned integer in SSCI, so if it's a
+			// negative value, it'll be fixed accordingly
 			const uint8 celCount = loopData[2];
-			if (_celInfo.celNo >= celCount) {
+			if ((uint16)_celInfo.celNo >= celCount) {
 				const int maxCelNo = celCount - 1;
 				_celInfo.celNo = maxCelNo;
 				writeSelectorValue(segMan, object, SELECTOR(cel), maxCelNo);






More information about the Scummvm-git-logs mailing list