From 6343ff72c462219afb2f11fea69539725794efd6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Aug 2014 10:21:50 -0400 Subject: ACCESS: Fix cursor positioning in scrolled screens, and background restores --- engines/access/amazon/amazon_room.cpp | 17 ++++++++++------- engines/access/bubble_box.cpp | 3 ++- engines/access/events.cpp | 12 ++++++++++++ engines/access/events.h | 4 ++++ engines/access/room.cpp | 4 +++- 5 files changed, 31 insertions(+), 9 deletions(-) (limited to 'engines/access') diff --git a/engines/access/amazon/amazon_room.cpp b/engines/access/amazon/amazon_room.cpp index bc0f605d8e..c0076fd78a 100644 --- a/engines/access/amazon/amazon_room.cpp +++ b/engines/access/amazon/amazon_room.cpp @@ -146,10 +146,13 @@ void AmazonRoom::roomMenu() { } void AmazonRoom::mainAreaClick() { + Common::Point &mousePos = _vm->_events->_mousePos; + Common::Point pt = _vm->_events->calcRawMouse(); + if (_selectCommand == -1) { if (_vm->_player->_roomNumber == 42 || _vm->_player->_roomNumber == 44 || _vm->_player->_roomNumber == 31 || _vm->_player->_roomNumber == 29) { - switch (checkBoxes1(_vm->_events->_mousePos)) { + switch (checkBoxes1(pt)) { case 0: _game->_jasMayaFlag = 0; return; @@ -161,13 +164,13 @@ void AmazonRoom::mainAreaClick() { } } - _vm->_player->_moveTo = _vm->_events->_mousePos; + _vm->_player->_moveTo = pt; _vm->_player->_playerMove = true; - } else if (_vm->_events->_mousePos.x >= _vm->_screen->_windowXAdd && - _vm->_events->_mousePos.x <= _vm->_screen->_vWindowBytesWide && - _vm->_events->_mousePos.y >= _vm->_screen->_windowYAdd && - _vm->_events->_mousePos.y <= _vm->_screen->_vWindowLinesTall) { - if (checkBoxes1(_vm->_events->_mousePos) >= 0) { + } else if (mousePos.x >= _vm->_screen->_windowXAdd && + mousePos.x <= _vm->_screen->_vWindowBytesWide && + mousePos.y >= _vm->_screen->_windowYAdd && + mousePos.y <= _vm->_screen->_vWindowLinesTall) { + if (checkBoxes1(pt) >= 0) { checkBoxes3(); } } diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp index 21e104028c..a709fbd92d 100644 --- a/engines/access/bubble_box.cpp +++ b/engines/access/bubble_box.cpp @@ -236,7 +236,7 @@ void BubbleBox::doBox(int item, int box) { screen.plotImage(icons, (_type == TYPE_4) ? 73 : 23, Common::Point(xp, yp)); if (_type == TYPE_4) { - // Further stuff + // Further stuff for filename dialog error("TODO: Box type 4"); } @@ -264,6 +264,7 @@ void BubbleBox::doBox(int item, int box) { fonts._printStart = printStart; _charCol = charCol; _rowOff = rowOff; + _vm->_screen->restoreScreen(); // Free icons data delete icons; diff --git a/engines/access/events.cpp b/engines/access/events.cpp index 1afc5515b0..78bbdbf1ea 100644 --- a/engines/access/events.cpp +++ b/engines/access/events.cpp @@ -217,4 +217,16 @@ void EventsManager::waitKeyMouse() { debounceLeft(); } +Common::Point EventsManager::calcRawMouse() { + Screen &screen = *_vm->_screen; + Common::Point pt; + pt.x = _mousePos.x - screen._windowXAdd + + (screen._scrollCol * TILE_WIDTH) + screen._scrollX; + pt.y = _mousePos.y - screen._screenYOff - screen._windowYAdd + + (screen._scrollRow * TILE_HEIGHT) + screen._scrollY; + + return pt; +} + + } // End of namespace Access diff --git a/engines/access/events.h b/engines/access/events.h index f7a5e9ce53..2ced71f50e 100644 --- a/engines/access/events.h +++ b/engines/access/events.h @@ -105,6 +105,10 @@ public: void debounceLeft(); void waitKeyMouse(); + + Common::Point &getMousePos() { return _mousePos; } + + Common::Point calcRawMouse(); }; } // End of namespace Access diff --git a/engines/access/room.cpp b/engines/access/room.cpp index 225cd80548..b5f8554612 100644 --- a/engines/access/room.cpp +++ b/engines/access/room.cpp @@ -556,8 +556,10 @@ int Room::checkBoxes2(const Common::Point &pt, int start, int count) { } void Room::checkBoxes3() { + Common::Point pt = _vm->_events->calcRawMouse(); + for (uint start = 0; start < _plotter._blocks.size(); ++start) { - if (_plotter._blocks[start].contains(_vm->_events->_mousePos)) { + if (_plotter._blocks[start].contains(pt)) { _plotter._blockIn = start; if (!(validateBox(start) & 0x80)) { _vm->_events->debounceLeft(); -- cgit v1.2.3