aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/pet_control/pet_gfx_element.h6
-rw-r--r--engines/titanic/pet_control/pet_starfield.cpp23
-rw-r--r--engines/titanic/pet_control/pet_starfield.h9
3 files changed, 25 insertions, 13 deletions
diff --git a/engines/titanic/pet_control/pet_gfx_element.h b/engines/titanic/pet_control/pet_gfx_element.h
index 91d9b9ccb2..3d2a06db97 100644
--- a/engines/titanic/pet_control/pet_gfx_element.h
+++ b/engines/titanic/pet_control/pet_gfx_element.h
@@ -67,6 +67,12 @@ public:
* Get the game object associated with this item
*/
virtual CGameObject *getObject() const;
+
+ /**
+ * Gets the explicit bounds set for the graphic element,
+ * ignoring any associated sub-object bounds
+ */
+ const Rect &getRawBounds() const { return _bounds; }
};
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_starfield.cpp b/engines/titanic/pet_control/pet_starfield.cpp
index bbe892464f..7476c6eda2 100644
--- a/engines/titanic/pet_control/pet_starfield.cpp
+++ b/engines/titanic/pet_control/pet_starfield.cpp
@@ -94,7 +94,7 @@ bool CPetStarfield::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
_petControl->displayMessage(SUPPLY_GALACTIC_REFERENCE);
}
} else if (!_btnSetDest.MouseButtonDownMsg(msg->_mousePos)) {
- return elementsMouseDown(msg);
+ return markersMouseDown(msg);
}
return true;
@@ -216,33 +216,36 @@ void CPetStarfield::makePetDirty() {
_petControl->makeDirty();
}
-bool CPetStarfield::elementsMouseDown(CMouseButtonDownMsg *msg) {
- if (elementMouseButton(0, msg, _leds[0].getBounds()))
+bool CPetStarfield::markersMouseDown(CMouseButtonDownMsg *msg) {
+ if (markerMouseDown(0, msg, _leds[0].getRawBounds()))
return true;
- if (elementMouseButton(1, msg, _leds[2].getBounds()))
+ if (markerMouseDown(1, msg, _leds[2].getRawBounds()))
return true;
- if (elementMouseButton(2, msg, _leds[4].getBounds()))
+ if (markerMouseDown(2, msg, _leds[4].getRawBounds()))
return true;
return false;
}
-bool CPetStarfield::elementMouseButton(int index, CMouseButtonDownMsg *msg, const Rect &rect) {
+bool CPetStarfield::markerMouseDown(int index, CMouseButtonDownMsg *msg, const Rect &rect) {
if (!rect.contains(msg->_mousePos))
return false;
switch (_markerStates[index]) {
- case 1:
+ case MS_FLICKERING:
+ // Marker is flickering, so lock it in
if (_petControl->_remoteTarget) {
CPETStarFieldLockMsg lockMsg(1);
lockMsg.execute(_petControl->_remoteTarget);
}
break;
- case 2:
- if (index < 2 && _markerStates[index] >= 2) {
+ case MS_HIGHLIGHTED:
+ // Marker is locked in. If the most recently locked marker
+ // is clicked on, allow it to be unlocked
+ if (index == 2 || _markerStates[index + 1] != MS_HIGHLIGHTED) {
if (_petControl->_remoteTarget) {
- CPETStarFieldLockMsg lockMsg(1);
+ CPETStarFieldLockMsg lockMsg(0);
lockMsg.execute(_petControl->_remoteTarget);
}
}
diff --git a/engines/titanic/pet_control/pet_starfield.h b/engines/titanic/pet_control/pet_starfield.h
index deefae74c6..a0aa1c762a 100644
--- a/engines/titanic/pet_control/pet_starfield.h
+++ b/engines/titanic/pet_control/pet_starfield.h
@@ -56,11 +56,14 @@ private:
void drawButton(MarkerState state, int index, CScreenManager *screenManager);
/**
- * Mouse down handling for Nav elements
+ * Handles clicking on any of the three locked star LED markers
*/
- bool elementsMouseDown(CMouseButtonDownMsg *msg);
+ bool markersMouseDown(CMouseButtonDownMsg *msg);
- bool elementMouseButton(int index, CMouseButtonDownMsg *msg, const Rect &rect);
+ /**
+ * Handles clicking on a specific locked star LED marker
+ */
+ bool markerMouseDown(int index, CMouseButtonDownMsg *msg, const Rect &rect);
public:
CPetStarfield();