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

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Mon Jun 12 23:33:43 CEST 2006


Revision: 23066
Author:   drmccoy
Date:     2006-06-12 14:33:30 -0700 (Mon, 12 Jun 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=23066&view=rev

Log Message:
-----------
Fixing loading of Scenery::_animations[] + small gob2 cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/gob/goblin.cpp
    scummvm/trunk/engines/gob/goblin_v1.cpp
    scummvm/trunk/engines/gob/goblin_v2.cpp
    scummvm/trunk/engines/gob/inter_v1.cpp
    scummvm/trunk/engines/gob/inter_v2.cpp
    scummvm/trunk/engines/gob/mult_v1.cpp
    scummvm/trunk/engines/gob/mult_v2.cpp
    scummvm/trunk/engines/gob/scenery.cpp
    scummvm/trunk/engines/gob/scenery.h
    scummvm/trunk/engines/gob/scenery_v1.cpp
    scummvm/trunk/engines/gob/scenery_v2.cpp
Modified: scummvm/trunk/engines/gob/goblin.cpp
===================================================================
--- scummvm/trunk/engines/gob/goblin.cpp	2006-06-12 21:33:30 UTC (rev 23065)
+++ scummvm/trunk/engines/gob/goblin.cpp	2006-06-12 21:33:30 UTC (rev 23066)
@@ -498,7 +498,7 @@
 
 			layer = objDesc->stateMach[objDesc->state][0]->layer;
 			pLayer =
-			    _vm->_scenery->_animations[objDesc->animation].layers[layer];
+			    &_vm->_scenery->_animations[objDesc->animation].layers[layer];
 
 			if (objDesc->curFrame < pLayer->framesCount)
 				continue;
@@ -547,8 +547,7 @@
 	int16 layer;
 
 	layer = objDesc->stateMach[objDesc->state][0]->layer;
-	return _vm->_scenery->_animations[objDesc->animation].layers[layer]->framesCount -
-	    1;
+	return _vm->_scenery->_animations[objDesc->animation].layers[layer].framesCount - 1;
 }
 
 int16 Goblin::objIntersected(Gob_Object *obj1, Gob_Object *obj2) {
@@ -609,7 +608,7 @@
 	layer = gobDesc->stateMach[gobDesc->state][0]->layer;
 
 	frameCount =
-	    _vm->_scenery->_animations[gobDesc->animation].layers[layer]->framesCount;
+	    _vm->_scenery->_animations[gobDesc->animation].layers[layer].framesCount;
 	state = gobDesc->state;
 	frame = gobDesc->curFrame;
 
@@ -1226,7 +1225,7 @@
 
 	layer = gobDesc->stateMach[gobDesc->state][0]->layer;
 	framesCount =
-	    _vm->_scenery->_animations[gobDesc->animation].layers[layer]->framesCount;
+	    _vm->_scenery->_animations[gobDesc->animation].layers[layer].framesCount;
 
 	if (VAR(59) == 0 &&
 	    gobDesc->state != 30 && gobDesc->state != 31) {
@@ -1977,7 +1976,7 @@
 	animData->frame = 0;
 	animData->isPaused = 0;
 	animData->isStatic = 0;
-	animData->newCycle = _vm->_scenery->_animations[animation].layers[layer]->framesCount;
+	animData->newCycle = _vm->_scenery->_animations[animation].layers[layer].framesCount;
 	_vm->_scenery->updateAnim(layer, 0, animation, 0, *obj->pPosX, *obj->pPosY, 1);
 
 	if (_vm->_map->_bigTiles) {
@@ -2004,7 +2003,7 @@
 
 	layer = obj->goblinStates[animData->state][0].layer;
 	animation = obj->goblinStates[animData->state][0].animation;
-	framesCount = _vm->_scenery->_animations[animation].layers[layer]->framesCount;
+	framesCount = _vm->_scenery->_animations[animation].layers[layer].framesCount;
 	animData->newCycle = framesCount;
 	playSounds(obj);
 
@@ -2042,9 +2041,9 @@
 		animData->field_F = -1;
 		animData->animation = obj->goblinStates[animData->state][0].animation;
 		animData->layer = obj->goblinStates[animData->state][0].layer;
-		*obj->pPosX += _vm->_scenery->_animations[animation].layers[layer]->animDeltaX;
-		*obj->pPosY += _vm->_scenery->_animations[animation].layers[layer]->animDeltaY;
-		animData->newCycle = _vm->_scenery->_animations[animation].layers[layer]->framesCount;
+		*obj->pPosX += _vm->_scenery->_animations[animation].layers[layer].animDeltaX;
+		*obj->pPosY += _vm->_scenery->_animations[animation].layers[layer].animDeltaY;
+		animData->newCycle = _vm->_scenery->_animations[animation].layers[layer].framesCount;
 		animData->isPaused = 0;
 	} else
 		animData->frame--;

Modified: scummvm/trunk/engines/gob/goblin_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/goblin_v1.cpp	2006-06-12 21:33:30 UTC (rev 23065)
+++ scummvm/trunk/engines/gob/goblin_v1.cpp	2006-06-12 21:33:30 UTC (rev 23066)
@@ -522,11 +522,11 @@
 
 		newX =
 		    _vm->_scenery->_animations[gobDesc->animation].
-		    layers[_gobStateLayer]->animDeltaX + gobDesc->xPos;
+		    layers[_gobStateLayer].animDeltaX + gobDesc->xPos;
 
 		newY =
 		    _vm->_scenery->_animations[gobDesc->animation].
-		    layers[_gobStateLayer]->animDeltaY + gobDesc->yPos;
+		    layers[_gobStateLayer].animDeltaY + gobDesc->yPos;
 
 		_gobStateLayer = nextLayer(gobDesc);
 

Modified: scummvm/trunk/engines/gob/goblin_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/goblin_v2.cpp	2006-06-12 21:33:30 UTC (rev 23065)
+++ scummvm/trunk/engines/gob/goblin_v2.cpp	2006-06-12 21:33:30 UTC (rev 23066)
@@ -96,7 +96,7 @@
 			objAnim->frame = 0;
 			objAnim->isPaused = 0;
 			objAnim->isStatic = 0;
-			objAnim->newCycle = _vm->_scenery->_animations[animation].layers[layer]->framesCount;
+			objAnim->newCycle = _vm->_scenery->_animations[animation].layers[layer].framesCount;
 			_vm->_scenery->updateAnim(layer, 0, animation, 0, *obj->pPosX, *obj->pPosY, 0);
 			if (!_vm->_map->_bigTiles)
 				*obj->pPosY = (y + 1) * _vm->_map->_tilesHeight
@@ -139,7 +139,7 @@
 	dir = 0;
 	animData = obj->pAnimData;
 	framesCount =
-		_vm->_scenery->_animations[(int)animData->animation].layers[animData->layer]->framesCount;
+		_vm->_scenery->_animations[(int)animData->animation].layers[animData->layer].framesCount;
 	gobX = obj->goblinX;
 	gobY = obj->goblinY;
 	animData->order = gobY;
@@ -317,7 +317,7 @@
 	animData = obj->pAnimData;
 
 	framesCount =
-		_vm->_scenery->_animations[(int)animData->animation].layers[animData->layer]->framesCount;
+		_vm->_scenery->_animations[(int)animData->animation].layers[animData->layer].framesCount;
 
 	if (animData->isPaused == 0)
 		animData->frame++;
@@ -388,9 +388,9 @@
 		animData->field_F = -1;
 		animData->state = animData->nextState;
 		*obj->pPosX +=
-			_vm->_scenery->_animations[animData->animation].layers[animData->layer]->animDeltaX;
+			_vm->_scenery->_animations[animData->animation].layers[animData->layer].animDeltaX;
 		*obj->pPosY +=
-			_vm->_scenery->_animations[animData->animation].layers[animData->layer]->animDeltaY;
+			_vm->_scenery->_animations[animData->animation].layers[animData->layer].animDeltaY;
 		animation = obj->goblinStates[animData->nextState][0].animation;
 		layer = obj->goblinStates[animData->nextState][0].layer;
 		animData->layer = layer;

Modified: scummvm/trunk/engines/gob/inter_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v1.cpp	2006-06-12 21:33:30 UTC (rev 23065)
+++ scummvm/trunk/engines/gob/inter_v1.cpp	2006-06-12 21:33:30 UTC (rev 23066)
@@ -2317,11 +2317,9 @@
 		layer = objDesc->stateMach[objDesc->state][0]->layer;
 
 		objDesc->xPos =
-				_vm->_scenery->_animations[objDesc->animation].layers[layer]->
-				posX;
+				_vm->_scenery->_animations[objDesc->animation].layers[layer].posX;
 		objDesc->yPos =
-				_vm->_scenery->_animations[objDesc->animation].layers[layer]->
-				posY;
+				_vm->_scenery->_animations[objDesc->animation].layers[layer].posY;
 
 		*_vm->_goblin->_curGobScrXVarPtr = objDesc->xPos;
 		*_vm->_goblin->_curGobScrYVarPtr = objDesc->yPos;
@@ -2415,9 +2413,9 @@
 	layer = objDesc->stateMach[objDesc->state][0]->layer;
 
 	objDesc->xPos =
-			_vm->_scenery->_animations[objDesc->animation].layers[layer]->posX;
+			_vm->_scenery->_animations[objDesc->animation].layers[layer].posX;
 	objDesc->yPos =
-			_vm->_scenery->_animations[objDesc->animation].layers[layer]->posY;
+			_vm->_scenery->_animations[objDesc->animation].layers[layer].posY;
 
 	if (item == _vm->_goblin->_currentGoblin) {
 		*_vm->_goblin->_curGobScrXVarPtr = objDesc->xPos;
@@ -2439,9 +2437,9 @@
 	_vm->_goblin->nextLayer(objDesc);
 	layer = objDesc->stateMach[objDesc->state][0]->layer;
 	objDesc->xPos =
-			_vm->_scenery->_animations[objDesc->animation].layers[layer]->posX;
+			_vm->_scenery->_animations[objDesc->animation].layers[layer].posX;
 	objDesc->yPos =
-			_vm->_scenery->_animations[objDesc->animation].layers[layer]->posY;
+			_vm->_scenery->_animations[objDesc->animation].layers[layer].posY;
 
 	objDesc->toRedraw = 1;
 	objDesc->type = 0;

Modified: scummvm/trunk/engines/gob/inter_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v2.cpp	2006-06-12 21:33:30 UTC (rev 23065)
+++ scummvm/trunk/engines/gob/inter_v2.cpp	2006-06-12 21:33:30 UTC (rev 23066)
@@ -1172,8 +1172,8 @@
 			objAnim->layer = obj->goblinStates[objAnim->state][0].layer;
 			objAnim->animation = animation;
 			if ((*obj->pPosX == 1000) && (*obj->pPosY == 1000)) {
-				*obj->pPosX = _vm->_scenery->_animations[objAnim->animation].layers[objAnim->state]->posX;
-				*obj->pPosY = _vm->_scenery->_animations[objAnim->animation].layers[objAnim->state]->posY;
+				*obj->pPosX = _vm->_scenery->_animations[objAnim->animation].layers[objAnim->state].posX;
+				*obj->pPosY = _vm->_scenery->_animations[objAnim->animation].layers[objAnim->state].posY;
 			}
 			_vm->_scenery->updateAnim(layer, 0, animation, 0, *obj->pPosX, *obj->pPosY, 0);
 		}

Modified: scummvm/trunk/engines/gob/mult_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/mult_v1.cpp	2006-06-12 21:33:30 UTC (rev 23065)
+++ scummvm/trunk/engines/gob/mult_v1.cpp	2006-06-12 21:33:30 UTC (rev 23066)
@@ -860,7 +860,7 @@
 			} else {
 				pAnimData->frame++;
 				if (pAnimData->frame >=
-				    _vm->_scenery->_animations[(int)pAnimData->animation].layers[pAnimData->layer]->framesCount) {
+				    _vm->_scenery->_animations[(int)pAnimData->animation].layers[pAnimData->layer].framesCount) {
 					switch (pAnimData->animType) {
 					case 0:
 						pAnimData->frame = 0;
@@ -871,11 +871,11 @@
 
 						*(_objects[i].pPosX) =
 						    *(_objects[i].pPosX) +
-						    _vm->_scenery->_animations[(int)pAnimData->animation].layers[pAnimData->layer]->animDeltaX;
+						    _vm->_scenery->_animations[(int)pAnimData->animation].layers[pAnimData->layer].animDeltaX;
 
 						*(_objects[i].pPosY) =
 						    *(_objects[i].pPosY) +
-						    _vm->_scenery->_animations[(int)pAnimData->animation].layers[pAnimData->layer]->animDeltaY;
+						    _vm->_scenery->_animations[(int)pAnimData->animation].layers[pAnimData->layer].animDeltaY;
 						break;
 
 					case 2:

Modified: scummvm/trunk/engines/gob/mult_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/mult_v2.cpp	2006-06-12 21:33:30 UTC (rev 23065)
+++ scummvm/trunk/engines/gob/mult_v2.cpp	2006-06-12 21:33:30 UTC (rev 23066)
@@ -77,16 +77,6 @@
 	_multData2 = new Mult_Data;
 	memset(_multData2, 0, sizeof(Mult_Data));
 
-	// ---.
-	for (i = 0; i < 4; i++) {
-		_multData2->field_157[i] = 0;
-		for (j = 0; j < 4; j++) {
-			_multData2->field_15F[i][j] = 0;
-			_multData2->field_17F[i][j] = 0;
-		}
-	}
-	// ---'
-
 	_multDatas[index] = _multData2;
 
 	for (i = 0; i < 10; i++) {
@@ -1012,37 +1002,21 @@
 	doSoundAnim(0, frame);
 	WRITE_VAR(22, frame);
 
-	if (_multData2->field_156 == 1) { // loc_6809
-		frame++;
-		if (_multData2->field_157[index] == (frame-1)) {
-			_multData2->someKeysIndices[0] = -1;
-			_multData2->someKeysIndices[1] = -1;
-			_multData2->someKeysIndices[2] = -1;
-			_multData2->someKeysIndices[3] = -1;
-			frame = -1;
-			for (i = 0; i < 4; i++) {
-				if ((_multData2->field_124[index][i] == -1) || (_multData2->field_124[index][i] == 1024))
-					continue;
+	if (_multData2->field_157[index] == frame) {
+		_multData2->someKeysIndices[0] = -1;
+		_multData2->someKeysIndices[1] = -1;
+		_multData2->someKeysIndices[2] = -1;
+		_multData2->someKeysIndices[3] = -1;
+		frame = -1;
+		for (i = 0; i < 4; i++)
+			if ((_multData2->field_124[index][i] != -1) && (_multData2->field_124[index][i] != 1024))
 				_objects[_multData2->field_124[index][i]].pAnimData->animType =
 					_objects[_multData2->field_124[index][i]].pAnimData->field_17;
-			}
-		}
-	} else { // loc_68F3
+	} else if(_multData2->field_156 == 1)
+		frame++;
+	else
 		frame--;
-		if (_multData2->field_157[index] == (frame+1)) {
-			_multData2->someKeysIndices[0] = -1;
-			_multData2->someKeysIndices[1] = -1;
-			_multData2->someKeysIndices[2] = -1;
-			_multData2->someKeysIndices[3] = -1;
-			frame = -1;
-			for (i = 0; i < 4; i++) {
-				if ((_multData2->field_124[index][i] == -1) || (_multData2->field_124[index][i] == 1024))
-					continue;
-				_objects[_multData2->field_124[index][i]].pAnimData->animType =
-					_objects[_multData2->field_124[index][i]].pAnimData->field_17;
-			}
-		}
-	}
+
 	// loc_6A06
 	_multData2->animKeysFrames[index] = frame;
 	WRITE_VAR(18 + index, frame);
@@ -1135,29 +1109,27 @@
 						animObj1->someFlag = 0;
 					}
 				}
-			} else {
-				if (animData1->isStatic == 0) {
-					if (animObj1->lastLeft == -1) {
-						animObj1->someFlag = 1;
-						_vm->_scenery->updateAnim(animData1->layer, animData1->frame,
-							animData1->animation, 8, *animObj1->pPosX, *animObj1->pPosY, 0);
-						animObj1->somethingLeft = _vm->_scenery->_toRedrawLeft;
-						animObj1->somethingTop = _vm->_scenery->_toRedrawTop;
-						animObj1->somethingRight = _vm->_scenery->_toRedrawRight;
-						animObj1->somethingBottom = _vm->_scenery->_toRedrawBottom;
-					} else {
-						animObj1->somethingLeft = animObj1->lastLeft;
-						animObj1->somethingTop = animObj1->lastTop;
-						animObj1->somethingRight = animObj1->lastRight;
-						animObj1->somethingBottom = animObj1->lastBottom;
-					}
-				} else if (animObj1->lastLeft != -1) {
+			} else if (animData1->isStatic == 0) {
+				if (animObj1->lastLeft == -1) {
 					animObj1->someFlag = 1;
+					_vm->_scenery->updateAnim(animData1->layer, animData1->frame,
+						animData1->animation, 8, *animObj1->pPosX, *animObj1->pPosY, 0);
+					animObj1->somethingLeft = _vm->_scenery->_toRedrawLeft;
+					animObj1->somethingTop = _vm->_scenery->_toRedrawTop;
+					animObj1->somethingRight = _vm->_scenery->_toRedrawRight;
+					animObj1->somethingBottom = _vm->_scenery->_toRedrawBottom;
+				} else {
 					animObj1->somethingLeft = animObj1->lastLeft;
 					animObj1->somethingTop = animObj1->lastTop;
 					animObj1->somethingRight = animObj1->lastRight;
 					animObj1->somethingBottom = animObj1->lastBottom;
 				}
+			} else if (animObj1->lastLeft != -1) {
+				animObj1->someFlag = 1;
+				animObj1->somethingLeft = animObj1->lastLeft;
+				animObj1->somethingTop = animObj1->lastTop;
+				animObj1->somethingRight = animObj1->lastRight;
+				animObj1->somethingBottom = animObj1->lastBottom;
 			}
 			animData1->somethingLayer = animData1->layer;
 			animData1->somethingFrame = animData1->frame;
@@ -1194,7 +1166,7 @@
 		for (i = 0; i < numAnims; i++) {
 			animData1 = _renderData2[i]->pAnimData;
 			if (((animData1->isStatic == 0) || (_renderData2[i]->someFlag != 0))
-					& (animData1->order == j))
+					&& (animData1->order == j))
 				orderArray[orderArrayPos++] = i;
 		}
 	}
@@ -1216,62 +1188,57 @@
 	for (i = 0; i < orderArrayPos; i++) {
 		animObj1 = _renderData2[orderArray[i]];
 		animData1 = animObj1->pAnimData;
-		if (animObj1->someFlag == 0) {
-			if (animData1->isStatic == 0) {
-				for (j = 0; j < orderArrayPos; j++) {
-					animObj2 = _renderData2[orderArray[j]];
-					if ((animObj2->someFlag != 0) &&
-							(animObj1->somethingRight >= animObj2->somethingLeft) &&
-							(animObj2->somethingRight >= animObj1->somethingLeft) &&
-							(animObj1->somethingBottom >= animObj2->somethingTop) &&
-							(animObj2->somethingBottom >= animObj1->somethingTop))
-					{
-						_vm->_scenery->_toRedrawLeft = animObj2->somethingLeft;
-						_vm->_scenery->_toRedrawRight = animObj2->somethingRight;
-						_vm->_scenery->_toRedrawTop = animObj2->somethingTop;
-						_vm->_scenery->_toRedrawBottom = animObj2->somethingBottom;
-						_vm->_scenery->updateAnim(animData1->layer, animData1->frame,
-								animData1->animation, 12, *animObj1->pPosX, *animObj1->pPosY, 1);
-						_vm->_scenery->updateStatic(animObj1->pAnimData->order + 1);
-					}
+		if ((animObj1->someFlag == 0) && (animData1->isStatic == 0)) {
+			for (j = 0; j < orderArrayPos; j++) {
+				animObj2 = _renderData2[orderArray[j]];
+				if ((animObj2->someFlag != 0) &&
+						(animObj1->somethingRight >= animObj2->somethingLeft) &&
+						(animObj2->somethingRight >= animObj1->somethingLeft) &&
+						(animObj1->somethingBottom >= animObj2->somethingTop) &&
+						(animObj2->somethingBottom >= animObj1->somethingTop))
+				{
+					_vm->_scenery->_toRedrawLeft = animObj2->somethingLeft;
+					_vm->_scenery->_toRedrawRight = animObj2->somethingRight;
+					_vm->_scenery->_toRedrawTop = animObj2->somethingTop;
+					_vm->_scenery->_toRedrawBottom = animObj2->somethingBottom;
+					_vm->_scenery->updateAnim(animData1->layer, animData1->frame,
+							animData1->animation, 12, *animObj1->pPosX, *animObj1->pPosY, 1);
+					_vm->_scenery->updateStatic(animObj1->pAnimData->order + 1);
 				}
 			}
-		} else {
-			if (animData1->isStatic == 0) {
-				_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]) {
-						warning("GOB2 Stub! word_2F3BF & word_2F3C1; someValueToAddToY & someValueToAddToX, respectively");
-						// draws a rectangle around the region to redraw, why?
-						_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 if (animData1->isStatic == 0) {
+			_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]) {
+					warning("GOB2 Stub! word_2F3BF & word_2F3C1; someValueToAddToY & someValueToAddToX, respectively");
+					// draws a rectangle around the region to redraw, why?
+					_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);
 				}
-			} else {
-				_vm->_scenery->_toRedrawLeft = animObj1->somethingLeft;
-				_vm->_scenery->_toRedrawRight = animObj1->somethingRight;
-				_vm->_scenery->_toRedrawTop = animObj1->somethingTop;
-				_vm->_scenery->_toRedrawBottom = animObj1->somethingBottom;
-			}
-			_vm->_scenery->updateStatic(animObj1->pAnimData->order + 1);
+				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->somethingLeft;
+			_vm->_scenery->_toRedrawRight = animObj1->somethingRight;
+			_vm->_scenery->_toRedrawTop = animObj1->somethingTop;
+			_vm->_scenery->_toRedrawBottom = animObj1->somethingBottom;
 		}
+		_vm->_scenery->updateStatic(animObj1->pAnimData->order + 1);
 	}
 
 	for (i = 0; i < numAnims; i++) {
@@ -1300,7 +1267,7 @@
 					if (animData1->animType != 8)
 						animData1->frame++;
 					if (animData1->frame >=
-							_vm->_scenery->_animations[(int)animData1->animation].layers[animData1->layer]->framesCount) {
+							_vm->_scenery->_animations[(int)animData1->animation].layers[animData1->layer].framesCount) {
 						switch (animData1->animType) {
 						case 0:
 							animData1->frame = 0;
@@ -1309,9 +1276,9 @@
 						case 1:
 							animData1->frame = 0;
 							*(_objects[i].pPosX) +=
-								_vm->_scenery->_animations[(int)animData1->animation].layers[animData1->layer]->animDeltaX;
+								_vm->_scenery->_animations[(int)animData1->animation].layers[animData1->layer].animDeltaX;
 							*(_objects[i].pPosY) +=
-								_vm->_scenery->_animations[(int)animData1->animation].layers[animData1->layer]->animDeltaY;
+								_vm->_scenery->_animations[(int)animData1->animation].layers[animData1->layer].animDeltaY;
 							break;
 
 						case 2:
@@ -1352,27 +1319,24 @@
 	for (i = 0; i < numAnims; i++) {
 		animObj1 = _renderData2[i];
 		animData1 = animObj1->pAnimData;
-		if ((animData1->isStatic != 0) || (animObj1->lastLeft == -1))
-			continue;
-
-		for (j = 0; j < numAnims; j++) {
-			if (i == j)
-				continue;
-			animObj2 = _renderData2[j];
-			animData2 = animObj2->pAnimData;
-			if ((animData2->isStatic != 0) || (animObj2->lastLeft == -1))
-				continue;
-			if ((animObj2->lastRight >= animObj1->lastLeft) &&
-					(animObj2->lastLeft <= animObj1->lastRight) &&
-					(animObj2->lastBottom >= animObj1->lastTop) &&
-					(animObj2->lastTop <= animObj1->lastBottom))
-				animData2->intersected = animIndices[i];
-		}
+		if ((animData1->isStatic == 0) && (animObj1->lastLeft != -1))
+			for (j = 0; j < numAnims; j++) {
+				animObj2 = _renderData2[j];
+				animData2 = animObj2->pAnimData;
+				if ((i != j) && (animData2->isStatic == 0) && (animObj2->lastLeft != -1))
+					if ((animObj2->lastRight >= animObj1->lastLeft) &&
+							(animObj2->lastLeft <= animObj1->lastRight) &&
+							(animObj2->lastBottom >= animObj1->lastTop) &&
+							(animObj2->lastTop <= animObj1->lastBottom))
+						animData2->intersected = animIndices[i];
+			}
 	}
+
 }
 
 void Mult_v2::playSound(Snd::SoundDesc * soundDesc, int16 repCount, int16 freq,
 	    int16 channel) {
+//	warning("playSound, %d, %d, %d", repCount, freq, channel);
 	if (soundDesc->frequency >= 0) {
 		if (soundDesc->frequency == freq)
 			_vm->_snd->playSample(soundDesc, repCount, -channel);

Modified: scummvm/trunk/engines/gob/scenery.cpp
===================================================================
--- scummvm/trunk/engines/gob/scenery.cpp	2006-06-12 21:33:30 UTC (rev 23065)
+++ scummvm/trunk/engines/gob/scenery.cpp	2006-06-12 21:33:30 UTC (rev 23066)
@@ -374,8 +374,12 @@
 	int16 picsCount;
 	int16 resId;
 	int16 i;
+	int16 j;
 	int16 sceneryIndex;
+	int16 framesCount;
 	char *dataPtr;
+	char *dataPtr2;
+	char *dataPtr3;
 	Animation *ptr;
 	int16 offset;
 	int16 pictDescId;
@@ -425,20 +429,41 @@
 	ptr->layersCount = READ_LE_UINT16(dataPtr);
 	dataPtr += 2;
 
-	ptr->layers = new AnimLayer*[ptr->layersCount];
+	ptr->layers = new AnimLayer[ptr->layersCount];
 	ptr->pieces = new PieceDesc*[picsCount];
 	ptr->piecesFromExt = new int8[picsCount];
 
 	for (i = 0; i < ptr->layersCount; i++) {
+//		ptr->layers[i] = new AnimLayer;
 		offset = (int16)READ_LE_UINT16(&((int16 *)dataPtr)[i]);
-		ptr->layers[i] = (AnimLayer *) (dataPtr + offset - 2);
+		dataPtr2 = dataPtr + offset - 2;
 
-		ptr->layers[i]->unknown0 = (int16)READ_LE_UINT16(&ptr->layers[i]->unknown0);
-		ptr->layers[i]->posX = (int16)READ_LE_UINT16(&ptr->layers[i]->posX);
-		ptr->layers[i]->posY = (int16)READ_LE_UINT16(&ptr->layers[i]->posY);
-		ptr->layers[i]->animDeltaX = (int16)READ_LE_UINT16(&ptr->layers[i]->animDeltaX);
-		ptr->layers[i]->animDeltaY = (int16)READ_LE_UINT16(&ptr->layers[i]->animDeltaY);
-		ptr->layers[i]->framesCount = (int16)READ_LE_UINT16(&ptr->layers[i]->framesCount);
+		ptr->layers[i].unknown0 = (int16)READ_LE_UINT16(dataPtr2);
+		ptr->layers[i].posX = (int16)READ_LE_UINT16(dataPtr2 + 2);
+		ptr->layers[i].posY = (int16)READ_LE_UINT16(dataPtr2 + 4);
+		ptr->layers[i].animDeltaX = (int16)READ_LE_UINT16(dataPtr2 + 6);
+		ptr->layers[i].animDeltaY = (int16)READ_LE_UINT16(dataPtr2 + 8);
+		ptr->layers[i].transp = (int8) *(dataPtr2 + 10);
+		ptr->layers[i].framesCount = (int16)READ_LE_UINT16(dataPtr2 + 11);
+		dataPtr2 += 13;
+
+		framesCount = 0;
+		dataPtr3 = dataPtr2;
+		for (j = 0; j < ptr->layers[i].framesCount; j++, framesCount++, dataPtr3 += 5) {
+			while(dataPtr3[4] == 1) {
+				framesCount++;
+				dataPtr3 += 5;
+			}
+		}
+
+		ptr->layers[i].frames = new AnimFramePiece[framesCount];
+		for (j = 0; j < framesCount; j++) {
+			ptr->layers[i].frames[j].pictIndex = *dataPtr2++;
+			ptr->layers[i].frames[j].pieceIndex = *dataPtr2++;
+			ptr->layers[i].frames[j].destX = *dataPtr2++;
+			ptr->layers[i].frames[j].destY = *dataPtr2++;
+			ptr->layers[i].frames[j].notFinal = *dataPtr2++;
+		}
 	}
 
 	for (i = 0; i < picsCount; i++) {
@@ -511,6 +536,9 @@
 		}
 	}
 
+	
+	for (i = 0; i < _animations[animation].layersCount; i++)
+		delete[] _animations[animation].layers[i].frames;
 	delete[] _animations[animation].layers;
 	delete[] _animations[animation].pieces;
 	delete[] _animations[animation].piecesFromExt;
@@ -531,7 +559,7 @@
 
 	_vm->_inter->evalExpr(&animation);
 	_vm->_inter->evalExpr(&layer);
-	layerPtr = _animations[animation].layers[layer];
+	layerPtr = &_animations[animation].layers[layer];
 
 	var = _vm->_parse->parseVarIndex();
 	WRITE_VAR_OFFSET(var, layerPtr->animDeltaX);

Modified: scummvm/trunk/engines/gob/scenery.h
===================================================================
--- scummvm/trunk/engines/gob/scenery.h	2006-06-12 21:33:30 UTC (rev 23065)
+++ scummvm/trunk/engines/gob/scenery.h	2006-06-12 21:33:30 UTC (rev 23066)
@@ -68,7 +68,7 @@
 		int16 animDeltaY;
 		int8 transp;
 		int16 framesCount;
-		AnimFramePiece frames[1];
+		AnimFramePiece *frames;
 	} GCC_PACK;
 #pragma END_PACK_STRUCTS
 
@@ -84,7 +84,7 @@
 
 	struct Animation {
 		int16 layersCount;
-		AnimLayer **layers;
+		AnimLayer *layers;
 		PieceDesc **pieces;
 		int8 *piecesFromExt;
 		char *dataPtr;

Modified: scummvm/trunk/engines/gob/scenery_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/scenery_v1.cpp	2006-06-12 21:33:30 UTC (rev 23065)
+++ scummvm/trunk/engines/gob/scenery_v1.cpp	2006-06-12 21:33:30 UTC (rev 23066)
@@ -43,11 +43,12 @@
 	    int16 drawDeltaX, int16 drawDeltaY, char doDraw) {
 	AnimLayer *layerPtr;
 	PieceDesc **pictPtr;
-	AnimFramePiece *framePtr;
 
 	uint16 pieceIndex;
 	uint16 pictIndex;
 
+	int16 curFrame;
+
 	int16 left;
 	int16 right;
 	int16 top;
@@ -65,7 +66,7 @@
 	if (layer >= _animations[animation].layersCount)
 		return;
 
-	layerPtr = _animations[animation].layers[layer];
+	layerPtr = &_animations[animation].layers[layer];
 
 	if (frame >= layerPtr->framesCount)
 		return;
@@ -85,11 +86,11 @@
 		*_pCaptureCounter = *_pCaptureCounter + 1;
 	}
 	pictPtr = _animations[animation].pieces;
-	framePtr = layerPtr->frames;
+	curFrame = 0;
 
-	for (i = 0; i < frame; i++, framePtr++) {
-		while (framePtr->notFinal == 1)
-			framePtr++;
+	for (i = 0; i < frame; i++, curFrame++) {
+		while (layerPtr->frames[curFrame].notFinal == 1)
+			curFrame++;
 	}
 
 	if ((flags & 4) == 0) {
@@ -109,15 +110,15 @@
 
 	transp = layerPtr->transp ? 3 : 0;
 
-	framePtr--;
+	curFrame--;
 	do {
-		framePtr++;
+		curFrame++;
 
-		pieceIndex = framePtr->pieceIndex;
-		pictIndex = framePtr->pictIndex;
+		pieceIndex = layerPtr->frames[curFrame].pieceIndex;
+		pictIndex = layerPtr->frames[curFrame].pictIndex;
 
-		destX = framePtr->destX;
-		destY = framePtr->destY;
+		destX = layerPtr->frames[curFrame].destX;
+		destY = layerPtr->frames[curFrame].destY;
 
 		highX = pictIndex & 0xc0;
 		highY = pictIndex & 0x30;
@@ -238,7 +239,7 @@
 				    (int16)(destY + bottom - top));
 			}
 		}
-	} while (framePtr->notFinal == 1);
+	} while (layerPtr->frames[curFrame].notFinal == 1);
 }
 
 } // End of namespace Gob

Modified: scummvm/trunk/engines/gob/scenery_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/scenery_v2.cpp	2006-06-12 21:33:30 UTC (rev 23065)
+++ scummvm/trunk/engines/gob/scenery_v2.cpp	2006-06-12 21:33:30 UTC (rev 23066)
@@ -67,7 +67,7 @@
 	if (layer >= _animations[animation].layersCount)
 		return;
 
-	layerPtr = _animations[animation].layers[layer];
+	layerPtr = &_animations[animation].layers[layer];
 
 	if (frame >= layerPtr->framesCount)
 		return;


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