[Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.70,1.71 actor.h,1.35,1.36 scene.cpp,1.71,1.72

Andrew Kurushin h00ligan at users.sourceforge.net
Tue Jan 4 10:55:23 CET 2005


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

Modified Files:
	actor.cpp actor.h scene.cpp 
Log Message:
- some walking addition

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- actor.cpp	4 Jan 2005 16:10:42 -0000	1.70
+++ actor.cpp	4 Jan 2005 18:54:25 -0000	1.71
@@ -151,7 +151,7 @@
 	_pathRect.left = 0;
 	_pathRect.right = _vm->getDisplayWidth();
 	_pathRect.top = _vm->getPathYOffset();
-	_pathRect.bottom = _vm->getStatusYOffset() - _vm->getPathYOffset();
+	_pathRect.bottom = _vm->getStatusYOffset();
 
 	// Get actor resource file context
 	_actorContext = _vm->getFileContext(GAME_RESOURCEFILE, 0);
@@ -1191,6 +1191,10 @@
 				actor->walkStepIndex = 2;
 			}
 
+			if (actor->walkStepsCount == 0) {
+				actor->walkStepsCount = 2;
+			}
+
 			if (extraEndNode) {
 				actor->walkPath[actor->walkStepsCount - 2] = pointTo.x / (ACTOR_LMULT * 2);
 				actor->walkPath[actor->walkStepsCount - 1] = pointTo.y / ACTOR_LMULT;
@@ -1345,14 +1349,15 @@
 		intersect.top = MAX(_pathRect.top, _barrierList[i].top);
 		intersect.right = MIN(_pathRect.right, _barrierList[i].right);
 		intersect.bottom = MIN(_pathRect.bottom, _barrierList[i].bottom);
-
+		
+		int16 w = intersect.width() >> 1;
 		intersect.left >>= 1;
 		intersect.top -= _vm->getPathYOffset();
-		intersect.right >>= 1;
+		intersect.right = intersect.left + w;
 		intersect.bottom -= _vm->getPathYOffset();
 
 		for (iteratorPoint.y = intersect.top; iteratorPoint.y < intersect.bottom; iteratorPoint.y++) {
-			for (iteratorPoint.x = 0; iteratorPoint.x < _xCellCount; iteratorPoint.x++) {
+			for (iteratorPoint.x = intersect.left; iteratorPoint.x < intersect.right; iteratorPoint.x++) {
 				setPathCell(iteratorPoint, kPathCellBarrier);
 			}
 		}
@@ -1428,8 +1433,11 @@
 
 		iteratorPoint.x = point.x >> 1;
 		iteratorPoint.y = point.y - _vm->getPathYOffset();
-		if (getPathCell(iteratorPoint) == kPathCellBarrier)
-			return false;	
+		if (validPathCellPoint(iteratorPoint)) {
+			if (getPathCell(iteratorPoint) == kPathCellBarrier) {
+				return false;
+			}
+		}
 	}
 	return true;
 }
@@ -1467,7 +1475,9 @@
 		pathDirection->y = pathFromPoint.y;
 		pathDirection->direction = startDirection;
 	}
-	setPathCell(pathFromPoint, 0);
+	if (validPathCellPoint(pathFromPoint)) {
+		setPathCell(pathFromPoint, 0);
+	}
 	
 	pathDirectionIterator = pathDirectionList.begin();
 

Index: actor.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- actor.h	4 Jan 2005 16:10:43 -0000	1.35
+++ actor.h	4 Jan 2005 18:54:28 -0000	1.36
@@ -157,7 +157,7 @@
 	}
 	void delta(const ActorLocation &location, ActorLocation &result) {
 		result.x = x - location.x;
-		result.y = x - location.y;
+		result.y = y - location.y;
 		result.z = z - location.z;
 	}
 	void add(const ActorLocation &location) {
@@ -298,10 +298,20 @@
 	void findActorPath(ActorData *actor, const Point &fromPoint, const Point &toPoint);
 	void handleSpeech(int msec);
 	void handleActions(int msec, bool setup);
-	void setPathCell(const Point &testPoint, int value) {
+	bool validPathCellPoint(const Point &testPoint) {
+		return !((testPoint.x < 0) || (testPoint.x >= _xCellCount) ||
+			(testPoint.y < 0) || (testPoint.y >= _yCellCount));
+	}
+	void setPathCell(const Point &testPoint, int value) {		
+		if (!validPathCellPoint(testPoint)) {
+			error("Actor::setPathCell wrong point");
+		}
 		_pathCell[testPoint.x + testPoint.y * _xCellCount] = value;
 	}
 	int getPathCell(const Point &testPoint) {
+		if (!validPathCellPoint(testPoint)) {
+			error("Actor::getPathCell wrong point");
+		}
 		return _pathCell[testPoint.x + testPoint.y * _xCellCount];
 	}
 	bool scanPathLine(const Point &point1, const Point &point2);

Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.cpp,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- scene.cpp	4 Jan 2005 17:15:53 -0000	1.71
+++ scene.cpp	4 Jan 2005 18:54:29 -0000	1.72
@@ -502,7 +502,7 @@
 }
 
 void Scene::initDoorsState() {
-	memcpy(_sceneDoors, initSceneDoors, SCENE_DOORS_MAX);
+	memcpy(_sceneDoors, initSceneDoors, sizeof (_sceneDoors) );
 }
 
 int Scene::getInfo(SCENE_INFO *si) {





More information about the Scummvm-git-logs mailing list