diff options
author | Paul Gilbert | 2014-05-21 22:16:21 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-05-21 22:16:21 -0400 |
commit | 12a70d2ce14531ba983fa39f3831317eb7e17e7d (patch) | |
tree | 59eca0b41c31b70db193a1afc3f81d70d8185fe5 /engines | |
parent | 69acf34cba882ba3be28b780a871c055c7ca45a2 (diff) | |
download | scummvm-rg350-12a70d2ce14531ba983fa39f3831317eb7e17e7d.tar.gz scummvm-rg350-12a70d2ce14531ba983fa39f3831317eb7e17e7d.tar.bz2 scummvm-rg350-12a70d2ce14531ba983fa39f3831317eb7e17e7d.zip |
MADS: Fix issues with inventory list scrolling when it shouldn't
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mads/user_interface.cpp | 103 |
1 files changed, 51 insertions, 52 deletions
diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 3fab30a0ab..68f578489e 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -497,62 +497,61 @@ void UserInterface::updateInventoryScroller() { _scrollbarActive = SCROLLBAR_NONE; - if (( - (screenObjects._category == CAT_INV_SCROLLER) || - // FIXME: This scrolls the inventory up when selecting verbs or attempting to combine items - false/*(screenObjects._category != CAT_INV_SCROLLER && _scrollbarOldActive == SCROLLBAR_ELEVATOR)*/ - ) && (_vm->_events->_mouseStatusCopy || _vm->_easyMouse)) { - if ((_vm->_events->_mouseClicked || (_vm->_easyMouse && !_vm->_events->_mouseStatusCopy)) - && (screenObjects._category == CAT_INV_SCROLLER)) - _scrollbarStrokeType = (ScrollbarActive)screenObjects._spotId; - - if (screenObjects._spotId == _scrollbarStrokeType || _scrollbarOldActive == SCROLLBAR_ELEVATOR) { - _scrollbarActive = _scrollbarStrokeType; - uint32 currentMilli = g_system->getMillis(); - uint32 timeInc = _scrollbarQuickly ? 100 : 380; - - if (_vm->_events->_mouseStatus && (_scrollbarMilliTime + timeInc) <= currentMilli) { - _scrollbarQuickly = _vm->_events->_vD2 < 1; - _scrollbarMilliTime = currentMilli; - - switch (_scrollbarStrokeType) { - case SCROLLBAR_UP: - // Scroll up - if (_inventoryTopIndex > 0 && inventoryList.size() > 0) { - --_inventoryTopIndex; - _inventoryChanged = true; + if ((screenObjects._category == CAT_INV_SCROLLER) || (screenObjects._category != CAT_INV_SCROLLER + && _scrollbarOldActive == SCROLLBAR_ELEVATOR && _vm->_events->_mouseStatusCopy)) { + if (_vm->_events->_mouseStatusCopy || _vm->_easyMouse) { + if ((_vm->_events->_mouseClicked || (_vm->_easyMouse && !_vm->_events->_mouseStatusCopy)) + && (screenObjects._category == CAT_INV_SCROLLER)) + _scrollbarStrokeType = (ScrollbarActive)screenObjects._spotId; + + if (screenObjects._spotId == _scrollbarStrokeType || _scrollbarOldActive == SCROLLBAR_ELEVATOR) { + _scrollbarActive = _scrollbarStrokeType; + uint32 currentMilli = g_system->getMillis(); + uint32 timeInc = _scrollbarQuickly ? 100 : 380; + + if (_vm->_events->_mouseStatus && (_scrollbarMilliTime + timeInc) <= currentMilli) { + _scrollbarQuickly = _vm->_events->_vD2 < 1; + _scrollbarMilliTime = currentMilli; + + switch (_scrollbarStrokeType) { + case SCROLLBAR_UP: + // Scroll up + if (_inventoryTopIndex > 0 && inventoryList.size() > 0) { + --_inventoryTopIndex; + _inventoryChanged = true; + } + break; + + case SCROLLBAR_DOWN: + // Scroll down + if (_inventoryTopIndex < ((int)inventoryList.size() - 1) && inventoryList.size() > 1) { + ++_inventoryTopIndex; + _inventoryChanged = true; + } + break; + + case SCROLLBAR_ELEVATOR: { + // Inventory slider + int newIndex = CLIP((int)_vm->_events->currentPos().y - 170, 0, 17) + * inventoryList.size() / 10; + if (newIndex >= (int)inventoryList.size()) + newIndex = inventoryList.size() - 1; + + if (inventoryList.size() > 0) { + _inventoryChanged = newIndex != _inventoryTopIndex; + _inventoryTopIndex = newIndex; + } + break; } - break; - case SCROLLBAR_DOWN: - // Scroll down - if (_inventoryTopIndex < ((int)inventoryList.size() - 1) && inventoryList.size() > 1) { - ++_inventoryTopIndex; - _inventoryChanged = true; - } - break; - - case SCROLLBAR_ELEVATOR: { - // Inventory slider - int newIndex = CLIP((int)_vm->_events->currentPos().y - 170, 0, 17) - * inventoryList.size() / 10; - if (newIndex >= (int)inventoryList.size()) - newIndex = inventoryList.size() - 1; - - if (inventoryList.size() > 0) { - _inventoryChanged = newIndex != _inventoryTopIndex; - _inventoryTopIndex = newIndex; + default: + break; } - break; - } - default: - break; - } - - if (_inventoryChanged) { - int dummy; - updateSelection(CAT_INV_LIST, 0, &dummy); + if (_inventoryChanged) { + int dummy; + updateSelection(CAT_INV_LIST, 0, &dummy); + } } } } |