mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-19 02:38:32 +00:00
STARK: Fix the mouse cursor when hovering an exit with an inventory item selected
This commit is contained in:
parent
ba770a3c22
commit
9df2c1d319
@ -54,7 +54,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resources::Resource state provider.
|
* Resource state provider.
|
||||||
*
|
*
|
||||||
* Maintains a serialized version of the state of the resource trees.
|
* Maintains a serialized version of the state of the resource trees.
|
||||||
*/
|
*/
|
||||||
|
@ -79,12 +79,13 @@ void GameWindow::onMouseMove(const Common::Point &pos) {
|
|||||||
|
|
||||||
int16 selectedInventoryItem = _inventory->getSelectedInventoryItem();
|
int16 selectedInventoryItem = _inventory->getSelectedInventoryItem();
|
||||||
int16 singlePossibleAction = -1;
|
int16 singlePossibleAction = -1;
|
||||||
|
bool defaultAction = false;
|
||||||
|
|
||||||
checkObjectAtPos(pos, selectedInventoryItem, singlePossibleAction);
|
checkObjectAtPos(pos, selectedInventoryItem, singlePossibleAction, defaultAction);
|
||||||
|
|
||||||
Common::String mouseHint;
|
Common::String mouseHint;
|
||||||
|
|
||||||
if (selectedInventoryItem != -1) {
|
if (selectedInventoryItem != -1 && !defaultAction) {
|
||||||
VisualImageXMG *cursorImage = StarkGameInterface->getCursorImage(selectedInventoryItem);
|
VisualImageXMG *cursorImage = StarkGameInterface->getCursorImage(selectedInventoryItem);
|
||||||
_cursor->setCursorImage(cursorImage);
|
_cursor->setCursorImage(cursorImage);
|
||||||
} else if (_objectUnderCursor) {
|
} else if (_objectUnderCursor) {
|
||||||
@ -124,8 +125,9 @@ void GameWindow::onClick(const Common::Point &pos) {
|
|||||||
|
|
||||||
int16 selectedInventoryItem = _inventory->getSelectedInventoryItem();
|
int16 selectedInventoryItem = _inventory->getSelectedInventoryItem();
|
||||||
int16 singlePossibleAction = -1;
|
int16 singlePossibleAction = -1;
|
||||||
|
bool defaultAction;
|
||||||
|
|
||||||
checkObjectAtPos(pos, selectedInventoryItem, singlePossibleAction);
|
checkObjectAtPos(pos, selectedInventoryItem, singlePossibleAction, defaultAction);
|
||||||
|
|
||||||
if (_objectUnderCursor) {
|
if (_objectUnderCursor) {
|
||||||
if (singlePossibleAction != -1) {
|
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;
|
_objectUnderCursor = nullptr;
|
||||||
singlePossibleAction = -1;
|
singlePossibleAction = -1;
|
||||||
|
isDefaultAction = false;
|
||||||
|
|
||||||
// Render entries are sorted from the farthest to the camera to the nearest
|
// Render entries are sorted from the farthest to the camera to the nearest
|
||||||
// Loop in reverse order
|
// Loop in reverse order
|
||||||
@ -176,6 +179,7 @@ void GameWindow::checkObjectAtPos(Common::Point pos, int16 selectedInventoryItem
|
|||||||
if (defaultAction != -1) {
|
if (defaultAction != -1) {
|
||||||
// Use the default action if there is one
|
// Use the default action if there is one
|
||||||
singlePossibleAction = defaultAction;
|
singlePossibleAction = defaultAction;
|
||||||
|
isDefaultAction = true;
|
||||||
} else if (selectedInventoryItem != -1) {
|
} else if (selectedInventoryItem != -1) {
|
||||||
// Use the selected inventory item if there is one
|
// Use the selected inventory item if there is one
|
||||||
if (StarkGameInterface->itemHasActionAt(_objectUnderCursor, _objectRelativePosition, selectedInventoryItem)) {
|
if (StarkGameInterface->itemHasActionAt(_objectUnderCursor, _objectRelativePosition, selectedInventoryItem)) {
|
||||||
|
@ -47,7 +47,7 @@ protected:
|
|||||||
void onRightClick(const Common::Point &pos) override;
|
void onRightClick(const Common::Point &pos) override;
|
||||||
void onRender() 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;
|
ActionMenu *_actionMenu;
|
||||||
InventoryWindow *_inventory;
|
InventoryWindow *_inventory;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user