DIRECTOR: Properly discover sprite cursors

We canot just use getSpriteIDFromPos, as Director gets the cursor from the
topmost sprite that has a non-empty cursor.
This commit is contained in:
Nathanael Gentry 2020-08-19 10:37:43 -04:00
parent c99abbc645
commit d7ec21cbeb
3 changed files with 10 additions and 4 deletions

View File

@ -112,7 +112,7 @@ bool Movie::processEvent(Common::Event &event) {
_lastEventTime = g_director->getMacTicks();
_lastRollTime = _lastEventTime;
sc->renderCursor(sc->getSpriteIDFromPos(pos));
sc->renderCursor(pos);
if (_currentDraggedChannel) {
if (_currentDraggedChannel->_sprite->_moveable) {
@ -176,7 +176,7 @@ bool Movie::processEvent(Common::Event &event) {
}
registerEvent(kEventMouseUp, spriteId);
sc->renderCursor(sc->getSpriteIDFromPos(pos));
sc->renderCursor(pos);
return true;
case Common::EVENT_KEYDOWN:

View File

@ -509,7 +509,13 @@ void Score::renderSprites(uint16 frameId, RenderMode mode) {
}
}
void Score::renderCursor(uint spriteId) {
void Score::renderCursor(Common::Point pos) {
uint spriteId = 0;
for (int i = _channels.size() - 1; i >=0; i--)
if (_channels[i]->isMouseIn(pos) && !_channels[i]->_cursor.isEmpty())
spriteId = i;
if (_channels[spriteId]->_cursor.isEmpty()) {
if (_currentCursor) {
_vm->_wm->popCursor();

View File

@ -108,7 +108,7 @@ public:
bool renderTransition(uint16 frameId);
void renderFrame(uint16 frameId, RenderMode mode = kRenderModeNormal);
void renderSprites(uint16 frameId, RenderMode mode = kRenderModeNormal);
void renderCursor(uint spriteId);
void renderCursor(Common::Point pos);
private:
void update();