STARK: Fix the mouse cursor when hovering an exit with an inventory item selected

This commit is contained in:
Bastien Bouclet 2015-07-23 07:02:58 +02:00
parent ba770a3c22
commit 9df2c1d319
3 changed files with 10 additions and 6 deletions

View File

@ -54,7 +54,7 @@ public:
};
/**
* Resources::Resource state provider.
* Resource state provider.
*
* Maintains a serialized version of the state of the resource trees.
*/

View File

@ -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)) {

View File

@ -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;