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

This commit is contained in:
Simon Delamarre committed 2024-01-04 23:15:20 +01:00
1 parent 5deacf341f
commit 20f77b0bf7
2 files changed
+15 -2

No files matched your search

+13 -2
View File
@@ -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)
+2
View File
@@ -93,6 +93,8 @@ public:
int16 _curStatic;
int16 _curStaticLayer;
int16 _maxDrawOrder;
int16 _toRedrawLeft;
int16 _toRedrawRight;
int16 _toRedrawTop;