aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/pink/objects/actors/lead_actor.cpp36
-rw-r--r--engines/pink/objects/actors/lead_actor.h3
2 files changed, 22 insertions, 17 deletions
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index e05d50c16a..33b5bd5970 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -212,28 +212,20 @@ void LeadActor::onLeftButtonClick(const Common::Point point) {
switch (_state) {
case kReady:
case kMoving: {
- Actor *actor = getActorByPoint(point);
+ Actor *clickedActor = getActorByPoint(point);
- if (this == actor) {
+ if (this == clickedActor) {
onClick();
return;
}
- _recipient = actor;
- if (isInteractingWith(_recipient)) {
- WalkLocation *location = getWalkDestination();
- if (location) {
- _state = kMoving;
- _nextState = kInDialog1;
- _walkMgr->start(location);
- } else if (_state == kReady) {
- if (_isHaveItem)
- sendUseClickMessage(_recipient);
- else
- sendLeftClickMessage(_recipient);
- }
+ _recipient = clickedActor;
+ if (isInteractingWith(clickedActor) && !startWalk()) {
+ if (_isHaveItem)
+ sendUseClickMessage(clickedActor);
+ else
+ sendLeftClickMessage(clickedActor);
}
-
break;
}
case kPDA:
@@ -392,6 +384,18 @@ void LeadActor::startInventory(bool paused) {
_page->pause(true);
}
+bool LeadActor::startWalk() {
+ WalkLocation *location = getWalkDestination();
+ if (location) {
+ _state = kMoving;
+ _nextState = kInDialog1;
+ _walkMgr->start(location);
+ return true;
+ }
+
+ return false;
+}
+
void LeadActor::setReadyAfterWalk() {
_recipient = nullptr;
_nextState = kReady;
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index e632e7ba05..43ad2ee05a 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -100,7 +100,8 @@ protected:
virtual WalkLocation *getWalkDestination();
- void startInventory(bool fromSave);
+ void startInventory(bool paused);
+ bool startWalk();
void setReadyAfterWalk();