[Scummvm-cvs-logs] CVS: scummvm actor.cpp,1.36,1.37 boxes.cpp,1.17,1.18 script_v1.cpp,1.43,1.44 scumm.h,1.78,1.79

Vincent Hamm yazoo at users.sourceforge.net
Mon Mar 11 05:16:02 CET 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv16385

Modified Files:
	actor.cpp boxes.cpp script_v1.cpp scumm.h 
Log Message:
Fixed more box issues in zak/indy3/loomcd

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/actor.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** actor.cpp	11 Mar 2002 08:34:12 -0000	1.36
--- actor.cpp	11 Mar 2002 13:15:06 -0000	1.37
***************
*** 470,474 ****
  	byte flags, b;
  	
! 	if(_features & GF_OLD256)
  		firstValidBox=0;
  	else
--- 470,474 ----
  	byte flags, b;
  	
! 	if(_features & GF_SMALL_HEADER)
  		firstValidBox=0;
  	else
***************
*** 764,768 ****
  	do {
  		a->moving&=~1;
! 		if ((!a->walkbox && (!(_features & GF_OLD256))) || a->walkbox !=-1 ) {
  			setActorBox(a, a->walkdata.destbox);
  			a->walkdata.curbox = a->walkdata.destbox;
--- 764,768 ----
  	do {
  		a->moving&=~1;
! 		if ((!a->walkbox && (!(_features & GF_SMALL_HEADER))) ) {
  			setActorBox(a, a->walkdata.destbox);
  			a->walkdata.curbox = a->walkdata.destbox;

Index: boxes.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/boxes.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** boxes.cpp	11 Mar 2002 08:34:12 -0000	1.17
--- boxes.cpp	11 Mar 2002 13:15:06 -0000	1.18
***************
*** 60,64 ****
  	BoxCoords box;
  
! 	if (b==0 && (!(_features & GF_OLD256)))
  		return 0;
  
--- 60,64 ----
  	BoxCoords box;
  
! 	if (b==0 && (!(_features & GF_SMALL_HEADER)))
  		return 0;
  
***************
*** 467,470 ****
--- 467,471 ----
  	}
  	warning("findPathTowards: default"); // FIXME: ZAK256
+ 	findPathTowardsOld(a, box1nr, box2nr, box3nr);
  	return 0;
  }
***************
*** 805,807 ****
--- 806,952 ----
  	_boxPathVertexHeapIndex = 0;
  	return (PathVertex*)addToBoxVertexHeap(sizeof(PathVertex));
+ }
+ 
+ int Scumm::findPathTowardsOld(Actor *a, byte box1nr, byte box2nr, byte box3nr) {
+         BoxCoords box1;
+         BoxCoords box2;
+         ScummPoint tmp;
+         int i,j;
+         int flag;
+         int q,pos;
+ 	int threshold=1;
+ 
+         getBoxCoordinates(box1nr,&box1);
+         getBoxCoordinates(box2nr,&box2);
+ 
+ 	do{
+         for(i=0; i<4; i++) {
+                 for(j=0; j<4; j++) {
+                         if (abs(box1.ul.x-box1.ur.x)<threshold &&
+                                         abs(box1.ul.x-box2.ul.x)<threshold &&
+                                         abs(box1.ul.x-box2.ur.x)<threshold ) {
+                                 flag = 0;
+                                 if (box1.ul.y > box1.ur.y) {
+                                         SWAP(box1.ul.y, box1.ur.y);
+                                         flag |= 1;
+                                 }
+ 
+                                 if (box2.ul.y > box2.ur.y) {
+                                         SWAP(box2.ul.y, box2.ur.y);
+                                         flag |= 2;
+                                 }
+ 
+                                 if (box1.ul.y > box2.ur.y || box2.ul.y > box1.ur.y ||
+                                                 (box1.ur.y==box2.ul.y || box2.ur.y==box1.ul.y) &&
+                                                 box1.ul.y!=box1.ur.y && box2.ul.y!=box2.ur.y) {
+                                         if (flag&1)
+                                                 SWAP(box1.ul.y, box1.ur.y);
+                                         if (flag&2)
+                                                 SWAP(box2.ul.y, box2.ur.y);
+                                 } else {
+                                         if (box2nr == box3nr) {
+                                                 int diffX = a->walkdata.destx - a->x;
+                                                 int diffY = a->walkdata.desty - a->y;
+                                                 int boxDiffX = box1.ul.x - a->x;
+ 
+                                                 if (diffX!=0) {
+                                                         int t;
+ 
+                                                         diffY *= boxDiffX;
+                                                         t = diffY / diffX;
+                                                         if (t==0 && (diffY<=0 || diffX<=0) && (diffY>=0 || diffX>=0))
+                                                                 t = -1;
+                                                         pos = a->y + t;
+                                                 } else {
+                                                         pos = a->y;
+                                                 }
+                                         } else {
+                                                 pos = a->y;
+                                         }
+ 
+                                         q = pos;
+                                         if (q < box2.ul.y)
+                                         q = box2.ul.y;
+                                         if (q > box2.ur.y)
+                                                 q = box2.ur.y;
+                                         if (q < box1.ul.y)
+                                                 q = box1.ul.y;
+                                         if (q > box1.ur.y)
+                                                 q = box1.ur.y;
+                                         if (q==pos && box2nr==box3nr)
+                                                 return 1;
+                                         _foundPathY = q;
+                                         _foundPathX = box1.ul.x;
+                                         return 0;
+                                 }
+                         }
+ 
+                         if (abs(box1.ul.y-box1.ur.y)<threshold &&
+                                         abs(box1.ul.y-box2.ul.y)<threshold &&
+                                         abs(box1.ul.y-box2.ur.y)<threshold ){
+                                 flag = 0;
+                                 if (box1.ul.x > box1.ur.x) {
+                                         SWAP(box1.ul.x, box1.ur.x);
+                                         flag |= 1;
+                                 }
+ 
+                                 if (box2.ul.x > box2.ur.x) {
+                                         SWAP(box2.ul.x, box2.ur.x);
+                                         flag |= 2;
+                                 }
+ 
+                                 if (box1.ul.x > box2.ur.x || box2.ul.x > box1.ur.x ||
+                                                 (box1.ur.x==box2.ul.x || box2.ur.x==box1.ul.x) &&
+                                                 box1.ul.x!=box1.ur.x && box2.ul.x!=box2.ur.x) {
+                                         if (flag&1)
+                                                 SWAP(box1.ul.x, box1.ur.x);
+                                         if (flag&2)
+                                                 SWAP(box2.ul.x, box2.ur.x);
+                                 } else {
+ 
+                                         if (box2nr == box3nr) {
+                                                 int diffX = a->walkdata.destx - a->x;
+                                                 int diffY = a->walkdata.desty - a->y;
+                                                 int boxDiffY = box1.ul.y - a->y;
+ 
+                                                 pos = a->x;
+                                                 if (diffY!=0) {
+                                                         pos += diffX * boxDiffY / diffY;
+                                                 }
+                                         } else {
+                                                 pos = a->x;
+                                         }
+ 
+                                         q = pos;
+                                         if (q < box2.ul.x)
+                                                 q = box2.ul.x;
+                                         if (q > box2.ur.x)
+                                                 q = box2.ur.x;
+                                         if (q < box1.ul.x)
+                                                 q = box1.ul.x;
+                                         if (q > box1.ur.x)
+                                                 q = box1.ur.x;
+                                         if (q==pos && box2nr==box3nr)
+                                                 return 1;
+                                         _foundPathX = q;
+                                         _foundPathY = box1.ul.y;
+                                         return 0;
+                                 }
+                         }
+                         tmp = box1.ul;
+                         box1.ul = box1.ur;
+                         box1.ur = box1.ll;
+                         box1.ll = box1.lr;
+                         box1.lr = tmp;
+                 }
+                 tmp = box2.ul;
+                 box2.ul = box2.ur;
+                 box2.ur = box2.ll;
+                 box2.ll = box2.lr;
+                 box2.lr = tmp;
+         }
+ 	threshold++;
+ 	}while(threshold<10);
+         error("findPathTowardsOld: default"); // FIXME: ZAK256
+         return 0;
  }

Index: script_v1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script_v1.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** script_v1.cpp	10 Mar 2002 17:33:02 -0000	1.43
--- script_v1.cpp	11 Mar 2002 13:15:06 -0000	1.44
***************
*** 2359,2363 ****
  	if (whereIsObject(obj)!=WIO_NOT_FOUND) {
  		getObjectXYPos(obj);
! 		startWalkActor(a, _xPos, _yPos, _dir);
  	}
  }
--- 2359,2364 ----
  	if (whereIsObject(obj)!=WIO_NOT_FOUND) {
  		getObjectXYPos(obj);
! 		if(_xPos !=0 && _yPos !=0) // fix while the early objects flags arent correct
! 			startWalkActor(a, _xPos, _yPos, _dir);
  	}
  }

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.78
retrieving revision 1.79
diff -C2 -d -r1.78 -r1.79
*** scumm.h	10 Mar 2002 17:33:02 -0000	1.78
--- scumm.h	11 Mar 2002 13:15:07 -0000	1.79
***************
*** 1705,1709 ****
  	int getPathToDestBox(byte from, byte to);
  	int findPathTowards(Actor *a, byte box, byte box2, byte box3);
! 
  	void drawActorCostume(Actor *a);
  	void actorAnimate(Actor *a);
--- 1705,1710 ----
  	int getPathToDestBox(byte from, byte to);
  	int findPathTowards(Actor *a, byte box, byte box2, byte box3);
! 	int findPathTowardsOld(Actor *a, byte box, byte box2, byte box3);
! 	
  	void drawActorCostume(Actor *a);
  	void actorAnimate(Actor *a);





More information about the Scummvm-git-logs mailing list