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 | |
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')
-rw-r--r-- | engines/pink/constants.h | 4 | ||||
-rw-r--r-- | engines/pink/file.cpp | 3 | ||||
-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 | ||||
-rw-r--r-- | engines/pink/resource_mgr.cpp | 23 | ||||
-rw-r--r-- | engines/pink/sound.h | 1 |
10 files changed, 32 insertions, 25 deletions
diff --git a/engines/pink/constants.h b/engines/pink/constants.h index 2f5239f3f2..fd4ccbdc8f 100644 --- a/engines/pink/constants.h +++ b/engines/pink/constants.h @@ -164,8 +164,8 @@ static const char *kHideAction = "Hide"; static const char *kInventoryWindowActor = "InventoryWindow"; static const char *kInventoryItemActor = "InventoryItem"; -static const char *kInventoryRightArrowActor = "InventoryWindow"; -static const char *kInventoryLeftArrowActor = "InventoryWindow"; +static const char *kInventoryRightArrowActor = "InventoryRightArrow"; +static const char *kInventoryLeftArrowActor = "InventoryLeftArrow"; static const char *kCursorNameExitUp = "ExitUp"; static const char *kCursorNameExitLeft = "ExitLeft"; diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp index 4f2867b10c..8db4542615 100644 --- a/engines/pink/file.cpp +++ b/engines/pink/file.cpp @@ -53,8 +53,7 @@ bool OrbFile::open(const Common::String &name) { return false; } - _timestamp = readUint32LE(); - if (!_timestamp){ + if (!(_timestamp = readUint32LE())){ return false; } 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; } } } diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp index 8695191e65..b3c963613c 100644 --- a/engines/pink/resource_mgr.cpp +++ b/engines/pink/resource_mgr.cpp @@ -56,22 +56,21 @@ Sound *ResourceMgr::loadSound(Common::String &name) { Common::SafeSeekableSubReadStream *ResourceMgr::getResourceStream(Common::String &name) { Common::SeekableReadStream *stream; - uint i; - for (i = 0; i < _resCount; ++i) { - if (name.compareToIgnoreCase(_resDescTable[i].name) == 0){ - break; - } - } - assert(i < _resDescTable[i].size); - - if (_resDescTable[i].inBro) + + const ResourceDescription &desc = *Common::find_if(_resDescTable, _resDescTable + _resCount, + [&] (const ResourceDescription &desc) { + return name.compareToIgnoreCase(desc.name) == 0; + }); + + + if (desc.inBro) stream = _game->getBro(); else stream = _game->getOrb(); - stream->seek(_resDescTable[i].offset); + stream->seek(desc.offset); - return new Common::SafeSeekableSubReadStream(stream, _resDescTable[i].offset, - _resDescTable[i].offset + _resDescTable[i].size); + return new Common::SafeSeekableSubReadStream(stream, desc.offset, + desc.offset + desc.size); } PinkEngine *ResourceMgr::getGame() const { diff --git a/engines/pink/sound.h b/engines/pink/sound.h index 0116825800..e1074d2af8 100644 --- a/engines/pink/sound.h +++ b/engines/pink/sound.h @@ -25,6 +25,7 @@ #include <common/stream.h> #include <audio/mixer.h> +#include <common/substream.h> namespace Pink { |