From 8ee021434236b454faf52995fb102322f2e7bd8f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 2 Apr 2015 08:44:07 -0400 Subject: SHERLOCK: Implemented Inventory::highlight --- engines/sherlock/inventory.cpp | 15 +++++++++++++-- engines/sherlock/inventory.h | 2 +- engines/sherlock/user_interface.cpp | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/engines/sherlock/inventory.cpp b/engines/sherlock/inventory.cpp index ac37e7c587..f7706c9d64 100644 --- a/engines/sherlock/inventory.cpp +++ b/engines/sherlock/inventory.cpp @@ -329,8 +329,19 @@ void Inventory::invCommands(bool slamIt) { } } -void Inventory::doInvLite(int index, byte color) { - // TODO +/** + * Set the highlighting color of a given inventory item + */ +void Inventory::highlight(int index, byte color) { + Screen &screen = *_vm->_screen; + Surface &bb = *screen._backBuffer; + int slot = index - _invIndex; + Graphics::Surface &img = (*_invShapes[slot])[0]._frame; + + bb.fillRect(Common::Rect(8 + slot * 52, 165, (slot + 1) * 52, 194), color); + bb.transBlitFrom(img, Common::Point(6 + slot * 52 + ((47 - img.w) / 2), + 163 + ((33 - img.h) / 2))); + screen.slamArea(8 + slot * 52, 165, 44, 30); } void Inventory::doInvJF() { diff --git a/engines/sherlock/inventory.h b/engines/sherlock/inventory.h index 3c01dc38da..55abc4c960 100644 --- a/engines/sherlock/inventory.h +++ b/engines/sherlock/inventory.h @@ -87,7 +87,7 @@ public: void invCommands(bool slamIt); - void doInvLite(int index, byte color); + void highlight(int index, byte color); void doInvJF(); }; diff --git a/engines/sherlock/user_interface.cpp b/engines/sherlock/user_interface.cpp index 74142ab80e..6f60049e31 100644 --- a/engines/sherlock/user_interface.cpp +++ b/engines/sherlock/user_interface.cpp @@ -789,11 +789,11 @@ void UserInterface::doInvControl() { if (_oldSelector != -1) { // Un-highlight if (_oldSelector >= inv._invIndex && _oldSelector < (inv._invIndex + 6)) - inv.doInvLite(_oldSelector, BUTTON_MIDDLE); + inv.highlight(_oldSelector, BUTTON_MIDDLE); } if (_selector != -1) - inv.doInvLite(_selector, 235); + inv.highlight(_selector, 235); _oldSelector = _selector; } -- cgit v1.2.3