diff options
author | Max Horn | 2006-11-19 00:39:48 +0000 |
---|---|---|
committer | Max Horn | 2006-11-19 00:39:48 +0000 |
commit | c210aff40cd832a1216f22a123b962856f7a9898 (patch) | |
tree | 19a2253b09d28e9f9dcae1b29ceb596a6c6860f3 /engines/scumm/object.cpp | |
parent | 378982899382e139a12ff4bc1a8e29c74abafca9 (diff) | |
download | scummvm-rg350-c210aff40cd832a1216f22a123b962856f7a9898.tar.gz scummvm-rg350-c210aff40cd832a1216f22a123b962856f7a9898.tar.bz2 scummvm-rg350-c210aff40cd832a1216f22a123b962856f7a9898.zip |
* Made Actor::_pos protected, added public Actor::getPos() method
* Added default params to Actor::putActor()
* Removed Actor::getActorXYPos
svn-id: r24742
Diffstat (limited to 'engines/scumm/object.cpp')
-rw-r--r-- | engines/scumm/object.cpp | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp index e67d7d25fe..e3afdec0de 100644 --- a/engines/scumm/object.cpp +++ b/engines/scumm/object.cpp @@ -335,11 +335,15 @@ int ScummEngine::whereIsObject(int object) const { } int ScummEngine::getObjectOrActorXY(int object, int &x, int &y) { + Actor *act; + if (object < _numActors) { - Actor *act = derefActorSafe(object, "getObjectOrActorXY"); - if (act) - return act->getActorXYPos(x, y); - else + act = derefActorSafe(object, "getObjectOrActorXY"); + if (act && act->isInCurrentRoom()) { + x = act->getPos().x; + y = act->getPos().y; + return 0; + } else return -1; } @@ -347,10 +351,15 @@ int ScummEngine::getObjectOrActorXY(int object, int &x, int &y) { case WIO_NOT_FOUND: return -1; case WIO_INVENTORY: - if (_objectOwnerTable[object] < _numActors) - return derefActor(_objectOwnerTable[object], "getObjectOrActorXY(2)")->getActorXYPos(x, y); - else - return -1; + if (_objectOwnerTable[object] < _numActors) { + act = derefActor(_objectOwnerTable[object], "getObjectOrActorXY(2)"); + if (act && act->isInCurrentRoom()) { + x = act->getPos().x; + y = act->getPos().y; + return 0; + } + } + return -1; } getObjectXYPos(object, x, y); return 0; @@ -1440,7 +1449,7 @@ int ScummEngine::getObjX(int obj) { if (obj < _numActors) { if (obj < 1) return 0; /* fix for indy4's map */ - return derefActor(obj, "getObjX")->_pos.x; + return derefActor(obj, "getObjX")->getPos().x; } else { if (whereIsObject(obj) == WIO_NOT_FOUND) return -1; @@ -1454,7 +1463,7 @@ int ScummEngine::getObjY(int obj) { if (obj < _numActors) { if (obj < 1) return 0; /* fix for indy4's map */ - return derefActor(obj, "getObjY")->_pos.y; + return derefActor(obj, "getObjY")->getPos().y; } else { if (whereIsObject(obj) == WIO_NOT_FOUND) return -1; |