DIRECTOR: implement getting the mouseLine

This commit is contained in:
ysj1173886760 2021-07-31 15:52:57 +08:00
parent b60bcbfef7
commit 12dcfbfd72
3 changed files with 20 additions and 1 deletions

View File

@ -651,6 +651,18 @@ int Channel::getMouseItem(int x, int y) {
return ((Graphics::MacText *)_widget)->getMouseItem(x, y);
}
int Channel::getMouseLine(int x, int y) {
if (_sprite->_spriteType != kTextSprite)
return -1;
if (!_widget) {
warning("Channel::getMouseLine getting mouse line on a non-existing widget");
return -1;
}
return ((Graphics::MacText *)_widget)->getMouseLine(x, y);
}
Common::Point Channel::getPosition() {
Common::Point res = _currentPoint;
addRegistrationOffset(res);

View File

@ -75,6 +75,7 @@ public:
int getMouseChar(int x, int y);
int getMouseWord(int x, int y);
int getMouseItem(int x, int y);
int getMouseLine(int x, int y);
public:
Sprite *_sprite;

View File

@ -642,7 +642,13 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
}
break;
case kTheMouseLine:
getTheEntitySTUB(kTheMouseLine);
{
Common::Point pos = g_director->getCurrentWindow()->getMousePos();
uint16 spriteId = score->getSpriteIDFromPos(pos);
Channel *ch = score->getChannelById(spriteId);
d.u.i = ch->getMouseLine(pos.x, pos.y);
d.type = INT;
}
break;
case kTheMouseUp:
d.type = INT;