[Scummvm-cvs-logs] SF.net SVN: scummvm: [31915] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Wed May 7 04:56:18 CEST 2008


Revision: 31915
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31915&view=rev
Author:   drmccoy
Date:     2008-05-06 19:56:18 -0700 (Tue, 06 May 2008)

Log Message:
-----------
Draw order related fixes.
This also (finally) fixes the Gob3 draw order glitch (for real, this time)

Modified Paths:
--------------
    scummvm/trunk/engines/gob/inter_v2.cpp
    scummvm/trunk/engines/gob/mult.h
    scummvm/trunk/engines/gob/mult_v2.cpp
    scummvm/trunk/engines/gob/scenery.cpp
    scummvm/trunk/engines/gob/scenery.h

Modified: scummvm/trunk/engines/gob/inter_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v2.cpp	2008-05-07 01:15:46 UTC (rev 31914)
+++ scummvm/trunk/engines/gob/inter_v2.cpp	2008-05-07 02:56:18 UTC (rev 31915)
@@ -899,7 +899,7 @@
 		if (_terminate)
 			return;
 
-		_vm->_mult->_orderArray = new uint8[_vm->_mult->_objCount];
+		_vm->_mult->_orderArray = new int8[_vm->_mult->_objCount];
 		memset(_vm->_mult->_orderArray, 0, _vm->_mult->_objCount * sizeof(int8));
 		_vm->_mult->_objects = new Mult::Mult_Object[_vm->_mult->_objCount];
 		memset(_vm->_mult->_objects, 0,

Modified: scummvm/trunk/engines/gob/mult.h
===================================================================
--- scummvm/trunk/engines/gob/mult.h	2008-05-07 01:15:46 UTC (rev 31914)
+++ scummvm/trunk/engines/gob/mult.h	2008-05-07 02:56:18 UTC (rev 31915)
@@ -40,7 +40,7 @@
 		uint8 layer;
 		uint8 frame;
 		int8 animType;
-		uint8 order;
+		int8 order;
 		int8 isPaused;
 		int8 isStatic;
 		int8 maxTick;
@@ -229,7 +229,7 @@
 	int16 *_renderData;
 	Mult_Object **_renderObjs;
 
-	uint8 *_orderArray;
+	int8 *_orderArray;
 
 	SurfaceDesc::Ptr _animSurf;
 	int16 _animLeft;

Modified: scummvm/trunk/engines/gob/mult_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/mult_v2.cpp	2008-05-07 01:15:46 UTC (rev 31914)
+++ scummvm/trunk/engines/gob/mult_v2.cpp	2008-05-07 02:56:18 UTC (rev 31915)
@@ -526,14 +526,14 @@
 		delete[] _animArrayData;
 
 		_objects = new Mult_Object[_objCount];
-		_orderArray = new uint8[_objCount];
+		_orderArray = new int8[_objCount];
 		_renderObjs = new Mult_Object*[_objCount];
 		_animArrayX = new int32[_objCount];
 		_animArrayY = new int32[_objCount];
 		_animArrayData = new Mult_AnimData[_objCount];
 
 		memset(_objects, 0, _objCount * sizeof(Mult_Object));
-		memset(_orderArray, 0, _objCount * sizeof(uint8));
+		memset(_orderArray, 0, _objCount * sizeof(int8));
 		memset(_renderObjs, 0, _objCount * sizeof(Mult_Object *));
 		memset(_animArrayX, 0, _objCount * sizeof(int32));
 		memset(_animArrayY, 0, _objCount * sizeof(int32));
@@ -768,9 +768,9 @@
 }
 
 void Mult_v2::animate() {
-	uint8 minOrder = 100;
-	uint8 maxOrder = 0;
-	uint8 *orderArray;
+	int8 minOrder = 100;
+	int8 maxOrder = 0;
+	int8 *orderArray;
 	int orderArrayPos = 0;
 	int8 animIndices[150];
 	int numAnims = 0;
@@ -952,60 +952,58 @@
 		Mult_Object &animObj1 = *_renderObjs[orderArray[i]];
 		Mult_AnimData &animData1 = *(animObj1.pAnimData);
 
-		if (!animObj1.needRedraw && !animData1.isStatic) {
-			for (int j = 0; j < orderArrayPos; j++) {
-				Mult_Object &animObj2 = *_renderObjs[orderArray[j]];
+		if (!animObj1.needRedraw) {
 
-				if (!animObj2.needRedraw)
-					continue;
+			if (!animData1.isStatic) {
+				for (int j = 0; j < orderArrayPos; j++) {
+					Mult_Object &animObj2 = *_renderObjs[orderArray[j]];
 
-				if ((animObj1.newRight >= animObj2.newLeft) &&
-						(animObj2.newRight >= animObj1.newLeft) &&
-						(animObj1.newBottom >= animObj2.newTop) &&
-						(animObj2.newBottom >= animObj1.newTop)) {
+					if (!animObj2.needRedraw)
+						continue;
 
-					_vm->_scenery->_toRedrawLeft = animObj2.newLeft;
-					_vm->_scenery->_toRedrawRight = animObj2.newRight;
-					_vm->_scenery->_toRedrawTop = animObj2.newTop;
-					_vm->_scenery->_toRedrawBottom = animObj2.newBottom;
+					if ((animObj1.newRight >= animObj2.newLeft) &&
+							(animObj2.newRight >= animObj1.newLeft) &&
+							(animObj1.newBottom >= animObj2.newTop) &&
+							(animObj2.newBottom >= animObj1.newTop)) {
 
-					_vm->_scenery->updateAnim(animData1.layer, animData1.frame,
-							animData1.animation, 12, *animObj1.pPosX, *animObj1.pPosY, 1);
-					_vm->_scenery->updateStatic(animData1.order + 1);
+						_vm->_scenery->_toRedrawLeft = animObj2.newLeft;
+						_vm->_scenery->_toRedrawRight = animObj2.newRight;
+						_vm->_scenery->_toRedrawTop = animObj2.newTop;
+						_vm->_scenery->_toRedrawBottom = animObj2.newBottom;
+
+						_vm->_scenery->updateAnim(animData1.layer, animData1.frame,
+								animData1.animation, 12, *animObj1.pPosX, *animObj1.pPosY, 1);
+						_vm->_scenery->updateStatic(animData1.order + 1);
+					}
 				}
 			}
-		} else if (!animData1.isStatic) {
-			_vm->_scenery->updateAnim(animData1.layer, animData1.frame,
-					animData1.animation, 10, *animObj1.pPosX, *animObj1.pPosY, 1);
 
-			if (_vm->_scenery->_toRedrawLeft != -12345) {
-				if (_vm->_global->_pressedKeys[0x36]) {
-					_vm->_video->drawLine(_vm->_draw->_frontSurface,
-							_vm->_scenery->_toRedrawLeft, _vm->_scenery->_toRedrawTop,
-							_vm->_scenery->_toRedrawRight, _vm->_scenery->_toRedrawTop, 15);
-					_vm->_video->drawLine(_vm->_draw->_frontSurface,
-							_vm->_scenery->_toRedrawLeft, _vm->_scenery->_toRedrawBottom,
-							_vm->_scenery->_toRedrawRight, _vm->_scenery->_toRedrawBottom, 15);
-					_vm->_video->drawLine(_vm->_draw->_frontSurface,
-							_vm->_scenery->_toRedrawLeft, _vm->_scenery->_toRedrawTop,
-							_vm->_scenery->_toRedrawLeft, _vm->_scenery->_toRedrawBottom, 15);
-					_vm->_video->drawLine(_vm->_draw->_frontSurface,
-							_vm->_scenery->_toRedrawRight, _vm->_scenery->_toRedrawTop,
-							_vm->_scenery->_toRedrawRight, _vm->_scenery->_toRedrawBottom, 15);
-				}
-				animObj1.lastLeft = _vm->_scenery->_toRedrawLeft;
-				animObj1.lastRight = _vm->_scenery->_toRedrawRight;
-				animObj1.lastTop = _vm->_scenery->_toRedrawTop;
-				animObj1.lastBottom = _vm->_scenery->_toRedrawBottom;
-			} else
-				animObj1.lastLeft = -1;
 		} else {
-			_vm->_scenery->_toRedrawLeft = animObj1.newLeft;
-			_vm->_scenery->_toRedrawRight = animObj1.newRight;
-			_vm->_scenery->_toRedrawTop = animObj1.newTop;
-			_vm->_scenery->_toRedrawBottom = animObj1.newBottom;
+
+			if (animData1.isStatic != 0) {
+				_vm->_scenery->_toRedrawLeft = animObj1.newLeft;
+				_vm->_scenery->_toRedrawRight = animObj1.newRight;
+				_vm->_scenery->_toRedrawTop = animObj1.newTop;
+				_vm->_scenery->_toRedrawBottom = animObj1.newBottom;
+			} else {
+				_vm->_scenery->updateAnim(animData1.layer, animData1.frame,
+						animData1.animation, 10, *animObj1.pPosX, *animObj1.pPosY, 1);
+
+				if (_vm->_scenery->_toRedrawLeft != -12345) {
+					animObj1.lastLeft = _vm->_scenery->_toRedrawLeft;
+					animObj1.lastRight = _vm->_scenery->_toRedrawRight;
+					animObj1.lastTop = _vm->_scenery->_toRedrawTop;
+					animObj1.lastBottom = _vm->_scenery->_toRedrawBottom;
+				} else {
+					animObj1.lastLeft = -1;
+				}
+
+			}
+
+			_vm->_scenery->updateStatic(animData1.order + 1);
+
 		}
-		_vm->_scenery->updateStatic(animData1.order + 1);
+
 	}
 
 	// Advance animations

Modified: scummvm/trunk/engines/gob/scenery.cpp
===================================================================
--- scummvm/trunk/engines/gob/scenery.cpp	2008-05-07 01:15:46 UTC (rev 31914)
+++ scummvm/trunk/engines/gob/scenery.cpp	2008-05-07 02:56:18 UTC (rev 31915)
@@ -155,9 +155,9 @@
 
 		ptr->layers[i].planes = new StaticPlane[ptr->layers[i].planeCount];
 		for (int j = 0; j < ptr->layers[i].planeCount; ++j) {
-			ptr->layers[i].planes[j].pictIndex = layerData.readSByte();
-			ptr->layers[i].planes[j].pieceIndex = layerData.readSByte();
-			ptr->layers[i].planes[j].drawOrder = layerData.readSByte();
+			ptr->layers[i].planes[j].pictIndex = layerData.readByte();
+			ptr->layers[i].planes[j].pieceIndex = layerData.readByte();
+			ptr->layers[i].planes[j].drawOrder = layerData.readByte();
 			ptr->layers[i].planes[j].destX = layerData.readSint16LE();
 			ptr->layers[i].planes[j].destY = layerData.readSint16LE();
 			ptr->layers[i].planes[j].transp = layerData.readSByte();
@@ -278,7 +278,7 @@
 	}
 
 	planeCount = layerPtr->planeCount;
-	for (order = 0; order < 40; order++) {
+	for (order = 0; order < 100; order++) {
 		for (plane = 0, planePtr = layerPtr->planes;
 		    plane < planeCount; plane++, planePtr++) {
 			if (planePtr->drawOrder != order)
@@ -330,7 +330,7 @@
 
 	planeCount = layerPtr->planeCount;
 
-	for (order = orderFrom; order < 40; order++) {
+	for (order = orderFrom; order < 100; order++) {
 		for (planePtr = layerPtr->planes, plane = 0;
 		    plane < planeCount; plane++, planePtr++) {
 			if (planePtr->drawOrder != order)
@@ -338,6 +338,10 @@
 
 			pieceIndex = planePtr->pieceIndex;
 			pictIndex = planePtr->pictIndex - 1;
+
+			if ((pictIndex >= _staticPictCount[index]) || (!pictPtr[pictIndex]))
+				continue;
+
 			_vm->_draw->_destSpriteX = planePtr->destX;
 			_vm->_draw->_destSpriteY = planePtr->destY;
 

Modified: scummvm/trunk/engines/gob/scenery.h
===================================================================
--- scummvm/trunk/engines/gob/scenery.h	2008-05-07 01:15:46 UTC (rev 31914)
+++ scummvm/trunk/engines/gob/scenery.h	2008-05-07 02:56:18 UTC (rev 31915)
@@ -41,9 +41,9 @@
 	} PACKED_STRUCT;
 
 	struct StaticPlane {
-		int8 pictIndex;
-		int8 pieceIndex;
-		int8 drawOrder;
+		uint8 pictIndex;
+		uint8 pieceIndex;
+		uint8 drawOrder;
 		int16 destX;
 		int16 destY;
 		int8 transp;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list