[Scummvm-cvs-logs] CVS: scummvm script_v1.cpp,1.126,1.127 script_v2.cpp,1.76,1.77 scumm.h,1.187,1.188 scummvm.cpp,1.183,1.184 actor.cpp,1.95,1.96 actor.h,1.12,1.13

Max Horn fingolfin at users.sourceforge.net
Thu Jul 18 08:46:02 CEST 2002


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

Modified Files:
	script_v1.cpp script_v2.cpp scumm.h scummvm.cpp actor.cpp 
	actor.h 
Log Message:
fix for #583166 (hoagie doesn't enter mansion correctly); moved putActor into class Actor

Index: script_v1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script_v1.cpp,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -d -r1.126 -r1.127
--- script_v1.cpp	16 Jul 2002 22:34:16 -0000	1.126
+++ script_v1.cpp	18 Jul 2002 15:45:10 -0000	1.127
@@ -813,7 +813,7 @@
 			a->forceClip = 0;
 		FixRoom:
 			if (a->isInCurrentRoom())
-				putActor(a, a->x, a->y, a->room);
+				a->putActor(a->x, a->y, a->room);
 			break;
 		case 21:										/* followboxes */
 			a->ignoreBoxes = 0;
@@ -1575,7 +1575,7 @@
 	a = derefActorSafe(_vars[VAR_EGO], "o5_loadRoomWithEgo");
 
 	/* Warning: used previously _xPos, _yPos from a previous update of those */
-	putActor(a, a->x, a->y, room);
+	a->putActor(a->x, a->y, room);
 
 	x = (int16)fetchScriptWord();
 	y = (int16)fetchScriptWord();
@@ -1726,7 +1726,7 @@
 	x = getVarOrDirectWord(0x40);
 	y = getVarOrDirectWord(0x20);
 
-	putActor(a, x, y, a->room);
+	a->putActor(x, y, a->room);
 }
 
 
@@ -1743,7 +1743,7 @@
 		x = 240;
 		y = 120;
 	}
-	putActor(a, x, y, a->room);
+	a->putActor(x, y, a->room);
 }
 
 void Scumm::o5_putActorInRoom()
@@ -1758,7 +1758,7 @@
 	}
 	a->room = room;
 	if (!room)
-		putActor(a, 0, 0, 0);
+		a->putActor(0, 0, 0);
 }
 
 void Scumm::o5_quitPauseRestart()

Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script_v2.cpp,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- script_v2.cpp	16 Jul 2002 21:03:13 -0000	1.76
+++ script_v2.cpp	18 Jul 2002 15:45:10 -0000	1.77
@@ -1393,7 +1393,7 @@
 		if (room != 0)
 			a->room = room;
 	}
-	putActor(a, x, y, room);
+	a->putActor(x, y, room);
 }
 
 
@@ -1413,7 +1413,7 @@
 	}
 	if (room == 0xFF)
 		room = a->room;
-	putActor(a, x, y, room);
+	a->putActor(x, y, room);
 }
 
 void Scumm::o6_faceActor()
@@ -1489,7 +1489,7 @@
 
 	a = derefActorSafe(_vars[VAR_EGO], "o_loadRoomWithEgo");
 
-	putActor(a, 0, 0, room);
+	a->putActor(0, 0, room);
 	_egoPositioned = false;
 
 	_vars[VAR_WALKTO_OBJ] = obj;
@@ -1997,7 +1997,7 @@
 			a->forceClip = 0;
 	FixRooms:;
 		if (a->isInCurrentRoom())
-			putActor(a, a->x, a->y, a->room);
+			a->putActor(a->x, a->y, a->room);
 		break;
 	case 96:
 		a->ignoreBoxes = 0;
@@ -2045,7 +2045,7 @@
 		break;
 	case 230:										/* set direction */
 		a->moving &= ~MF_TURN;
-		a->setActorDirection(pop());
+		a->setDirection(pop());
 		break;
 	case 231:										/* turn to direction */
 		a->turnToDirection(pop());

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.187
retrieving revision 1.188
diff -u -d -r1.187 -r1.188
--- scumm.h	17 Jul 2002 20:55:36 -0000	1.187
+++ scumm.h	18 Jul 2002 15:45:10 -0000	1.188
@@ -779,7 +779,6 @@
 	Actor *derefActor(int id);
 	Actor *derefActorSafe(int id, const char *errmsg);
 	Actor *getFirstActor() { return _actors; } 
-	void putActor(Actor *a, int x, int y, byte room);
 	void showActors();
 
 	uint32 *_classData;

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.183
retrieving revision 1.184
diff -u -d -r1.183 -r1.184
--- scummvm.cpp	16 Jul 2002 21:18:06 -0000	1.183
+++ scummvm.cpp	18 Jul 2002 15:45:10 -0000	1.184
@@ -491,8 +491,8 @@
 						_currentRoom);
 		int x, y, dir;
 		getObjectXYPos(objectNr, x, y, dir);
-		putActor(a, x, y, _currentRoom);
-		a->setActorDirection(dir + 180);
+		a->putActor(x, y, _currentRoom);
+		a->setDirection(dir + 180);
 		a->moving = 0;
 	}
 
@@ -505,7 +505,7 @@
 		if (a && !_egoPositioned) {
 			int x, y;
 			getObjectXYPos(objectNr, x, y);
-			putActor(a, x, y, _currentRoom);
+			a->putActor(x, y, _currentRoom);
 			a->moving = 0;
 		}
 	} else {

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/actor.cpp,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- actor.cpp	16 Jul 2002 21:03:14 -0000	1.95
+++ actor.cpp	18 Jul 2002 15:45:10 -0000	1.96
@@ -271,7 +271,7 @@
 	return dir;
 }
 
-void Actor::setActorBox(int box)
+void Actor::setBox(int box)
 {
 	walkbox = box;
 	mask = _vm->getMaskFromBox(box);
@@ -302,7 +302,7 @@
 	actorY = y;
 
 	if (walkbox != walkdata.curbox && _vm->checkXYInBoxBounds(walkdata.curbox, actorX, actorY)) {
-		setActorBox(walkdata.curbox);
+		setBox(walkdata.curbox);
 	}
 
 	distX = abs(walkdata.newx - walkdata.x);
@@ -478,7 +478,7 @@
 		break;
 	case 3:
 		moving &= ~MF_TURN;
-		setActorDirection(dir);
+		setDirection(dir);
 		break;
 	case 4:
 		turnToDirection(dir);
@@ -488,7 +488,7 @@
 	}
 }
 
-void Actor::setActorDirection(int direction)
+void Actor::setDirection(int direction)
 {
 	uint aMask;
 	int i;
@@ -517,35 +517,35 @@
 	needBgReset = true;
 }
 
-void Scumm::putActor(Actor *a, int dstX, int dstY, byte room)
+void Actor::putActor(int dstX, int dstY, byte newRoom)
 {
-	if (a->visible && _currentRoom != room && _vars[VAR_TALK_ACTOR] == a->number) {
-		clearMsgQueue();
+	if (visible && _vm->_currentRoom != newRoom && _vm->_vars[_vm->VAR_TALK_ACTOR] == number) {
+		_vm->clearMsgQueue();
 	}
 
-	a->x = dstX;
-	a->y = dstY;
-	a->room = room;
-	a->needRedraw = true;
-	a->needBgReset = true;
+	x = dstX;
+	y = dstY;
+	room = newRoom;
+	needRedraw = true;
+	needBgReset = true;
 
-	if (_vars[VAR_EGO] == a->number) {
-		_egoPositioned = true;
+	if (_vm->_vars[_vm->VAR_EGO] == number) {
+		_vm->_egoPositioned = true;
 	}
 
-	if (a->visible) {
-		if (a->isInCurrentRoom()) {
-			if (a->moving) {
-				a->startAnimActor(a->standFrame);
-				a->moving = 0;
+	if (visible) {
+		if (isInCurrentRoom()) {
+			if (moving) {
+				startAnimActor(standFrame);
+				moving = 0;
 			}
-			a->adjustActorPos();
+			adjustActorPos();
 		} else {
-			a->hideActor();
+			hideActor();
 		}
 	} else {
-		if (a->isInCurrentRoom())
-			a->showActor();
+		if (isInCurrentRoom())
+			showActor();
 	}
 }
 
@@ -606,13 +606,15 @@
 						if (i == -1)
 							continue;
 						
-						// FIXME - we check here if the box suggested by getPathToDestBox
-						// is locked or not. This prevents us from walking thru
-						// closed doors in some cases in Zak256. However a better fix
-						// would be to recompute the box matrix whenever flags change.
-						flags = _vm->getBoxFlags(i);
-						if (flags & 0x80 && (!(flags & 0x20) || isInClass(0x1F)))
-							continue;
+						if (_vm->_features & GF_OLD256) {
+							// FIXME - we check here if the box suggested by getPathToDestBox
+							// is locked or not. This prevents us from walking thru
+							// closed doors in some cases in Zak256. However a better fix
+							// would be to recompute the box matrix whenever flags change.
+							flags = _vm->getBoxFlags(i);
+							if (flags & 0x80 && (!(flags & 0x20) || isInClass(0x1F)))
+								continue;
+						}
 					}
 
 					if (!_vm->inBoxQuickReject(j, dstX, dstY, threshold))
@@ -663,7 +665,7 @@
 	y = abr.y;
 	walkdata.destbox = (byte)abr.dist;
 
-	setActorBox(abr.dist);
+	setBox(abr.dist);
 
 	walkdata.destx = -1;
 
@@ -1077,7 +1079,7 @@
 		x = abr.x;
 		y = abr.y;
 		if (dir != -1)
-			setActorDirection(dir);
+			setDirection(dir);
 		return;
 	}
 
@@ -1130,11 +1132,11 @@
 	} else*/  {
 		switch (cmd) {
 		case 1:										/* start walk */
-			setActorDirection(angle);
+			setDirection(angle);
 			startAnimActor(walkFrame);
 			break;
 		case 2:										/* change dir only */
-			setActorDirection(angle);
+			setDirection(angle);
 			break;
 		case 3:										/* stop walk */
 			turnToDirection(angle);
@@ -1157,7 +1159,7 @@
 
 		if (moving & MF_LAST_LEG) {
 			moving = 0;
-			setActorBox(walkdata.destbox);
+			setBox(walkdata.destbox);
 			startWalkAnim(3, walkdata.destdir);
 			return;
 		}
@@ -1165,20 +1167,20 @@
 		if (moving & MF_TURN) {
 			j = updateActorDirection();
 			if (facing != j)
-				setActorDirection(j);
+				setDirection(j);
 			else
 				moving = 0;
 			return;
 		}
 
-		setActorBox(walkdata.curbox);
+		setBox(walkdata.curbox);
 		moving &= MF_IN_LEG;
 	}
 
 	do {
 		moving &= ~MF_NEW_LEG;
 		if ((!walkbox && (!(_vm->_features & GF_SMALL_HEADER)))) {
-			setActorBox(walkdata.destbox);
+			setBox(walkdata.destbox);
 			walkdata.curbox = walkdata.destbox;
 			break;
 		}
@@ -1197,7 +1199,7 @@
 		if (calcMovementFactor(_vm->_foundPathX, _vm->_foundPathY))
 			return;
 
-		setActorBox(walkdata.curbox);
+		setBox(walkdata.curbox);
 	} while (1);
 
 	moving |= MF_LAST_LEG;
@@ -1277,7 +1279,7 @@
 	if (moving & MF_TURN) {
 		new_dir = updateActorDirection();
 		if (facing != new_dir) {
-			setActorDirection(new_dir);
+			setDirection(new_dir);
 			return;
 		}
 		moving = 0;

Index: actor.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/actor.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- actor.h	16 Jul 2002 18:51:26 -0000	1.12
+++ actor.h	18 Jul 2002 15:45:10 -0000	1.13
@@ -119,22 +119,30 @@
 	void showActor();
 
 	void initActor(int mode);
+	void putActor(int x, int y, byte room);
 	void setActorWalkSpeed(uint newSpeedX, uint newSpeedY);
+protected:
 	int calcMovementFactor(int newx, int newy);
 	int actorWalkStep();
 	int remapDirection(int dir);
 	void setupActorScale();
+public:
 	void stopActorMoving();
 	void startWalkAnim(int cmd, int angle);
 	void startAnimActor(int frame);
-	void setActorBox(int box);
 
+protected:
+	void setBox(int box);
 	int updateActorDirection();
-	void setActorDirection(int direction);
+
+public:
+	void setDirection(int direction);
 	int getActorXYPos(int &x, int &y);
 
 	AdjustBoxResult adjustXYToBeInBox(int dstX, int dstY, int pathfrom);
+protected:
 	void adjustActorPos();
+public:
 	void turnToDirection(int newdir);
 	void walkActor();
 	void drawActorCostume();





More information about the Scummvm-git-logs mailing list