[Scummvm-cvs-logs] CVS: scummvm/kyra kyra.cpp,1.68,1.69 script_v1.cpp,1.20,1.21

Johannes Schickel lordhoto at users.sourceforge.net
Thu Nov 10 13:43:02 CET 2005


Update of /cvsroot/scummvm/scummvm/kyra
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29466

Modified Files:
	kyra.cpp script_v1.cpp 
Log Message:
Fixed cmd_blockInWalkableRegion and findSubPatch.


Index: kyra.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.cpp,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- kyra.cpp	10 Nov 2005 18:58:44 -0000	1.68
+++ kyra.cpp	10 Nov 2005 21:42:41 -0000	1.69
@@ -1409,7 +1409,7 @@
 
 // maybe move this two functions to Screen
 void KyraEngine::blockInRegion(int x, int y, int width, int height) {
-	debug(9, "blockInRegion(%d, %d, %d, %d, %d)", x, y, width, height);
+	debug(9, "blockInRegion(%d, %d, %d, %d)", x, y, width, height);
 	assert(_screen->_shapePages[0]);
 	byte *toPtr = _screen->_shapePages[0] + (y * 320 + x);
 	for (int i = 0; i < height; ++i) {
@@ -1422,7 +1422,7 @@
 }
 
 void KyraEngine::blockOutRegion(int x, int y, int width, int height) {
-	debug(9, "blockOutRegion(%d, %d, %d, %d, %d)", x, y, width, height);
+	debug(9, "blockOutRegion(%d, %d, %d, %d)", x, y, width, height);
 	assert(_screen->_shapePages[0]);
 	byte *toPtr = _screen->_shapePages[0] + (y * 320 + x);
 	for (int i = 0; i < height; ++i) {
@@ -1878,7 +1878,7 @@
 }
 
 #pragma mark -
-#pragma mark - Item handling
+#pragma mark - Text handling
 #pragma mark -
 
 void KyraEngine::setTalkCoords(uint16 y) {
@@ -2952,6 +2952,7 @@
 	int tempValue = 0;
 	int *pathTable1 = new int[0x7D0];
 	int *pathTable2 = new int[0x7D0];
+	assert(pathTable1 && pathTable2);
 	
 	while (true) {
 		int newFacing = getFacingFromPointToPoint(x, y, toX, toY);
@@ -2961,10 +2962,8 @@
 			if (!lineIsPassable(curX, curY))
 				break;
 			moveTable[lastUsedEntry++] = newFacing;
-			x = curX;
-			y = curY;
 			break;
-		}		
+		}
 		
 		if (lineIsPassable(curX, curY)) {
 			if (lastUsedEntry == moveTableSize) {
@@ -3008,7 +3007,6 @@
 				}
 			}
 			
-			assert(pathTable1 && pathTable2);
 			temp = findSubPath(x, y, curX, curY, pathTable1, 1, 0x7D0);
 			tempValue = findSubPath(x, y, curX, curY, pathTable2, 0, 0x7D0);
 			if (curX == toX && curY == toY) {
@@ -3049,7 +3047,7 @@
 	}
 	delete [] pathTable1;
 	delete [] pathTable2;
-	moveTable[lastUsedEntry] = 8;	
+	moveTable[lastUsedEntry] = 8;
 	return getMoveTableSize(moveTable);
 }
 
@@ -3064,7 +3062,7 @@
 	static const int8 addPosTable2[] = { -1,  2, -1,  0, -1, -2, -1,  0, -1,  0, -1,  2, -1,  0, -1, -2 };
 	
 	// debug specific
-	//++unkTable[start];	
+	//++unkTable[start];
 	//while (_screen->getPalette(0)[unkTable[start]] != 0x0F) {
 	//	++unkTable[start];
 	//}
@@ -3075,19 +3073,21 @@
 	int position = 0;
 	
 	while (position != end) {
-		changePosTowardsFacing(xpos1, ypos1, facingTable1[start<<3 + newFacing]);
+		int newFacing2 = newFacing;
 		while (true) {
+			changePosTowardsFacing(xpos1, ypos1, facingTable1[start*8 + newFacing2]);
 			if (!lineIsPassable(xpos1, ypos1)) {
-				if (facingTable1[start<<3 + newFacing] == newFacing) {
+				if (facingTable1[start*8 + newFacing2] == newFacing) {
 					return 0x7D00;
 				}
-				newFacing = facingTable1[start<<3 + newFacing];
+				newFacing2 = facingTable1[start*8 + newFacing2];
 				xpos1 = x;
-				ypos1 = x;
+				ypos1 = y;
 				continue;
 			}
 			break;
 		}
+		newFacing = newFacing2;
 		// debug drawing
 		//if (xpos1 >= 0 && ypos1 >= 0 && xpos1 < 320 && ypos1 < 200) {
 		//	_screen->setPagePixel(0, xpos1,ypos1, unkTable[start]);
@@ -3115,7 +3115,7 @@
 			break;
 		}
 		
-		newFacing = facingTable3[start<<3 + newFacing];
+		newFacing = facingTable3[start*8 + newFacing];
 	}
 	return 0x7D00;
 }
@@ -3193,7 +3193,7 @@
 	if (_pathfinderFlag2) {
 		if (x <= 8 || x >= 312)
 			return true;
-		if (y < _northExitHeight || y > 135)
+		if (y < (_northExitHeight & 0xFF) || y > 135)
 			return true;
 	}
 	
@@ -3204,7 +3204,7 @@
 	int ypos = 8;
 	if (_scaleMode) {
 		int scaling = (_scaleTable[y] >> 5) + 1;
-		if (8 < scaling)
+		if (8 >= scaling)
 			ypos = scaling;
 	}
 	
@@ -3219,12 +3219,11 @@
 		
 	if (xtemp > 319)
 		xtemp = 319;
-		
+
 	for (; xpos < xtemp; ++xpos) {
-		if (!(_screen->getShapeFlag1(xpos, y) & 0xFF))
+		if (!_screen->getShapeFlag1(xpos, y))
 			return false;
 	}
-	
 	return true;
 }
 
@@ -3469,7 +3468,7 @@
 			
 			if (*ptr > _currentCharacter->x1 || _currentCharacter->y1 < *(ptr + 1) || _currentCharacter->x1 > *(ptr + 2) || _currentCharacter->y1 > *(ptr + 3)) {
 				ptr += 10;
-				continue;
+				break;
 			}
 			_brandonPosX = *(ptr + 6);
 			_brandonPosY = *(ptr + 7);
@@ -3504,7 +3503,7 @@
 			animRefreshNPC(0);
 			updateAllObjectShapes();
 			enterNewScene(sceneId, facing, unk1, unk2, 0);
-			resetGameFlag(0xEF);
+			resetGameFlag(0xEE);
 			return 1;
 		}
 	}

Index: script_v1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/script_v1.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- script_v1.cpp	10 Nov 2005 18:58:44 -0000	1.20
+++ script_v1.cpp	10 Nov 2005 21:42:42 -0000	1.21
@@ -361,7 +361,7 @@
 
 int KyraEngine::cmd_blockInWalkableRegion(ScriptState *script) {
 	debug(9, "cmd_blockInWalkableRegion(0x%X)", script);
-	blockOutRegion(stackPos(0), stackPos(1), stackPos(2)-stackPos(0)+1, stackPos(3)-stackPos(1)+1);
+	blockInRegion(stackPos(0), stackPos(1), stackPos(2)-stackPos(0)+1, stackPos(3)-stackPos(1)+1);
 	return 0;
 }
 





More information about the Scummvm-git-logs mailing list