diff options
author | whiterandrek | 2018-04-27 17:08:48 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2018-06-28 23:51:32 +0200 |
commit | 9f8356e52e25b11d0e842728d2134d5c32e22e3b (patch) | |
tree | cd4086b97c9dbd750a58920d41610302ff32d28a /engines/pink/objects | |
parent | 888f5b668fb4d06e38b0dc581b24ab37f5a1852e (diff) | |
download | scummvm-rg350-9f8356e52e25b11d0e842728d2134d5c32e22e3b.tar.gz scummvm-rg350-9f8356e52e25b11d0e842728d2134d5c32e22e3b.tar.bz2 scummvm-rg350-9f8356e52e25b11d0e842728d2134d5c32e22e3b.zip |
PINK: fixed Inventory onClick method and other bugfixes
Diffstat (limited to 'engines/pink/objects')
-rw-r--r-- | engines/pink/objects/actors/lead_actor.cpp | 10 | ||||
-rw-r--r-- | engines/pink/objects/actors/lead_actor.h | 1 | ||||
-rw-r--r-- | engines/pink/objects/handlers/handler_timer.cpp | 2 | ||||
-rw-r--r-- | engines/pink/objects/inventory.cpp | 3 | ||||
-rw-r--r-- | engines/pink/objects/walk/walk_mgr.cpp | 5 | ||||
-rw-r--r-- | engines/pink/objects/walk/walk_shortest_path.cpp | 5 |
6 files changed, 17 insertions, 9 deletions
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp index 2a0f84dbcd..fd4ed7143e 100644 --- a/engines/pink/objects/actors/lead_actor.cpp +++ b/engines/pink/objects/actors/lead_actor.cpp @@ -146,7 +146,7 @@ void LeadActor::start(bool isHandler) { _state = kInDialog1; _nextState = kReady; } - updateCursor({0,0}); + forceUpdateCursor(); } void LeadActor::onMouseMove(Common::Point point) { @@ -222,7 +222,7 @@ void LeadActor::onLeftButtonClick(Common::Point point) { void LeadActor::onMouseOver(Common::Point point, CursorMgr *mgr) { if (_page->getModule()->getInventoryMgr()->isPinkOwnsAnyItems()) - _cursorMgr->setCursor(kClickableFirstFrameCursor, {0, 0}); + _cursorMgr->setCursor(kClickableFirstFrameCursor, point); else Actor::onMouseOver(point, mgr); } @@ -278,6 +278,12 @@ void LeadActor::onInventoryClosed(bool isItemClicked) { _state = _stateCopy; _stateCopy = kUnk_Loading; _page->unpause(); + forceUpdateCursor(); +} + +void LeadActor::forceUpdateCursor() { + Common::Point point = _page->getGame()->getEventManager()->getMousePos(); + updateCursor(point); } void ParlSqPink::toConsole() { diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h index 45e27f9233..5988c4cc88 100644 --- a/engines/pink/objects/actors/lead_actor.h +++ b/engines/pink/objects/actors/lead_actor.h @@ -75,6 +75,7 @@ public: private: void updateCursor(Common::Point point); + void forceUpdateCursor(); bool sendUseClickMessage(SupportingActor *actor); bool sendLeftClickMessage(SupportingActor *actor); diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp index 6fdbce1c5f..3de4ad4a71 100644 --- a/engines/pink/objects/handlers/handler_timer.cpp +++ b/engines/pink/objects/handlers/handler_timer.cpp @@ -73,7 +73,7 @@ void HandlerTimerActions::handle(Actor *actor) { void HandlerTimerSequences::execute(Sequence *sequence) { - debug("HandlerTimerSequences function is not implemented"); + error("HandlerTimerSequences function is not implemented"); } void HandlerTimerSequences::toConsole() { diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp index 8183f9dbe4..8406fe709b 100644 --- a/engines/pink/objects/inventory.cpp +++ b/engines/pink/objects/inventory.cpp @@ -148,6 +148,9 @@ void InventoryMgr::update() { } void InventoryMgr::onClick(Common::Point point) { + if (_state != kReady) + return; + Actor *actor = _lead->getPage()->getGame()->getDirector()->getActorByPoint(point); if (actor == _itemActor || actor == _window) { _isClickedOnItem = true; diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp index 0cacbd07f6..b87429d616 100644 --- a/engines/pink/objects/walk/walk_mgr.cpp +++ b/engines/pink/objects/walk/walk_mgr.cpp @@ -44,10 +44,7 @@ WalkLocation *WalkMgr::findLocation(const Common::String &name) { auto it = Common::find_if(_locations.begin(), _locations.end(), [&name](WalkLocation *location) { return location->getName() == name; }); - if (it == _locations.end()) - return nullptr; - - return *it; + return (it != _locations.end()) ? *it : nullptr; } void WalkMgr::toConsole() { diff --git a/engines/pink/objects/walk/walk_shortest_path.cpp b/engines/pink/objects/walk/walk_shortest_path.cpp index 77562e81cb..4c6f84a154 100644 --- a/engines/pink/objects/walk/walk_shortest_path.cpp +++ b/engines/pink/objects/walk/walk_shortest_path.cpp @@ -142,9 +142,9 @@ double WalkShortestPath::getWeight(WalkLocation *location) { bool WalkShortestPath::isLocationVisited(WalkLocation *location) { for (int i = 0; i < _visited.size(); ++i) { if (_visited[i] == location) - return 1; + return true; } - return 0; + return false; } void WalkShortestPath::remove(WalkLocation *location) { @@ -152,6 +152,7 @@ void WalkShortestPath::remove(WalkLocation *location) { if (_locations[i] == location){ _locations.remove_at(i); _weight.remove_at(i); + break; } } } |