mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-21 17:45:39 +00:00
TITANIC: Cleanup and fixes for clicking on Starfield marker LEDs
This commit is contained in:
parent
1e0a22db5c
commit
74c401c926
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user