[Scummvm-git-logs] scummvm branch-2-8 -> 7c44b243af9210d711120d981189780ad65e05aa

sdelamarre noreply at scummvm.org
Thu Jan 4 22:27:42 UTC 2024


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:
7c44b243af GOB: Fix a glitch in the first level of Gob3 (bug #9682)


Commit: 7c44b243af9210d711120d981189780ad65e05aa
    https://github.com/scummvm/scummvm/commit/7c44b243af9210d711120d981189780ad65e05aa
Author: Simon Delamarre (simon.delamarre14 at gmail.com)
Date: 2024-01-04T23:25:59+01:00

Commit Message:
GOB: Fix a glitch in the first level of Gob3 (bug #9682)

Changed paths:
    engines/gob/scenery.cpp
    engines/gob/scenery.h


diff --git a/engines/gob/scenery.cpp b/engines/gob/scenery.cpp
index 9b29e22c1d7..c467a22440c 100644
--- a/engines/gob/scenery.cpp
+++ b/engines/gob/scenery.cpp
@@ -51,6 +51,17 @@ Scenery::Scenery(GobEngine *vm) : _vm(vm) {
 	_curStatic      = 0;
 	_curStaticLayer = 0;
 
+	if (_vm->getGameType() == kGameTypeGob2 || _vm->getGameType() == kGameTypeGob3) {
+		// The maximum draw order is known to be 40 in Gobliins 2 and Goblins 3, and 100 in Woodruff and Adibou2.
+		// It was previously set to 100 for all games, but it caused a glitch in the first screen of Goblins 3,
+		// see issue #9682.
+		// Probably most pre-Woodruff titles should use 40, but it should be verified, and most of the time a higher
+		// limit does not harm.
+		_maxDrawOrder = 40;
+	} else {
+		_maxDrawOrder = 100;
+	}
+
 	_toRedrawLeft   = 0;
 	_toRedrawRight  = 0;
 	_toRedrawTop    = 0;
@@ -269,7 +280,7 @@ void Scenery::renderStatic(int16 scenery, int16 layer) {
 	}
 
 	planeCount = layerPtr->planeCount;
-	for (order = 0; order < 100; order++) {
+	for (order = 0; order < _maxDrawOrder; order++) {
 		for (plane = 0, planePtr = layerPtr->planes; plane < planeCount; plane++, planePtr++) {
 			if (planePtr->drawOrder != order)
 				continue;
@@ -329,7 +340,7 @@ void Scenery::updateStatic(int16 orderFrom, byte index, byte layer) {
 
 	planeCount = layerPtr->planeCount;
 
-	for (order = orderFrom; order < 100; order++) {
+	for (order = orderFrom; order < _maxDrawOrder; order++) {
 		for (planePtr = layerPtr->planes, plane = 0;
 		    plane < planeCount; plane++, planePtr++) {
 			if (planePtr->drawOrder != order)
diff --git a/engines/gob/scenery.h b/engines/gob/scenery.h
index 5a0c459eecf..64db9522fea 100644
--- a/engines/gob/scenery.h
+++ b/engines/gob/scenery.h
@@ -93,6 +93,8 @@ public:
 	int16 _curStatic;
 	int16 _curStaticLayer;
 
+	int16 _maxDrawOrder;
+
 	int16 _toRedrawLeft;
 	int16 _toRedrawRight;
 	int16 _toRedrawTop;




More information about the Scummvm-git-logs mailing list