SHERLOCK: RT: Fix display of verb menu in wide-screen scenes

This commit is contained in:
Paul Gilbert 2015-07-07 21:25:55 -04:00
parent 47aa40104d
commit ed2caf7cd6
7 changed files with 31 additions and 18 deletions

View File

@ -200,6 +200,10 @@ Common::Point Events::mousePos() const {
return g_system->getEventManager()->getMousePos();
}
Common::Point Events::sceneMousePos() const {
return mousePos() + _vm->_screen->_currentScroll;
}
Common::KeyState Events::getKey() {
return _pendingKeys.pop();
}

View File

@ -129,8 +129,19 @@ public:
*/
Common::Point mousePos() const;
/**
* Get the current mouse position within the scene, adjusted by the scroll position
*/
Common::Point sceneMousePos() const;
/**
* Return the current game frame number
*/
uint32 getFrameCounter() const { return _frameCounter; }
/**
* Returns true if there's a pending keyboard key
*/
bool kbHit() const { return !_pendingKeys.empty(); }
/**

View File

@ -355,7 +355,8 @@ void Screen::slamArea(int16 xp, int16 yp, int16 width, int16 height) {
void Screen::slamRect(const Common::Rect &r) {
if (r.width() && r.height() > 0) {
Common::Rect srcRect = r, destRect = r;
srcRect.translate(_currentScroll.x, _currentScroll.y);
destRect.translate(-_currentScroll.x, -_currentScroll.y);
if (destRect.left < 0) {
srcRect.left += -destRect.left;

View File

@ -305,8 +305,7 @@ void TattooMap::drawMapIcons() {
void TattooMap::checkMapNames(bool slamIt) {
Events &events = *_vm->_events;
Screen &screen = *_vm->_screen;
Common::Point mapPos = events.mousePos() + screen._currentScroll;
Common::Point mapPos = events.sceneMousePos();
// See if the mouse is pointing at any of the map locations
_bgFound = -1;

View File

@ -230,8 +230,7 @@ void TattooUserInterface::handleInput() {
TattooEngine &vm = *(TattooEngine *)_vm;
Events &events = *_vm->_events;
TattooScene &scene = *(TattooScene *)_vm->_scene;
Screen &screen = *_vm->_screen;
Common::Point mousePos = events.mousePos() + screen._currentScroll;
Common::Point mousePos = events.sceneMousePos();
events.pollEventsAndWait();
_keyState.keycode = Common::KEYCODE_INVALID;
@ -532,14 +531,13 @@ void TattooUserInterface::doLabControl() {
void TattooUserInterface::displayObjectNames() {
Events &events = *_vm->_events;
Scene &scene = *_vm->_scene;
Screen &screen = *_vm->_screen;
Common::Point scenePos = events.mousePos() + screen._currentScroll;
Common::Point mousePos = events.sceneMousePos();
_arrowZone = -1;
if (_bgFound == -1 || scene._currentScene == 90) {
for (uint idx = 0; idx < scene._exits.size() && _arrowZone == -1; ++idx) {
Exit &exit = scene._exits[idx];
if (exit.contains(scenePos))
if (exit.contains(mousePos))
_arrowZone = idx;
}
}

View File

@ -141,12 +141,14 @@ Common::String WidgetBase::splitLines(const Common::String &str, Common::StringA
}
void WidgetBase::restrictToScreen() {
Screen &screen = *_vm->_screen;
if (_bounds.left < 0)
_bounds.moveTo(0, _bounds.top);
if (_bounds.top < 0)
_bounds.moveTo(_bounds.left, 0);
if (_bounds.right > SHERLOCK_SCREEN_WIDTH)
_bounds.moveTo(SHERLOCK_SCREEN_WIDTH - _bounds.width(), _bounds.top);
if (_bounds.right > screen._backBuffer1.w())
_bounds.moveTo(screen._backBuffer1.w() - _bounds.width(), _bounds.top);
if (_bounds.bottom > SHERLOCK_SCREEN_HEIGHT)
_bounds.moveTo(_bounds.left, SHERLOCK_SCREEN_HEIGHT - _bounds.height());
}
@ -243,7 +245,7 @@ void WidgetBase::drawScrollBar(int index, int pageSize, int count) {
void WidgetBase::handleScrollbarEvents(int index, int pageSize, int count) {
Events &events = *_vm->_events;
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
Common::Point mousePos = events.mousePos();
Common::Point mousePos = events.sceneMousePos();
// If they have selected the sollbar, return with the Scroll Bar Still selected
if (ui._scrollHighlight == 3)

View File

@ -38,10 +38,10 @@ WidgetVerbs::WidgetVerbs(SherlockEngine *vm) : WidgetBase(vm) {
void WidgetVerbs::load(bool objectsOn) {
Events &events = *_vm->_events;
TattooPeople &people = *(TattooPeople *)_vm->_people;
Talk &talk = *_vm->_talk;
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
TattooPeople &people = *(TattooPeople *)_vm->_people;
Common::Point mousePos = events.mousePos();
Common::Point mousePos = events.sceneMousePos();
bool isWatson = false;
if (talk._talkToAbort)
@ -153,11 +153,9 @@ void WidgetVerbs::handleEvents() {
FixedText &fixedText = *_vm->_fixedText;
People &people = *_vm->_people;
TattooScene &scene = *(TattooScene *)_vm->_scene;
Screen &screen = *_vm->_screen;
Talk &talk = *_vm->_talk;
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
Common::Point mousePos = events.mousePos();
Common::Point scenePos = mousePos + screen._currentScroll;
Common::Point mousePos = events.sceneMousePos();
bool noDesc = false;
Common::String strLook = fixedText.getText(kFixedText_Look);
@ -183,7 +181,7 @@ void WidgetVerbs::handleEvents() {
if (events._rightReleased) {
// Reset the selected shape to what was clicked on
ui._bgFound = scene.findBgShape(scenePos);
ui._bgFound = scene.findBgShape(mousePos);
ui._personFound = ui._bgFound >= 1000;
Object *_bgShape = ui._personFound ? nullptr : &scene._bgShapes[ui._bgFound];
@ -285,7 +283,7 @@ void WidgetVerbs::handleEvents() {
void WidgetVerbs::highlightVerbControls() {
Events &events = *_vm->_events;
Screen &screen = *_vm->_screen;
Common::Point mousePos = events.mousePos();
Common::Point mousePos = events.sceneMousePos();
// Get highlighted verb
_selector = -1;