From c210aff40cd832a1216f22a123b962856f7a9898 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 19 Nov 2006 00:39:48 +0000 Subject: * Made Actor::_pos protected, added public Actor::getPos() method * Added default params to Actor::putActor() * Removed Actor::getActorXYPos svn-id: r24742 --- engines/scumm/actor.cpp | 36 +++++++++++++++----------------- engines/scumm/actor.h | 42 ++++++++++++++++++++++---------------- engines/scumm/camera.cpp | 32 ++++++++++++++--------------- engines/scumm/debugger.cpp | 10 ++++----- engines/scumm/gfx.cpp | 4 ++-- engines/scumm/he/script_v100he.cpp | 8 ++++---- engines/scumm/he/script_v60he.cpp | 6 +++--- engines/scumm/he/script_v72he.cpp | 8 ++++---- engines/scumm/object.cpp | 29 +++++++++++++++++--------- engines/scumm/room.cpp | 6 +++--- engines/scumm/script_c64.cpp | 6 +++--- engines/scumm/script_v2.cpp | 8 ++++---- engines/scumm/script_v5.cpp | 20 +++++++++--------- engines/scumm/script_v6.cpp | 14 ++++++------- engines/scumm/script_v8.cpp | 4 ++-- engines/scumm/string.cpp | 4 ++-- 16 files changed, 125 insertions(+), 112 deletions(-) diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 681065b956..2f38b421c4 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -873,11 +873,18 @@ void ScummEngine::putActors() { for (i = 1; i < _numActors; i++) { a = &_actors[i]; if (a && a->isInCurrentRoom()) - a->putActor(a->_pos.x, a->_pos.y, a->_room); + a->putActor(); } } -void Actor::putActor(int dstX, int dstY, byte newRoom) { +void Actor::putActor(int dstX, int dstY, int newRoom) { + if (dstX == -1) + dstX = _pos.x; + if (dstY == -1) + dstY = _pos.y; + if (newRoom == -1) + newRoom = _room; + if (_visible && _vm->_currentRoom != newRoom && _vm->getTalkingActor() == _number) { _vm->stopTalk(); } @@ -917,15 +924,6 @@ void Actor::putActor(int dstX, int dstY, byte newRoom) { } } -int Actor::getActorXYPos(int &xPos, int &yPos) const { - if (!isInCurrentRoom()) - return -1; - - xPos = _pos.x; - yPos = _pos.y; - return 0; -} - static bool inBoxQuickReject(const BoxCoords &box, int x, int y, int threshold) { int t; @@ -1080,7 +1078,7 @@ int ScummEngine_v70he::getActorFromPos(int x, int y) { for (i = 1; i < _numActors; i++) { if (testGfxUsageBit(x / 8, i) && !getClass(i, kObjectClassUntouchable) && y >= _actors[i]._top && y <= _actors[i]._bottom - && (_actors[i]._pos.y > _actors[curActor]._pos.y || curActor == 0)) + && (_actors[i].getPos().y > _actors[curActor].getPos().y || curActor == 0)) curActor = i; } @@ -1230,8 +1228,8 @@ void ScummEngine::processActors() { if (_game.id == GID_SAMNMAX) { for (int j = 0; j < numactors; ++j) { for (int i = 0; i < numactors; ++i) { - int sc_actor1 = _sortedActors[j]->_pos.y; - int sc_actor2 = _sortedActors[i]->_pos.y; + int sc_actor1 = _sortedActors[j]->getPos().y; + int sc_actor2 = _sortedActors[i]->getPos().y; if (sc_actor1 == sc_actor2) { sc_actor1 += _sortedActors[j]->_number; sc_actor2 += _sortedActors[i]->_number; @@ -1244,8 +1242,8 @@ void ScummEngine::processActors() { } else { for (int j = 0; j < numactors; ++j) { for (int i = 0; i < numactors; ++i) { - int sc_actor1 = _sortedActors[j]->_pos.y - _sortedActors[j]->_layer * 2000; - int sc_actor2 = _sortedActors[i]->_pos.y - _sortedActors[i]->_layer * 2000; + int sc_actor1 = _sortedActors[j]->getPos().y - _sortedActors[j]->_layer * 2000; + int sc_actor2 = _sortedActors[i]->getPos().y - _sortedActors[i]->_layer * 2000; if (sc_actor1 < sc_actor2) { SWAP(_sortedActors[i], _sortedActors[j]); } @@ -1712,7 +1710,7 @@ void ScummEngine::setTalkingActor(int value) { _system->clearFocusRectangle(); } else { // Work out the screen co-ordinates of the actor - int x = _actors[value]._pos.x - (camera._cur.x - (_screenWidth >> 1)); + int x = _actors[value].getPos().x - (camera._cur.x - (_screenWidth >> 1)); int y = _actors[value]._top - (camera._cur.y - (_screenHeight >> 1)); // Set the focus area to the calculated position @@ -2170,8 +2168,8 @@ void ScummEngine_v71he::postProcessAuxQueue() { if (ae->actorNum != -1) { Actor *a = derefActor(ae->actorNum, "postProcessAuxQueue"); const uint8 *cost = getResourceAddress(rtCostume, a->_costume); - int dy = a->_offsY + a->_pos.y - a->getElevation(); - int dx = a->_offsX + a->_pos.x; + int dy = a->_offsY + a->getPos().y - a->getElevation(); + int dx = a->_offsX + a->getPos().x; const uint8 *akax = findResource(MKID_BE('AKAX'), cost); assert(akax); diff --git a/engines/scumm/actor.h b/engines/scumm/actor.h index dd3cd78505..79528e34f8 100644 --- a/engines/scumm/actor.h +++ b/engines/scumm/actor.h @@ -46,21 +46,6 @@ enum MoveFlags { MF_FROZEN = 0x80 }; -struct ActorWalkData { - Common::Point dest; // Final destination point - byte destbox; // Final destination box - int16 destdir; // Final destination, direction to face at - - Common::Point cur; // Last position - byte curbox; // Last box - - Common::Point next; // Next position on our way to the destination, i.e. our intermediate destination - - Common::Point point3; - int32 deltaXFactor, deltaYFactor; - uint16 xfrac, yfrac; -}; - struct CostumeData { byte active[16]; uint16 animCounter; @@ -96,10 +81,11 @@ public: static void initActorClass(ScummEngine *scumm); -public: +protected: /** The position of the actor inside the virtual screen. */ Common::Point _pos; +public: /** HE specific: This rect is used to clip actor drawing. */ Common::Rect _clipOverride; @@ -109,6 +95,8 @@ public: byte _number; uint16 _costume; byte _room; + +public: byte _talkColor; int _talkFrequency; byte _talkPan; @@ -161,6 +149,22 @@ public: } _heTalkQueue[16]; protected: + struct ActorWalkData { + Common::Point dest; // Final destination point + byte destbox; // Final destination box + int16 destdir; // Final destination, direction to face at + + Common::Point cur; // Last position + byte curbox; // Last box + + Common::Point next; // Next position on our way to the destination, i.e. our intermediate destination + + Common::Point point3; + int32 deltaXFactor, deltaYFactor; + uint16 xfrac, yfrac; + }; + + byte _palette[256]; int _elevation; uint16 _facing; @@ -182,7 +186,7 @@ public: void showActor(); void initActor(int mode); - void putActor(int x, int y, byte room); + void putActor(int x = -1, int y = -1, int room = -1); void setActorWalkSpeed(uint newSpeedX, uint newSpeedY); protected: int calcMovementFactor(const Common::Point& next); @@ -229,7 +233,9 @@ public: return _room == _vm->_currentRoom; } - int getActorXYPos(int &x, int &y) const; + const Common::Point &getPos() const { + return _pos; + } int getRoom() const { return _room; diff --git a/engines/scumm/camera.cpp b/engines/scumm/camera.cpp index 219cf40980..e3f0396ea6 100644 --- a/engines/scumm/camera.cpp +++ b/engines/scumm/camera.cpp @@ -69,14 +69,14 @@ void ScummEngine::setCameraFollows(Actor *a, bool setCamera) { if (!a->isInCurrentRoom()) { startScene(a->getRoom(), 0, 0); camera._mode = kFollowActorCameraMode; - camera._cur.x = a->_pos.x; + camera._cur.x = a->getPos().x; setCameraAt(camera._cur.x, 0); } - t = a->_pos.x / 8 - _screenStartStrip; + t = a->getPos().x / 8 - _screenStartStrip; if (t < camera._leftTrigger || t > camera._rightTrigger || setCamera == true) - setCameraAt(a->_pos.x, 0); + setCameraAt(a->getPos().x, 0); for (i = 1; i < _numActors; i++) { if (_actors[i].isInCurrentRoom()) @@ -101,7 +101,7 @@ void ScummEngine::clampCameraPos(Common::Point *pt) { void ScummEngine::moveCamera() { int pos = camera._cur.x; - int actorx, t; + int t; Actor *a = NULL; camera._cur.x &= 0xFFF8; @@ -127,7 +127,7 @@ void ScummEngine::moveCamera() { if (camera._mode == kFollowActorCameraMode) { a = derefActor(camera._follows, "moveCamera"); - actorx = a->_pos.x; + int actorx = a->getPos().x; t = actorx / 8 - _screenStartStrip; if (t < camera._leftTrigger || t > camera._rightTrigger) { @@ -143,7 +143,7 @@ void ScummEngine::moveCamera() { if (camera._movingToActor) { a = derefActor(camera._follows, "moveCamera(2)"); - camera._dest.x = a->_pos.x; + camera._dest.x = a->getPos().x; } if (VAR_CAMERA_MIN_X != 0xFF && camera._dest.x < VAR(VAR_CAMERA_MIN_X)) @@ -162,7 +162,7 @@ void ScummEngine::moveCamera() { } /* a is set a bit above */ - if (camera._movingToActor && (camera._cur.x / 8) == (a->_pos.x / 8)) { + if (camera._movingToActor && (camera._cur.x / 8) == (a->getPos().x / 8)) { camera._movingToActor = false; } @@ -262,11 +262,11 @@ void ScummEngine_v7::setCameraFollows(Actor *a, bool setCamera) { startScene(a->getRoom(), 0, 0); } - ax = ABS(a->_pos.x - camera._cur.x); - ay = ABS(a->_pos.y - camera._cur.y); + ax = ABS(a->getPos().x - camera._cur.x); + ay = ABS(a->getPos().y - camera._cur.y); if (ax > VAR(VAR_CAMERA_THRESHOLD_X) || ay > VAR(VAR_CAMERA_THRESHOLD_Y) || ax > (_screenWidth / 2) || ay > (_screenHeight / 2)) { - setCameraAt(a->_pos.x, a->_pos.y); + setCameraAt(a->getPos().x, a->getPos().y); } if (a->_number != oldfollow) @@ -279,13 +279,13 @@ void ScummEngine_v7::moveCamera() { if (camera._follows) { a = derefActor(camera._follows, "moveCamera"); - if (ABS(camera._cur.x - a->_pos.x) > VAR(VAR_CAMERA_THRESHOLD_X) || - ABS(camera._cur.y - a->_pos.y) > VAR(VAR_CAMERA_THRESHOLD_Y)) { + if (ABS(camera._cur.x - a->getPos().x) > VAR(VAR_CAMERA_THRESHOLD_X) || + ABS(camera._cur.y - a->getPos().y) > VAR(VAR_CAMERA_THRESHOLD_Y)) { camera._movingToActor = true; if (VAR(VAR_CAMERA_THRESHOLD_X) == 0) - camera._cur.x = a->_pos.x; + camera._cur.x = a->getPos().x; if (VAR(VAR_CAMERA_THRESHOLD_Y) == 0) - camera._cur.y = a->_pos.y; + camera._cur.y = a->getPos().y; clampCameraPos(&camera._cur); } } else { @@ -293,8 +293,8 @@ void ScummEngine_v7::moveCamera() { } if (camera._movingToActor) { - VAR(VAR_CAMERA_DEST_X) = camera._dest.x = a->_pos.x; - VAR(VAR_CAMERA_DEST_Y) = camera._dest.y = a->_pos.y; + VAR(VAR_CAMERA_DEST_X) = camera._dest.x = a->getPos().x; + VAR(VAR_CAMERA_DEST_Y) = camera._dest.y = a->getPos().y; } assert(camera._cur.x >= (_screenWidth / 2) && camera._cur.y >= (_screenHeight / 2)); diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp index 04b4e5ab80..bad2478c69 100644 --- a/engines/scumm/debugger.cpp +++ b/engines/scumm/debugger.cpp @@ -383,12 +383,12 @@ bool ScummDebugger::Cmd_Actor(int argc, const char **argv) { a->_ignoreBoxes = (value > 0); DebugPrintf("Actor[%d].ignoreBoxes = %d\n", actnum, a->_ignoreBoxes); } else if (!strcmp(argv[2], "x")) { - a->putActor(value, a->_pos.y, a->_room); - DebugPrintf("Actor[%d].x = %d\n", actnum, a->_pos.x); + a->putActor(value, -1, -1); + DebugPrintf("Actor[%d].x = %d\n", actnum, a->getPos().x); _vm->_fullRedraw = true; } else if (!strcmp(argv[2], "y")) { - a->putActor(a->_pos.x, value, a->_room); - DebugPrintf("Actor[%d].y = %d\n", actnum, a->_pos.y); + a->putActor(-1, value, -1); + DebugPrintf("Actor[%d].y = %d\n", actnum, a->getPos().y); _vm->_fullRedraw = true; } else if (!strcmp(argv[2], "_elevation")) { a->setElevation(value); @@ -427,7 +427,7 @@ bool ScummDebugger::Cmd_PrintActor(int argc, const char **argv) { a = &_vm->_actors[i]; if (a->_visible) DebugPrintf("|%2d|%4d|%4d|%3d|%4d|%3d|%3d|%3d|%3d|%3d|%3d|%3d|$%08x|\n", - a->_number, a->_pos.x, a->_pos.y, a->_width, a->getElevation(), + a->_number, a->getPos().x, a->getPos().y, a->_width, a->getElevation(), a->_costume, a->_walkbox, a->_moving, a->_forceClip, a->_frame, a->_scalex, a->getFacing(), _vm->_classData[a->_number]); } diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 6f1a102c86..657f85345d 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -1181,8 +1181,8 @@ void ScummEngine_v5::drawFlashlight() { y = _mouse.y - vs->topline; } else { Actor *a = derefActor(VAR(VAR_EGO), "drawFlashlight"); - x = a->_pos.x; - y = a->_pos.y; + x = a->getPos().x; + y = a->getPos().y; } _flashlight.w = _flashlight.xStrips * 8; _flashlight.h = _flashlight.yStrips * 8; diff --git a/engines/scumm/he/script_v100he.cpp b/engines/scumm/he/script_v100he.cpp index 7e49825632..11a963c418 100644 --- a/engines/scumm/he/script_v100he.cpp +++ b/engines/scumm/he/script_v100he.cpp @@ -410,7 +410,7 @@ void ScummEngine_v100he::o100_actorOps() { case 6: j = pop(); i = pop(); - a->putActor(i, j, a->_room); + a->putActor(i, j); break; case 8: a->_drawToBackBuf = false; @@ -418,7 +418,7 @@ void ScummEngine_v100he::o100_actorOps() { a->_needBgReset = true; break; case 9: - a->drawActorToBackBuf(a->_pos.x, a->_pos.y); + a->drawActorToBackBuf(a->getPos().x, a->getPos().y); break; case 14: a->_charset = pop(); @@ -534,13 +534,13 @@ void ScummEngine_v100he::o100_actorOps() { a->_ignoreBoxes = 0; a->_forceClip = 0; if (a->isInCurrentRoom()) - a->putActor(a->_pos.x, a->_pos.y, a->_room); + a->putActor(); break; case 135: // SO_IGNORE_BOXES a->_ignoreBoxes = 1; a->_forceClip = 0; if (a->isInCurrentRoom()) - a->putActor(a->_pos.x, a->_pos.y, a->_room); + a->putActor(); break; case 136: // SO_ACTOR_IGNORE_TURNS_OFF a->_ignoreTurns = false; diff --git a/engines/scumm/he/script_v60he.cpp b/engines/scumm/he/script_v60he.cpp index 59c28bc057..ba38509d99 100644 --- a/engines/scumm/he/script_v60he.cpp +++ b/engines/scumm/he/script_v60he.cpp @@ -712,13 +712,13 @@ void ScummEngine_v60he::o60_actorOps() { a->_ignoreBoxes = 1; a->_forceClip = 0; if (a->isInCurrentRoom()) - a->putActor(a->_pos.x, a->_pos.y, a->_room); + a->putActor(); break; case 96: // SO_FOLLOW_BOXES a->_ignoreBoxes = 0; a->_forceClip = 0; if (a->isInCurrentRoom()) - a->putActor(a->_pos.x, a->_pos.y, a->_room); + a->putActor(); break; case 97: // SO_ANIMATION_SPEED a->setAnimSpeed(pop()); @@ -748,7 +748,7 @@ void ScummEngine_v60he::o60_actorOps() { a->initActor(2); break; case 218: - a->drawActorToBackBuf(a->_pos.x, a->_pos.y); + a->drawActorToBackBuf(a->getPos().x, a->getPos().y); break; case 219: a->_drawToBackBuf = false; diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp index c0dd431d4c..d6502d2ae4 100644 --- a/engines/scumm/he/script_v72he.cpp +++ b/engines/scumm/he/script_v72he.cpp @@ -1123,7 +1123,7 @@ void ScummEngine_v72he::o72_actorOps() { case 65: // HE 98+ j = pop(); i = pop(); - a->putActor(i, j, a->_room); + a->putActor(i, j); break; case 68: // HE 90+ k = pop(); @@ -1205,13 +1205,13 @@ void ScummEngine_v72he::o72_actorOps() { a->_ignoreBoxes = 1; a->_forceClip = 0; if (a->isInCurrentRoom()) - a->putActor(a->_pos.x, a->_pos.y, a->_room); + a->putActor(); break; case 96: // SO_FOLLOW_BOXES a->_ignoreBoxes = 0; a->_forceClip = 0; if (a->isInCurrentRoom()) - a->putActor(a->_pos.x, a->_pos.y, a->_room); + a->putActor(); break; case 97: // SO_ANIMATION_SPEED a->setAnimSpeed(pop()); @@ -1245,7 +1245,7 @@ void ScummEngine_v72he::o72_actorOps() { a->initActor(2); break; case 218: - a->drawActorToBackBuf(a->_pos.x, a->_pos.y); + a->drawActorToBackBuf(a->getPos().x, a->getPos().y); break; case 219: a->_drawToBackBuf = false; 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; diff --git a/engines/scumm/room.cpp b/engines/scumm/room.cpp index 881327952b..a98547dca3 100644 --- a/engines/scumm/room.cpp +++ b/engines/scumm/room.cpp @@ -185,8 +185,8 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) { a->setDirection(dir + 180); a->stopActorMoving(); if (_game.id == GID_SAMNMAX) { - camera._cur.x = camera._dest.x = a->_pos.x; - setCameraAt(a->_pos.x, a->_pos.y); + camera._cur.x = camera._dest.x = a->getPos().x; + setCameraAt(a->getPos().x, a->getPos().y); } } @@ -206,7 +206,7 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) { } else if (_game.version >= 7) { if (camera._follows) { a = derefActor(camera._follows, "startScene: follows"); - setCameraAt(a->_pos.x, a->_pos.y); + setCameraAt(a->getPos().x, a->getPos().y); } } diff --git a/engines/scumm/script_c64.cpp b/engines/scumm/script_c64.cpp index 02d9a2d206..ee39414060 100644 --- a/engines/scumm/script_c64.cpp +++ b/engines/scumm/script_c64.cpp @@ -650,8 +650,8 @@ void ScummEngine_c64::o_loadRoomWithEgo() { a->putActor(x, y, _currentRoom); a->setDirection(dir + 180); - camera._dest.x = camera._cur.x = a->_pos.x; - setCameraAt(a->_pos.x, a->_pos.y); + camera._dest.x = camera._cur.x = a->getPos().x; + setCameraAt(a->getPos().x, a->getPos().y); setCameraFollows(a); _fullRedraw = true; @@ -749,7 +749,7 @@ void ScummEngine_c64::o_putActorAtObject() { y = 60; } - a->putActor(x, y, a->_room); + a->putActor(x, y); } void ScummEngine_c64::o_pickupObject() { diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp index d6377d9ffd..beccc6d116 100644 --- a/engines/scumm/script_v2.cpp +++ b/engines/scumm/script_v2.cpp @@ -1152,7 +1152,7 @@ void ScummEngine_v2::o2_putActor() { if (_game.id == GID_MANIAC && _game.version <= 1 && _game.platform != Common::kPlatformNES) a->setFacing(180); - a->putActor(x, y, a->_room); + a->putActor(x, y); } void ScummEngine_v2::o2_startScript() { @@ -1222,7 +1222,7 @@ void ScummEngine_v2::o2_putActorAtObject() { y = 120; } - a->putActor(x, y, a->_room); + a->putActor(x, y); } void ScummEngine_v2::o2_putActorInRoom() { @@ -1380,8 +1380,8 @@ void ScummEngine_v2::o2_loadRoomWithEgo() { a->putActor(x2, y2, _currentRoom); a->setDirection(dir + 180); - camera._dest.x = camera._cur.x = a->_pos.x; - setCameraAt(a->_pos.x, a->_pos.y); + camera._dest.x = camera._cur.x = a->getPos().x; + setCameraAt(a->getPos().x, a->getPos().y); setCameraFollows(a); _fullRedraw = true; diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp index 3b75354a4c..054b6eeb2f 100644 --- a/engines/scumm/script_v5.cpp +++ b/engines/scumm/script_v5.cpp @@ -499,7 +499,7 @@ void ScummEngine_v5::o5_actorOps() { a->_ignoreBoxes = !(_opcode & 1); a->_forceClip = 0; if (a->isInCurrentRoom()) - a->putActor(a->_pos.x, a->_pos.y, a->_room); + a->putActor(); break; case 22: // SO_ANIMATION_SPEED @@ -1316,7 +1316,7 @@ void ScummEngine_v5::o5_isActorInBox() { int box = getVarOrDirectByte(PARAM_2); Actor *a = derefActor(act, "o5_isActorInBox"); - if (!checkXYInBoxBounds(box, a->_pos.x, a->_pos.y)) + if (!checkXYInBoxBounds(box, a->getPos().x, a->getPos().y)) o5_jumpRelative(); else ignoreScriptWord(); @@ -1475,7 +1475,7 @@ void ScummEngine_v5::o5_loadRoomWithEgo() { a = derefActor(VAR(VAR_EGO), "o5_loadRoomWithEgo"); - a->putActor(a->_pos.x, a->_pos.y, room); + a->putActor(a->getPos().x, a->getPos().y, room); oldDir = a->getFacing(); _egoPositioned = false; @@ -1499,9 +1499,9 @@ void ScummEngine_v5::o5_loadRoomWithEgo() { } // This is based on disassembly - camera._cur.x = camera._dest.x = a->_pos.x; + camera._cur.x = camera._dest.x = a->getPos().x; if ((_game.id == GID_ZAK || _game.id == GID_LOOM) && (_game.platform == Common::kPlatformFMTowns)) { - setCameraAt(a->_pos.x, a->_pos.y); + setCameraAt(a->getPos().x, a->getPos().y); } setCameraFollows(a); @@ -1621,7 +1621,7 @@ void ScummEngine_v5::o5_putActor() { a = derefActor(getVarOrDirectByte(PARAM_1), "o5_putActor"); x = getVarOrDirectWord(PARAM_2); y = getVarOrDirectWord(PARAM_3); - a->putActor(x, y, a->_room); + a->putActor(x, y); } void ScummEngine_v5::o5_putActorAtObject() { @@ -1636,7 +1636,7 @@ void ScummEngine_v5::o5_putActorAtObject() { x = 240; y = 120; } - a->putActor(x, y, a->_room); + a->putActor(x, y); } void ScummEngine_v5::o5_putActorInRoom() { @@ -2623,9 +2623,9 @@ implement a proper fix. dist = a->_scalex * a->_width / 0xFF; dist += (a2->_scalex * a2->_width / 0xFF) / 2; } - x = a2->_pos.x; - y = a2->_pos.y; - if (x < a->_pos.x) + x = a2->getPos().x; + y = a2->getPos().y; + if (x < a->getPos().x) x += dist; else x -= dist; diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp index 070a675862..7eb6109313 100644 --- a/engines/scumm/script_v6.cpp +++ b/engines/scumm/script_v6.cpp @@ -1204,9 +1204,9 @@ void ScummEngine_v6::o6_walkActorToObj() { dist = a2->_scalex * a2->_width / 0xFF; dist += dist / 2; } - x = a2->_pos.x; - y = a2->_pos.y; - if (x < a->_pos.x) + x = a2->getPos().x; + y = a2->getPos().y; + if (x < a->getPos().x) x += dist; else x -= dist; @@ -1349,7 +1349,7 @@ void ScummEngine_v6::o6_loadRoomWithEgo() { VAR(VAR_WALKTO_OBJ) = 0; if (_game.version == 6) { - camera._cur.x = camera._dest.x = a->_pos.x; + camera._cur.x = camera._dest.x = a->getPos().x; setCameraFollows(a, (_game.heversion >= 60)); } @@ -1455,7 +1455,7 @@ void ScummEngine_v6::o6_getAnimateVariable() { void ScummEngine_v6::o6_isActorInBox() { int box = pop(); Actor *a = derefActor(pop(), "o6_isActorInBox"); - push(checkXYInBoxBounds(box, a->_pos.x, a->_pos.y)); + push(checkXYInBoxBounds(box, a->getPos().x, a->getPos().y)); } void ScummEngine_v6::o6_getActorLayer() { @@ -1866,13 +1866,13 @@ void ScummEngine_v6::o6_actorOps() { a->_ignoreBoxes = 1; a->_forceClip = (_game.version >= 7) ? 100 : 0; if (a->isInCurrentRoom()) - a->putActor(a->_pos.x, a->_pos.y, a->_room); + a->putActor(); break; case 96: // SO_FOLLOW_BOXES a->_ignoreBoxes = 0; a->_forceClip = (_game.version >= 7) ? 100 : 0; if (a->isInCurrentRoom()) - a->putActor(a->_pos.x, a->_pos.y, a->_room); + a->putActor(); break; case 97: // SO_ANIMATION_SPEED a->setAnimSpeed(pop()); diff --git a/engines/scumm/script_v8.cpp b/engines/scumm/script_v8.cpp index a1aa0b9508..4dd24ca785 100644 --- a/engines/scumm/script_v8.cpp +++ b/engines/scumm/script_v8.cpp @@ -963,13 +963,13 @@ void ScummEngine_v8::o8_actorOps() { a->_ignoreBoxes = true; a->_forceClip = 100; if (a->isInCurrentRoom()) - a->putActor(a->_pos.x, a->_pos.y, a->_room); + a->putActor(); break; case 0x77: // SO_ACTOR_FOLLOW_BOXES Make actor follow boxes a->_ignoreBoxes = false; a->_forceClip = 100; if (a->isInCurrentRoom()) - a->putActor(a->_pos.x, a->_pos.y, a->_room); + a->putActor(); break; case 0x78: // SO_ACTOR_SPECIAL_DRAW a->_shadowMode = pop(); diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp index 58bcc0b82d..b4cd07750e 100644 --- a/engines/scumm/string.cpp +++ b/engines/scumm/string.cpp @@ -432,8 +432,8 @@ void ScummEngine::CHARSET_1() { if (a && _string[0].overhead != 0) { int s; - _string[0].xpos = a->_pos.x - virtscr[0].xstart; - _string[0].ypos = a->_pos.y - a->getElevation() - _screenTop; + _string[0].xpos = a->getPos().x - virtscr[0].xstart; + _string[0].ypos = a->getPos().y - a->getElevation() - _screenTop; if (_game.version <= 5) { -- cgit v1.2.3