Ticket #4669: checkDoorOnlyFromUser.patch

File checkDoorOnlyFromUser.patch, 3.0 KB (added by digitall, 8 years ago)

Slightly Better Fix (Prevent checkDoor in Pathfinding when called by Script)

  • engines/parallaction/parallaction_ns.cpp

    diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp
    index 0b92db1..ccec6ac 100644
    a b void Parallaction_ns::updateWalkers() {  
    546546
    547547
    548548void Parallaction_ns::scheduleWalk(int16 x, int16 y, bool fromUser) {
     549        debugC(1, kDebugWalk, "Parallaction_ns::scheduleWalk(x:%d, y:%d, fromUser:%d)", x, y, fromUser);
    549550        AnimationPtr a = _char._ani;
    550551
    551552        if ((a->_flags & kFlagsRemove) || (a->_flags & kFlagsActive) == 0) {
    552553                return;
    553554        }
    554555
    555         _walker->buildPath(a, x, y);
     556        debugC(1, kDebugWalk, "\tbuilding Path");
     557        _walker->buildPath(a, x, y, fromUser);
    556558        _engineFlags |= kEngineWalking;
    557559}
    558560
  • engines/parallaction/walk.cpp

    diff --git a/engines/parallaction/walk.cpp b/engines/parallaction/walk.cpp
    index 53237db..31c3087 100644
    a b uint32 PathWalker_NS::buildSubPath(const Common::Point& pos, const Common::Point  
    168168}
    169169
    170170//      x, y: mouse click (foot) coordinates
    171 void PathWalker_NS::buildPath(AnimationPtr a, uint16 x, uint16 y) {
     171void PathWalker_NS::buildPath(AnimationPtr a, uint16 x, uint16 y, bool fromUser) {
    172172        debugC(1, kDebugWalk, "PathBuilder::buildPath to (%i, %i)", x, y);
    173173
    174174        _a = a;
     175        _fromUser = fromUser;
    175176
    176177        _walkPath.clear();
    177178
    void PathWalker_NS::clipMove(Common::Point& pos, const Common::Point& to) {  
    278279}
    279280
    280281void PathWalker_NS::checkDoor(const Common::Point &foot) {
     282        debugC(1, kDebugWalk, "PathWalker_NS::checkDoor()");
    281283        ZonePtr z = _vm->hitZone(kZoneDoor, foot.x, foot.y);
    282284        if (z) {
    283285                if ((z->_flags & kFlagsClosed) == 0) {
    void PathWalker_NS::checkDoor(const Common::Point &foot) {  
    306308}
    307309
    308310void PathWalker_NS::finalizeWalk() {
     311        debugC(1, kDebugWalk, "PathWalker_NS::finalizeWalk()");
    309312        _engineFlags &= ~kEngineWalking;
    310313
    311314        Common::Point foot;
    312315        _a->getFoot(foot);
    313         checkDoor(foot);
     316        if (_fromUser)
     317                checkDoor(foot);
    314318
    315319        _walkPath.clear();
    316320}
    void PathWalker_NS::updateDirection(const Common::Point& pos, const Common::Poin  
    382386        _a->setF(frames->firstWalkFrame[_direction] + (_step / frames->frameRepeat[_direction]) % frames->numWalkFrames[_direction]);
    383387}
    384388
    385 PathWalker_NS::PathWalker_NS() : _direction(WALK_DOWN), _step(0) {
     389PathWalker_NS::PathWalker_NS() : _direction(WALK_DOWN), _step(0), _fromUser(false) {
    386390}
    387391
    388392bool PathWalker_BR::directPathExists(const Common::Point &from, const Common::Point &to) {
  • engines/parallaction/walk.h

    diff --git a/engines/parallaction/walk.h b/engines/parallaction/walk.h
    index 6796991..a8f8194 100644
    a b class PathWalker_NS {  
    3636        AnimationPtr _a;
    3737        PointList       _walkPath;
    3838        int16           _direction, _step;
     39        bool _fromUser;
    3940
    4041        // builder routines
    4142        PointList       _subPath;
    class PathWalker_NS {  
    5253public:
    5354        PathWalker_NS();
    5455
    55         void buildPath(AnimationPtr a, uint16 x, uint16 y);
     56        void buildPath(AnimationPtr a, uint16 x, uint16 y, bool fromUser);
    5657        void walk();
    5758};
    5859