aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/myst.cpp29
-rw-r--r--engines/mohawk/myst.h9
2 files changed, 22 insertions, 16 deletions
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index dae6ecd3f3..9462663fee 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -71,8 +71,10 @@ MohawkEngine_Myst::MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription
_showResourceRects = false;
_curCard = 0;
_canSafelySaveLoad = false;
- _activeResource = nullptr;
+
_hoverResource = nullptr;
+ _activeResource = nullptr;
+ _clickedResource = nullptr;
_sound = nullptr;
_video = nullptr;
@@ -269,26 +271,21 @@ Common::Error MohawkEngine_Myst::run() {
while (pollEvent(event)) {
switch (event.type) {
case Common::EVENT_MOUSEMOVE: {
- bool mouseClicked = _system->getEventManager()->getButtonState() & 1;
-
- // Keep the same resource when dragging
- if (!mouseClicked) {
- checkCurrentResource();
- }
- if (_activeResource && _activeResource->isEnabled() && mouseClicked) {
- _activeResource->handleMouseDrag();
+ if (_clickedResource && _clickedResource->isEnabled()) {
+ _clickedResource->handleMouseDrag();
}
break;
}
case Common::EVENT_LBUTTONUP:
- if (_activeResource && _activeResource->isEnabled()) {
- _activeResource->handleMouseUp();
+ if (_clickedResource && _clickedResource->isEnabled()) {
+ _clickedResource->handleMouseUp();
+ _clickedResource = nullptr;
}
- checkCurrentResource();
break;
case Common::EVENT_LBUTTONDOWN:
if (_activeResource && _activeResource->isEnabled()) {
- _activeResource->handleMouseDown();
+ _clickedResource = _activeResource;
+ _clickedResource->handleMouseDown();
}
break;
case Common::EVENT_KEYDOWN:
@@ -344,6 +341,8 @@ Common::Error MohawkEngine_Myst::run() {
}
}
+ checkCurrentResource();
+
_system->updateScreen();
// Cut down on CPU usage
@@ -641,6 +640,8 @@ void MohawkEngine_Myst::changeToCard(uint16 card, TransitionType transition) {
// Make sure we have the right cursor showing
_hoverResource = nullptr;
_activeResource = nullptr;
+ _clickedResource = nullptr;
+
checkCurrentResource();
// Debug: Show resource rects
@@ -685,8 +686,6 @@ void MohawkEngine_Myst::checkCurrentResource() {
}
MystArea *MohawkEngine_Myst::updateCurrentResource() {
- checkCurrentResource();
-
return _activeResource;
}
diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h
index 0fcc829ef8..00aaff3c33 100644
--- a/engines/mohawk/myst.h
+++ b/engines/mohawk/myst.h
@@ -263,9 +263,16 @@ private:
void loadResources();
void drawResourceRects();
void checkCurrentResource();
- MystArea *_activeResource;
+
+ /** Area of type kMystAreaHover being hovered by the mouse, if any */
MystAreaHover *_hoverResource;
+ /** Active area being hovered by the mouse, if any */
+ MystArea *_activeResource;
+
+ /** Active area being clicked on / dragged, if any */
+ MystArea *_clickedResource;
+
Common::Array<MystCursorHint> _cursorHints;
void loadCursorHints();
uint16 _currentCursor;