Skip to content

Commit

Permalink
ACCESS: Fix cursor positioning in scrolled screens, and background re…
Browse files Browse the repository at this point in the history
…stores
  • Loading branch information
dreammaster committed Aug 23, 2014
1 parent 44436de commit 6343ff7
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 9 deletions.
17 changes: 10 additions & 7 deletions engines/access/amazon/amazon_room.cpp
Expand Up @@ -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;
Expand All @@ -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();
}
}
Expand Down
3 changes: 2 additions & 1 deletion engines/access/bubble_box.cpp
Expand Up @@ -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");
}

Expand Down Expand Up @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions engines/access/events.cpp
Expand Up @@ -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
4 changes: 4 additions & 0 deletions engines/access/events.h
Expand Up @@ -105,6 +105,10 @@ class EventsManager {
void debounceLeft();

void waitKeyMouse();

Common::Point &getMousePos() { return _mousePos; }

Common::Point calcRawMouse();
};

} // End of namespace Access
Expand Down
4 changes: 3 additions & 1 deletion engines/access/room.cpp
Expand Up @@ -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();
Expand Down

0 comments on commit 6343ff7

Please sign in to comment.