Always stop actor walkscript when required.

svn-id: r14184
This commit is contained in:
Travis Howell 2004-07-10 23:32:31 +00:00
parent 32335f0ea1
commit ebafa060c6
4 changed files with 9 additions and 13 deletions

View File

@ -94,9 +94,7 @@ void Actor::initActor(int mode) {
memset(sound, 0, sizeof(sound));
targetFacing = facing;
if (walkScript)
_vm->stopScript(walkScript);
moving = 0;
stopActorMoving();
shadow_mode = 0;
layer = 0;
@ -138,10 +136,9 @@ void Actor::initActor(int mode) {
}
void Actor::stopActorMoving() {
if (walkScript)
if (_vm->_version >= 7)
_vm->stopScript(walkScript);
moving = 0;
startAnimActor(standFrame);
}
void Actor::setActorWalkSpeed(uint newSpeedX, uint newSpeedY) {
@ -593,8 +590,8 @@ void Actor::putActor(int dstX, int dstY, byte newRoom) {
if (visible) {
if (isInCurrentRoom()) {
if (moving) {
stopActorMoving();
startAnimActor(standFrame);
moving = 0;
}
adjustActorPos();
} else {
@ -708,12 +705,9 @@ void Actor::adjustActorPos() {
walkdata.dest.x = -1;
moving = 0;
stopActorMoving();
cost.soundCounter = 0;
if (walkScript)
_vm->stopScript(walkScript);
if (walkbox != kInvalidBox) {
byte flags = _vm->getBoxFlags(walkbox);
if (flags & 7) {
@ -755,8 +749,8 @@ void Actor::hideActor() {
return;
if (moving) {
stopActorMoving();
startAnimActor(standFrame);
moving = 0;
}
visible = false;
cost.soundCounter = 0;
@ -785,7 +779,7 @@ void Actor::showActor() {
if (!moving && _vm->_version <= 2)
startAnimActor(standFrame);
moving = 0;
stopActorMoving();
visible = true;
needRedraw = true;
}

View File

@ -1892,6 +1892,7 @@ void ScummEngine_v6::o6_actorOps() {
break;
case 229: // SO_ACTOR_STOP
a->stopActorMoving();
a->startAnimActor(a->standFrame);
break;
case 230: /* set direction */
a->moving &= ~MF_TURN;

View File

@ -1039,6 +1039,7 @@ void ScummEngine_v8::o8_actorOps() {
break;
case 0x80: // SO_ACTOR_STOP
a->stopActorMoving();
a->startAnimActor(a->standFrame);
break;
case 0x81: // SO_ACTOR_FACE Make actor face angle
a->moving &= ~MF_TURN;

View File

@ -2222,7 +2222,7 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) {
getObjectXYPos(objectNr, x, y, dir);
a->putActor(x, y, _currentRoom);
a->setDirection(dir + 180);
a->moving = 0;
a->stopActorMoving();
}
showActors();