From 2665194e6feb99af15937003d2e89e9e0f87b446 Mon Sep 17 00:00:00 2001 From: Arnaud Boutonné Date: Sat, 8 Jan 2011 16:56:52 +0000 Subject: 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 --- engines/hugo/mouse.cpp | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) (limited to 'engines/hugo/mouse.cpp') 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 -- cgit v1.2.3