aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwhiterandrek2018-06-12 22:43:31 +0300
committerEugene Sandulenko2018-06-28 23:51:32 +0200
commited250751467542f0b8ef63b5e8077a48838ec9a2 (patch)
tree6552cc440778787318ed61e82f9d9f569c2d8d57
parent2c6ab1c77581b6486a5e496c0d7a5aa00db144ee (diff)
downloadscummvm-rg350-ed250751467542f0b8ef63b5e8077a48838ec9a2.tar.gz
scummvm-rg350-ed250751467542f0b8ef63b5e8077a48838ec9a2.tar.bz2
scummvm-rg350-ed250751467542f0b8ef63b5e8077a48838ec9a2.zip
PINK: rewrite onLeftButtonClick
-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();