diff --git a/engines/saga/actor_path.cpp b/engines/saga/actor_path.cpp index 3e10aba..60f35c7 100644 --- a/engines/saga/actor_path.cpp +++ b/engines/saga/actor_path.cpp @@ -23,6 +23,7 @@ #include "saga/saga.h" #include "saga/actor.h" +#include "saga/objectmap.h" #include "saga/scene.h" namespace Saga { @@ -99,6 +100,18 @@ void Actor::findActorPath(ActorData *actor, const Point &fromPoint, const Point _debugPointsCount = 0; #endif + int hitZoneIndex; + const HitZone *hitZone; + bool walkToExit = false; + + hitZoneIndex = _vm->_scene->_actionMap->hitTest(toPoint); + if (hitZoneIndex != -1) { + hitZone = _vm->_scene->_actionMap->getHitZone(hitZoneIndex); + if (hitZone->getFlags() & kHitZoneExit) { + walkToExit = true; + } + } + actor->_walkStepsCount = 0; if (fromPoint == toPoint) { actor->addWalkStepPoint(toPoint); @@ -110,6 +123,15 @@ void Actor::findActorPath(ActorData *actor, const Point &fromPoint, const Point if (_vm->_scene->validBGMaskPoint(iteratorPoint)) { maskType = _vm->_scene->getBGMaskType(iteratorPoint); setPathCell(iteratorPoint, _vm->_scene->getDoorState(maskType) ? kPathCellBarrier : kPathCellEmpty); + if (!walkToExit) { + hitZoneIndex = _vm->_scene->_actionMap->hitTest(iteratorPoint); + if (hitZoneIndex != -1) { + hitZone = _vm->_scene->_actionMap->getHitZone(hitZoneIndex); + if (hitZone->getFlags() & kHitZoneExit) { + setPathCell(iteratorPoint, kPathCellBarrier); + } + } + } } else { setPathCell(iteratorPoint, kPathCellBarrier); }