[Scummvm-cvs-logs] CVS: scummvm actor.cpp,1.93,1.94 actor.h,1.11,1.12 script.cpp,1.64,1.65 script_v1.cpp,1.124,1.125 script_v2.cpp,1.74,1.75 scummvm.cpp,1.180,1.181 scumm.h,1.184,1.185 object.cpp,1.78,1.79
Max Horn
fingolfin at users.sourceforge.net
Tue Jul 16 11:52:03 CEST 2002
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv32702
Modified Files:
actor.cpp actor.h script.cpp script_v1.cpp script_v2.cpp
scummvm.cpp scumm.h object.cpp
Log Message:
got rid of _xPos, _yPos, _dir members in class Scumm
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/actor.cpp,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- actor.cpp 16 Jul 2002 17:59:27 -0000 1.93
+++ actor.cpp 16 Jul 2002 18:51:26 -0000 1.94
@@ -548,15 +548,13 @@
}
}
-int Scumm::getActorXYPos(Actor *a)
+int Actor::getActorXYPos(int &xPos, int &yPos)
{
- if (!a)
+ if (!isInCurrentRoom())
return -1;
- if (!a->isInCurrentRoom())
- return -1;
- _xPos = a->x;
- _yPos = a->y;
+ xPos = x;
+ yPos = y;
return 0;
}
Index: actor.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/actor.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- actor.h 15 Jul 2002 22:56:24 -0000 1.11
+++ actor.h 16 Jul 2002 18:51:26 -0000 1.12
@@ -131,6 +131,7 @@
int updateActorDirection();
void setActorDirection(int direction);
+ int getActorXYPos(int &x, int &y);
AdjustBoxResult adjustXYToBeInBox(int dstX, int dstY, int pathfrom);
void adjustActorPos();
Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- script.cpp 7 Jul 2002 20:21:41 -0000 1.64
+++ script.cpp 16 Jul 2002 18:51:27 -0000 1.65
@@ -855,17 +855,15 @@
void Scumm::faceActorToObj(int act, int obj)
{
- int x, dir;
+ int x, x2, y, dir;
- if (getObjectOrActorXY(act) == -1)
+ if (getObjectOrActorXY(act, x, y) == -1)
return;
- x = _xPos;
-
- if (getObjectOrActorXY(obj) == -1)
+ if (getObjectOrActorXY(obj, x2, y) == -1)
return;
- dir = (_xPos > x) ? 90 : 270;
+ dir = (x2 > x) ? 90 : 270;
derefActorSafe(act, "faceActorToObj")->turnToDirection(dir);
}
Index: script_v1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script_v1.cpp,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -d -r1.124 -r1.125
--- script_v1.cpp 16 Jul 2002 14:54:49 -0000 1.124
+++ script_v1.cpp 16 Jul 2002 18:51:27 -0000 1.125
@@ -1732,18 +1732,18 @@
void Scumm::o5_putActorAtObject()
{
- int obj;
+ int obj, x, y;
Actor *a;
a = derefActorSafe(getVarOrDirectByte(0x80), "o5_putActorAtObject");
obj = getVarOrDirectWord(0x40);
if (whereIsObject(obj) != WIO_NOT_FOUND)
- getObjectXYPos(obj);
+ getObjectXYPos(obj, x, y);
else {
- _xPos = 240;
- _yPos = 120;
+ x = 240;
+ y = 120;
}
- putActor(a, _xPos, _yPos, a->room);
+ putActor(a, x, y, a->room);
}
void Scumm::o5_putActorInRoom()
@@ -2611,8 +2611,9 @@
a = derefActorSafe(getVarOrDirectByte(0x80), "o5_walkActorToObject");
obj = getVarOrDirectWord(0x40);
if (whereIsObject(obj) != WIO_NOT_FOUND) {
- getObjectXYPos(obj);
- a->startWalkActor(_xPos, _yPos, _dir);
+ int x, y, dir;
+ getObjectXYPos(obj, x, y, dir);
+ a->startWalkActor(x, y, dir);
}
}
Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script_v2.cpp,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -d -r1.74 -r1.75
--- script_v2.cpp 15 Jul 2002 01:38:51 -0000 1.74
+++ script_v2.cpp 16 Jul 2002 18:51:27 -0000 1.75
@@ -1341,8 +1341,9 @@
if (obj >= NUM_ACTORS) {
if (whereIsObject(obj) == WIO_NOT_FOUND)
return;
- getObjectXYPos(obj);
- a->startWalkActor(_xPos, _yPos, _dir);
+ int x, y, dir;
+ getObjectXYPos(obj, x, y, dir);
+ a->startWalkActor(x, y, dir);
} else {
a2 = derefActorSafe(obj, "o6_walkActorToObj(2)");
if (!a2)
@@ -1397,16 +1398,14 @@
void Scumm::o6_putActorAtObject()
{
- int room, obj, x, y;
+ int room, obj, x, y, dir;
Actor *a;
obj = popRoomAndObj(&room);
a = derefActorSafe(pop(), "o6_putActorAtObject");
if (whereIsObject(obj) != WIO_NOT_FOUND) {
- getObjectXYPos(obj);
- x = _xPos;
- y = _yPos;
+ getObjectXYPos(obj, x, y);
} else {
x = 160;
y = 120;
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.180
retrieving revision 1.181
diff -u -d -r1.180 -r1.181
--- scummvm.cpp 16 Jul 2002 15:48:59 -0000 1.180
+++ scummvm.cpp 16 Jul 2002 18:51:27 -0000 1.181
@@ -489,9 +489,10 @@
if (where != WIO_ROOM && where != WIO_FLOBJECT)
error("startScene: Object %d is not in room %d", objectNr,
_currentRoom);
- getObjectXYPos(objectNr);
- putActor(a, _xPos, _yPos, _currentRoom);
- a->setActorDirection(_dir + 180);
+ int x, y, dir;
+ getObjectXYPos(objectNr, x, y, dir);
+ putActor(a, x, y, _currentRoom);
+ a->setActorDirection(dir + 180);
a->moving = 0;
}
@@ -502,8 +503,9 @@
if (!(_features & GF_AFTER_V7)) {
if (a && !_egoPositioned) {
- getObjectXYPos(objectNr);
- putActor(a, _xPos, _yPos, _currentRoom);
+ int x, y;
+ getObjectXYPos(objectNr, x, y);
+ putActor(a, x, y, _currentRoom);
a->moving = 0;
}
} else {
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.184
retrieving revision 1.185
diff -u -d -r1.184 -r1.185
--- scumm.h 16 Jul 2002 17:59:28 -0000 1.184
+++ scumm.h 16 Jul 2002 18:51:27 -0000 1.185
@@ -565,7 +565,6 @@
VirtScreen *_curVirtScreen;
bool _egoPositioned;
- int _xPos, _yPos, _dir;
int _keyPressed;
uint16 _lastKeyHit;
uint16 _mouseButStat;
@@ -788,14 +787,15 @@
int getObjectRoom(int obj);
int getObjX(int obj);
int getObjY(int obj);
- void getObjectXYPos(int object);
+ void getObjectXYPos(int object, int &x, int &y) { int dir; getObjectXYPos(object, x, y, dir); }
+ void getObjectXYPos(int object, int &x, int &y, int &dir);
int getObjOldDir(int obj);
int getObjNewDir(int obj);
int getObjectIndex(int object);
int whereIsObject(int object);
int findObject(int x, int y);
void findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint object, uint room);
- int getObjectOrActorXY(int object); // Object and Actor...
+ int getObjectOrActorXY(int object, int &x, int &y); // Object and Actor...
int getObjActToObjActDist(int a, int b); // Not sure how to handle
byte *getObjOrActorName(int obj); // these three..
@@ -935,7 +935,6 @@
void startAnimActorEx(Actor *a, int frame, int direction);
int getProgrDirChange(Actor *a, int mode);
- int getActorXYPos(Actor *a);
void walkActors();
void playActorSounds();
void setActorRedrawFlags();
Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/object.cpp,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- object.cpp 16 Jul 2002 14:09:54 -0000 1.78
+++ object.cpp 16 Jul 2002 18:51:27 -0000 1.79
@@ -135,34 +135,33 @@
return WIO_NOT_FOUND;
}
-int Scumm::getObjectOrActorXY(int object)
+int Scumm::getObjectOrActorXY(int object, int &x, int &y)
{
if (object < NUM_ACTORS)
- return getActorXYPos(derefActorSafe(object, "getObjectOrActorXY"));
+ return derefActorSafe(object, "getObjectOrActorXY")->getActorXYPos(x, y);
switch (whereIsObject(object)) {
case WIO_NOT_FOUND:
return -1;
case WIO_INVENTORY:
if (_objectOwnerTable[object] < NUM_ACTORS)
- return getActorXYPos(derefActorSafe(_objectOwnerTable[object], "getObjectOrActorXY(2)"));
+ return derefActorSafe(_objectOwnerTable[object], "getObjectOrActorXY(2)")->getActorXYPos(x, y);
else
return 0xFF;
}
- getObjectXYPos(object);
+ getObjectXYPos(object, x, y);
return 0;
}
/* Return the position of an object.
Returns X, Y and direction in angles
*/
-void Scumm::getObjectXYPos(int object)
+void Scumm::getObjectXYPos(int object, int &x, int &y, int &dir)
{
ObjectData *od = &_objs[getObjectIndex(object)];
int state;
byte *ptr;
ImageHeader *imhd;
- int x, y;
if (!(_features & GF_SMALL_HEADER)) {
if (_features & GF_AFTER_V6) {
@@ -190,22 +189,17 @@
x = od->walk_x;
y = od->walk_y;
}
- _xPos = x;
- _yPos = y;
- _dir = oldDirToNewDir(od->actordir & 3);
+ dir = oldDirToNewDir(od->actordir & 3);
} else {
x = od->walk_x;
y = od->walk_y;
- _xPos = x;
- _yPos = y;
- _dir = oldDirToNewDir(od->actordir & 3);
-
+ dir = oldDirToNewDir(od->actordir & 3);
}
}
int Scumm::getObjActToObjActDist(int a, int b)
{
- int x, y;
+ int x, y, x2, y2;
Actor *acta = NULL;
Actor *actb = NULL;
@@ -218,23 +212,20 @@
if (acta && actb && acta->getRoom() == actb->getRoom() && acta->getRoom() && !acta->isInCurrentRoom())
return 0;
- if (getObjectOrActorXY(a) == -1)
+ if (getObjectOrActorXY(a, x, y) == -1)
return 0xFF;
- x = _xPos;
- y = _yPos;
-
- if (getObjectOrActorXY(b) == -1)
+ if (getObjectOrActorXY(b, x2, y2) == -1)
return 0xFF;
if (acta) {
- AdjustBoxResult r = acta->adjustXYToBeInBox(_xPos, _yPos, -1);
- _xPos = r.x;
- _yPos = r.y;
+ AdjustBoxResult r = acta->adjustXYToBeInBox(x2, y2, -1);
+ x2 = r.x;
+ y2 = r.y;
}
- y = abs(y - _yPos);
- x = abs(x - _xPos);
+ y = abs(y - y2);
+ x = abs(x - x2);
if (y > x)
x = y;
@@ -965,8 +956,9 @@
} else {
if (whereIsObject(obj) == WIO_NOT_FOUND)
return -1;
- getObjectOrActorXY(obj);
- return _xPos;
+ int x, y;
+ getObjectOrActorXY(obj, x, y);
+ return x;
}
}
@@ -979,8 +971,9 @@
} else {
if (whereIsObject(obj) == WIO_NOT_FOUND)
return -1;
- getObjectOrActorXY(obj);
- return _yPos;
+ int x, y;
+ getObjectOrActorXY(obj, x, y);
+ return y;
}
}
@@ -989,8 +982,9 @@
if (obj < NUM_ACTORS) {
return newDirToOldDir(derefActorSafe(obj, "getObjOldDir")->facing);
} else {
- getObjectXYPos(obj);
- return _dir;
+ int x, y, dir;
+ getObjectXYPos(obj, x, y, dir);
+ return dir;
}
}
@@ -999,8 +993,9 @@
if (obj < NUM_ACTORS) {
return derefActorSafe(obj, "getObjNewDir")->facing;
} else {
- getObjectXYPos(obj);
- return oldDirToNewDir(_dir);
+ int x, y, dir;
+ getObjectXYPos(obj, x, y, dir);
+ return oldDirToNewDir(dir);
}
}
@@ -1064,24 +1059,20 @@
j = i = 0xFF;
if (is_obj_1) {
- if (getObjectOrActorXY(b) == -1)
+ if (getObjectOrActorXY(b, x, y) == -1)
return -1;
if (b < NUM_ACTORS)
i = derefActorSafe(b, "unkObjProc1")->scalex;
- x = _xPos;
- y = _yPos;
} else {
x = b;
y = c;
}
if (is_obj_2) {
- if (getObjectOrActorXY(e) == -1)
+ if (getObjectOrActorXY(e, x2, y2) == -1)
return -1;
if (e < NUM_ACTORS)
j = derefActorSafe(e, "unkObjProc1(2)")->scalex;
- x2 = _xPos;
- y2 = _yPos;
} else {
x2 = e;
y2 = f;
More information about the Scummvm-git-logs
mailing list