diff options
author | Arnaud Boutonné | 2011-01-08 16:56:52 +0000 |
---|---|---|
committer | Arnaud Boutonné | 2011-01-08 16:56:52 +0000 |
commit | 2665194e6feb99af15937003d2e89e9e0f87b446 (patch) | |
tree | b8aa548ffa7e87356b47be87e8b26b39826c2538 /engines/hugo/mouse.cpp | |
parent | b24aab30527feb67f32e0f7a43dc8be4eb0fc0da (diff) | |
download | scummvm-rg350-2665194e6feb99af15937003d2e89e9e0f87b446.tar.gz scummvm-rg350-2665194e6feb99af15937003d2e89e9e0f87b446.tar.bz2 scummvm-rg350-2665194e6feb99af15937003d2e89e9e0f87b446.zip |
HUGO: Merge inventory object and mouse cursor when selected
- Merge inventory object and mouse cursor into a new mouse cursor (looks better)
- Use 16 color mouse pointer
- Clean-up
svn-id: r55167
Diffstat (limited to 'engines/hugo/mouse.cpp')
-rw-r--r-- | engines/hugo/mouse.cpp | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/engines/hugo/mouse.cpp b/engines/hugo/mouse.cpp index 4ed6384b2a..0855832ab2 100644 --- a/engines/hugo/mouse.cpp +++ b/engines/hugo/mouse.cpp @@ -114,9 +114,9 @@ void MouseHandler::processRightClick(int16 objId, int16 cx, int16 cy) { // Check if this was over iconbar if (gameStatus.inventoryState == I_ACTIVE && cy < INV_DY + DIBOFF_Y) { // Clicked over iconbar object if (gameStatus.inventoryObjId == -1) - gameStatus.inventoryObjId = objId; // Not using so select new object + _vm->_screen->selectInventoryObjId(objId); else if (gameStatus.inventoryObjId == objId) - gameStatus.inventoryObjId = -1; // Same icon - deselect it + _vm->_screen->resetInventoryObjId(); else _vm->_object->useObject(objId); // Use status.objid on object } else { // Clicked over viewport object @@ -195,7 +195,7 @@ void MouseHandler::processLeftClick(int16 objId, int16 cx, int16 cy) { } // Get rid of any attached icon - gameStatus.inventoryObjId = -1; + _vm->_screen->resetInventoryObjId(); } break; default: // Look at an icon or object @@ -248,32 +248,6 @@ void MouseHandler::mouseHandler() { if (cx < 0 || cx > XPIX || cy < DIBOFF_Y || cy > VIEW_DY + DIBOFF_Y) return; - // Display dragged inventory icon if one currently selected - if (gameStatus.inventoryObjId != -1) { - // Find index of icon - int16 iconId; // Find index of dragged icon - for (iconId = 0; iconId < _vm->_maxInvent; iconId++) { - if (gameStatus.inventoryObjId == _vm->_invent[iconId]) - break; - } - - // Compute source coordinates in dib_u - int16 ux = (iconId + NUM_ARROWS) * INV_DX % XPIX; - int16 uy = (iconId + NUM_ARROWS) * INV_DX / XPIX * INV_DY; - - // Compute destination coordinates in dib_a - int iconx = cx + IX_OFF; - int icony = cy + IY_OFF; - iconx = MAX(iconx, 0); // Keep within dib_a bounds - iconx = MIN(iconx, XPIX - INV_DX); - icony = MAX(icony, 0); - icony = MIN(icony, YPIX - INV_DY); - - // Copy the icon and add to display list - _vm->_screen->moveImage(_vm->_screen->getGUIBuffer(), ux, uy, INV_DX, INV_DY, XPIX, _vm->_screen->getFrontBuffer(), iconx, icony, XPIX); - _vm->_screen->displayList(D_ADD, iconx, icony, INV_DX, INV_DY); - } - int16 objId = -1; // Current source object // Process cursor over an object or icon if (gameStatus.inventoryState == I_ACTIVE) { // Check inventory icon bar first |