From 9df2c1d319781a16dfec9322a806866d73ff7b83 Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Thu, 23 Jul 2015 07:02:58 +0200 Subject: [PATCH] STARK: Fix the mouse cursor when hovering an exit with an inventory item selected --- engines/stark/services/stateprovider.h | 2 +- engines/stark/ui/gamewindow.cpp | 12 ++++++++---- engines/stark/ui/gamewindow.h | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/engines/stark/services/stateprovider.h b/engines/stark/services/stateprovider.h index 889cf309eb9..98f8f8fdd73 100644 --- a/engines/stark/services/stateprovider.h +++ b/engines/stark/services/stateprovider.h @@ -54,7 +54,7 @@ public: }; /** - * Resources::Resource state provider. + * Resource state provider. * * Maintains a serialized version of the state of the resource trees. */ diff --git a/engines/stark/ui/gamewindow.cpp b/engines/stark/ui/gamewindow.cpp index 8efd23b6045..ec4edeb42d6 100644 --- a/engines/stark/ui/gamewindow.cpp +++ b/engines/stark/ui/gamewindow.cpp @@ -79,12 +79,13 @@ void GameWindow::onMouseMove(const Common::Point &pos) { int16 selectedInventoryItem = _inventory->getSelectedInventoryItem(); int16 singlePossibleAction = -1; + bool defaultAction = false; - checkObjectAtPos(pos, selectedInventoryItem, singlePossibleAction); + checkObjectAtPos(pos, selectedInventoryItem, singlePossibleAction, defaultAction); Common::String mouseHint; - if (selectedInventoryItem != -1) { + if (selectedInventoryItem != -1 && !defaultAction) { VisualImageXMG *cursorImage = StarkGameInterface->getCursorImage(selectedInventoryItem); _cursor->setCursorImage(cursorImage); } else if (_objectUnderCursor) { @@ -124,8 +125,9 @@ void GameWindow::onClick(const Common::Point &pos) { int16 selectedInventoryItem = _inventory->getSelectedInventoryItem(); int16 singlePossibleAction = -1; + bool defaultAction; - checkObjectAtPos(pos, selectedInventoryItem, singlePossibleAction); + checkObjectAtPos(pos, selectedInventoryItem, singlePossibleAction, defaultAction); if (_objectUnderCursor) { if (singlePossibleAction != -1) { @@ -153,9 +155,10 @@ void GameWindow::onRightClick(const Common::Point &pos) { } } -void GameWindow::checkObjectAtPos(Common::Point pos, int16 selectedInventoryItem, int16 &singlePossibleAction) { +void GameWindow::checkObjectAtPos(Common::Point pos, int16 selectedInventoryItem, int16 &singlePossibleAction, bool &isDefaultAction) { _objectUnderCursor = nullptr; singlePossibleAction = -1; + isDefaultAction = false; // Render entries are sorted from the farthest to the camera to the nearest // Loop in reverse order @@ -176,6 +179,7 @@ void GameWindow::checkObjectAtPos(Common::Point pos, int16 selectedInventoryItem if (defaultAction != -1) { // Use the default action if there is one singlePossibleAction = defaultAction; + isDefaultAction = true; } else if (selectedInventoryItem != -1) { // Use the selected inventory item if there is one if (StarkGameInterface->itemHasActionAt(_objectUnderCursor, _objectRelativePosition, selectedInventoryItem)) { diff --git a/engines/stark/ui/gamewindow.h b/engines/stark/ui/gamewindow.h index f04c0d959fc..31d5610783b 100644 --- a/engines/stark/ui/gamewindow.h +++ b/engines/stark/ui/gamewindow.h @@ -47,7 +47,7 @@ protected: void onRightClick(const Common::Point &pos) override; void onRender() override; - void checkObjectAtPos(Common::Point pos, int16 selectedInventoryItem, int16 &singlePossibleAction); + void checkObjectAtPos(Common::Point pos, int16 selectedInventoryItem, int16 &singlePossibleAction, bool &isDefaultAction); ActionMenu *_actionMenu; InventoryWindow *_inventory;