LASTEXPRESS: Add button pressed state for inventory handling

This commit is contained in:
Littleboy 2011-05-04 10:10:46 -04:00
parent 1516ba7367
commit 3088acf69a
3 changed files with 13 additions and 2 deletions

View File

@ -186,7 +186,7 @@ void Inventory::handleMouseEvent(const Common::Event &ev) {
error("[Inventory::handleMouseEvent] Click on highlighted item not implemented");
}
} else {
error("[Inventory::handleMouseEvent] Default handling of open menu not implemented");
warning("[Inventory::handleMouseEvent] Default handling of open menu not implemented");
}
} else {
if (_portraitHighlighted) {
@ -251,6 +251,8 @@ void Inventory::handleMouseEvent(const Common::Event &ev) {
askForRedraw();
}
return;
// Stop processing if we are not looking at an item already
if (!getState()->sceneUseBackup) {
_isOpened = false;
@ -287,7 +289,7 @@ void Inventory::handleMouseEvent(const Common::Event &ev) {
if (!_portraitHighlighted && !_isOpened) {
drawItem((CursorStyle)getProgress().portrait, 0, 0);
_portraitHighlighted = true;
} else if (!_isOpened || (ev.type == Common::EVENT_LBUTTONDOWN || ev.type == Common::EVENT_LBUTTONUP)) {
} else if (!_isOpened || getFlags()->mouseLeftPressed) {
// Do nothing
} else if (_isOpened) {
close();

View File

@ -566,6 +566,9 @@ public:
bool mouseLeftClick;
bool mouseRightClick;
bool mouseLeftPressed;
bool mouseRightPressed;
bool flag_entities_0;
bool flag_entities_1;
@ -587,6 +590,9 @@ public:
mouseRightClick = false;
mouseLeftClick = false;
mouseLeftPressed = false;
mouseRightPressed = false;
flag_entities_0 = false;
flag_entities_1 = false;

View File

@ -215,6 +215,7 @@ bool LastExpressEngine::handleEvents() {
case Common::EVENT_LBUTTONUP:
case Common::EVENT_LBUTTONDOWN:
getGameLogic()->getGameState()->getGameFlags()->mouseLeftClick = true;
getGameLogic()->getGameState()->getGameFlags()->mouseLeftPressed = (ev.type == Common::EVENT_LBUTTONDOWN) ? true : false;
// Adjust frameInterval flag
if (_frameCounter < _lastFrameCount + 30)
@ -228,6 +229,8 @@ bool LastExpressEngine::handleEvents() {
case Common::EVENT_RBUTTONUP:
case Common::EVENT_RBUTTONDOWN:
getGameLogic()->getGameState()->getGameFlags()->mouseRightClick = true;
getGameLogic()->getGameState()->getGameFlags()->mouseRightPressed = (ev.type == Common::EVENT_RBUTTONDOWN) ? true : false;
if (_eventMouse && _eventMouse->isValid())
(*_eventMouse)(ev);
break;