From cfd4ffb321112a311eb800077c4483d76a6d63d6 Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Thu, 21 Dec 2006 15:09:13 +0000 Subject: fixed bug #1620023 (script calls putActorAtXY with y == -1) svn-id: r24910 --- engines/scumm/actor.cpp | 9 +-------- engines/scumm/actor.h | 19 ++++++++++++++----- engines/scumm/debugger.cpp | 4 ++-- engines/scumm/script_c64.cpp | 2 +- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 2f38b421c4..1e2a3b504d 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -878,13 +878,6 @@ void ScummEngine::putActors() { } 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(); } @@ -1712,7 +1705,7 @@ void ScummEngine::setTalkingActor(int value) { // Work out the screen co-ordinates of the actor 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 // TODO: Make the size adjust depending on what it's focusing on. Common::Rect rect(x - 96, y - 64, x + 96, y + 64); diff --git a/engines/scumm/actor.h b/engines/scumm/actor.h index 79528e34f8..632a819467 100644 --- a/engines/scumm/actor.h +++ b/engines/scumm/actor.h @@ -153,17 +153,17 @@ protected: 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; @@ -186,7 +186,16 @@ public: void showActor(); void initActor(int mode); - void putActor(int x = -1, int y = -1, int room = -1); + + void putActor() { + putActor(_pos.x, _pos.y, _room); + } + + void putActor(int x, int y) { + putActor(x, y, _room); + } + + void putActor(int x, int y, int room); void setActorWalkSpeed(uint newSpeedX, uint newSpeedY); protected: int calcMovementFactor(const Common::Point& next); diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp index bad2478c69..b55817ab98 100644 --- a/engines/scumm/debugger.cpp +++ b/engines/scumm/debugger.cpp @@ -383,11 +383,11 @@ 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, -1, -1); + a->putActor(value, a->getPos().y, a->_room); DebugPrintf("Actor[%d].x = %d\n", actnum, a->getPos().x); _vm->_fullRedraw = true; } else if (!strcmp(argv[2], "y")) { - a->putActor(-1, value, -1); + a->putActor(a->getPos().x, value, a->_room); DebugPrintf("Actor[%d].y = %d\n", actnum, a->getPos().y); _vm->_fullRedraw = true; } else if (!strcmp(argv[2], "_elevation")) { diff --git a/engines/scumm/script_c64.cpp b/engines/scumm/script_c64.cpp index ee39414060..25ca3d9de9 100644 --- a/engines/scumm/script_c64.cpp +++ b/engines/scumm/script_c64.cpp @@ -749,7 +749,7 @@ void ScummEngine_c64::o_putActorAtObject() { y = 60; } - a->putActor(x, y); + a->putActor(x, y, a->_room); } void ScummEngine_c64::o_pickupObject() { -- cgit v1.2.3