From b0c1e6efaa09b855d18ee81edc2a79243b5b91b2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 19 Jul 2015 19:23:16 -0400 Subject: SHERLOCK: RT: Implement using items on scene objects --- engines/sherlock/tattoo/tattoo_user_interface.cpp | 1 + engines/sherlock/tattoo/widget_inventory.cpp | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) (limited to 'engines/sherlock/tattoo') diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp index bffdb550cf..597208078b 100644 --- a/engines/sherlock/tattoo/tattoo_user_interface.cpp +++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp @@ -583,6 +583,7 @@ void TattooUserInterface::putMessage(const char *formatStr, ...) { va_end(args); // Open the message widget + _menuMode = MESSAGE_MODE; _messageWidget.load(str, 25); _messageWidget.summonWindow(); } diff --git a/engines/sherlock/tattoo/widget_inventory.cpp b/engines/sherlock/tattoo/widget_inventory.cpp index 9afe841fa9..170fb02481 100644 --- a/engines/sherlock/tattoo/widget_inventory.cpp +++ b/engines/sherlock/tattoo/widget_inventory.cpp @@ -430,10 +430,10 @@ void WidgetInventoryVerbs::handleEvents() { ImageFrame &imgFrame = (*inv._invShapes[_owner->_invSelect - inv._invIndex])[0]; events.setCursor(ARROW, imgFrame._frame); - // Close the inventory dialog as well, then add the tooltip directly to the UI - // so that it will receive events even though the inventory dialog is now closed - _owner->close(); - _owner->_tooltipWidget.summonWindow(); + // Close the inventory dialog without banishing it, so it can keep getting events + // to handle tooltips and actually making the selection of what object to use them item on + inv.freeInv(); + _owner->_surface.free(); } } } @@ -607,10 +607,7 @@ void WidgetInventory::handleEvents() { if (_invVerbMode == 3) { // Selecting object after inventory verb has been selected _tooltipWidget.banishWindow(); - inv.freeInv(); - - ui._menuMode = scene._labTableScene ? LAB_MODE : STD_MODE; - events.clearEvents(); + close(); if (ui._keyState.keycode != Common::KEYCODE_ESCAPE) { // If user pointed at an item, use the selected inventory item with this item @@ -641,8 +638,6 @@ void WidgetInventory::handleEvents() { } else if ((_outsideMenu && !_bounds.contains(mousePos)) || ui._keyState.keycode == Common::KEYCODE_ESCAPE) { // Want to close the window (clicked outside of it). So close the window and return to Standard close(); - events.setCursor(ARROW); - ui._menuMode = scene._labTableScene ? LAB_MODE : STD_MODE; } else if (_bounds.contains(mousePos)) { // Mouse button was released inside the inventory window @@ -751,10 +746,15 @@ void WidgetInventory::erase() { void WidgetInventory::close() { Events &events = *_vm->_events; Inventory &inv = *_vm->_inventory; + TattooScene &scene = *(TattooScene *)_vm->_scene; + TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui; banishWindow(); inv.freeInv(); events.clearEvents(); + + events.setCursor(ARROW); + ui._menuMode = scene._labTableScene ? LAB_MODE : STD_MODE; } } // End of namespace Tattoo -- cgit v1.2.3