diff options
author | Paul Gilbert | 2015-06-25 08:28:49 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-06-25 08:28:49 -0400 |
commit | 05ba90b7e79d17660e6103cf5d5a43eb5760e349 (patch) | |
tree | e7fb7dfd2a607cd021cd83dc933e194f363e2a10 /engines/sherlock/tattoo | |
parent | 7f57db2a26cb5192c3e010afb5d48f670353a524 (diff) | |
download | scummvm-rg350-05ba90b7e79d17660e6103cf5d5a43eb5760e349.tar.gz scummvm-rg350-05ba90b7e79d17660e6103cf5d5a43eb5760e349.tar.bz2 scummvm-rg350-05ba90b7e79d17660e6103cf5d5a43eb5760e349.zip |
SHERLOCK: RT: Implemented shaded background for dialogs
Diffstat (limited to 'engines/sherlock/tattoo')
-rw-r--r-- | engines/sherlock/tattoo/tattoo_user_interface.cpp | 9 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_user_interface.h | 6 | ||||
-rw-r--r-- | engines/sherlock/tattoo/widget_base.cpp | 22 | ||||
-rw-r--r-- | engines/sherlock/tattoo/widget_base.h | 5 | ||||
-rw-r--r-- | engines/sherlock/tattoo/widget_tooltip.h | 5 |
5 files changed, 35 insertions, 12 deletions
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp index 7e4b86fd32..e3df27dfbe 100644 --- a/engines/sherlock/tattoo/tattoo_user_interface.cpp +++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp @@ -350,10 +350,6 @@ void TattooUserInterface::doScroll() { } } -void TattooUserInterface::drawGrayAreas() { - // TODO -} - void TattooUserInterface::doStandardControl() { TattooEngine &vm = *(TattooEngine *)_vm; Events &events = *_vm->_events; @@ -612,7 +608,8 @@ void TattooUserInterface::setupBGArea(const byte cMap[PALETTE_SIZE]) { // to darker as the palette numbers go up. The last palette entry in that run is specified by _bgColor byte *p = &_lookupTable[0]; for (int idx = 0; idx < PALETTE_COUNT; ++idx) - *p++ = BG_GREYSCALE_RANGE_END - (cMap[idx * 3] * 30 + cMap[idx * 3 + 1] * 59 + cMap[idx * 3 + 2] * 11) / 480; + *p++ = BG_GREYSCALE_RANGE_END - ((cMap[idx * 3] / 4) * 30 + (cMap[idx * 3 + 1] / 4) * 59 + + (cMap[idx * 3 + 2] / 4) * 11) / 480; // If we're going to a scene with a haze special effect, initialize the translate table to lighten the colors if (_mask != nullptr) { @@ -822,6 +819,8 @@ void TattooUserInterface::makeBGArea(const Common::Rect &r) { for (int xp = r.left; xp < r.right; ++xp, ++ptr) *ptr = _lookupTable[*ptr]; } + + screen.slamRect(r); } void TattooUserInterface::drawDialogRect(Surface &s, const Common::Rect &r, bool raised) { diff --git a/engines/sherlock/tattoo/tattoo_user_interface.h b/engines/sherlock/tattoo/tattoo_user_interface.h index f612696295..5b623e74ba 100644 --- a/engines/sherlock/tattoo/tattoo_user_interface.h +++ b/engines/sherlock/tattoo/tattoo_user_interface.h @@ -43,7 +43,6 @@ class WidgetBase; class TattooUserInterface : public UserInterface { friend class WidgetBase; private: - Common::Array<Common::Rect> _grayAreas; int _lockoutTimer; SaveMode _fileMode; int _exitZone; @@ -58,11 +57,6 @@ private: byte _lookupTable1[PALETTE_COUNT]; private: /** - * Draws designated areas of the screen that are meant to be grayed out using grayscale colors - */ - void drawGrayAreas(); - - /** * Handle any input when we're in standard mode (with no windows open) */ void doStandardControl(); diff --git a/engines/sherlock/tattoo/widget_base.cpp b/engines/sherlock/tattoo/widget_base.cpp index cd4f8e08a2..b9bc0b12d5 100644 --- a/engines/sherlock/tattoo/widget_base.cpp +++ b/engines/sherlock/tattoo/widget_base.cpp @@ -79,8 +79,11 @@ void WidgetBase::draw() { Common::Rect bounds = _bounds; bounds.translate(currentScroll.x, currentScroll.y); - // Copy any area to be drawn on from the secondary back buffer, and then draw surface on top + // Draw the background for the widget screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(bounds.left, bounds.top), bounds); + drawBackground(); + + // Draw the widget onto the back buffer and then slam it to the screen screen._backBuffer1.transBlitFrom(_surface, Common::Point(bounds.left, bounds.top)); screen.blitFrom(screen._backBuffer1, Common::Point(_bounds.left, _bounds.top), bounds); @@ -89,6 +92,23 @@ void WidgetBase::draw() { } } +void WidgetBase::drawBackground() { + TattooEngine &vm = *(TattooEngine *)_vm; + Screen &screen = *_vm->_screen; + TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui; + + Common::Rect bounds = _bounds; + const Common::Point ¤tScroll = getCurrentScroll(); + bounds.translate(currentScroll.x, currentScroll.y); + + if (vm._transparentMenus) { + ui.makeBGArea(bounds); + } else { + bounds.grow(-3); + screen._backBuffer1.fillRect(bounds, MENU_BACKGROUND); + } +} + Common::String WidgetBase::splitLines(const Common::String &str, Common::StringArray &lines, int maxWidth, uint maxLines) { Talk &talk = *_vm->_talk; const char *strP = str.c_str(); diff --git a/engines/sherlock/tattoo/widget_base.h b/engines/sherlock/tattoo/widget_base.h index 3455074964..4bd75a50d0 100644 --- a/engines/sherlock/tattoo/widget_base.h +++ b/engines/sherlock/tattoo/widget_base.h @@ -68,6 +68,11 @@ protected: * Returns the current scroll position */ virtual const Common::Point &getCurrentScroll() const; + + /** + * Handle drawing the background on the area the widget is going to cover + */ + virtual void drawBackground(); public: WidgetBase(SherlockEngine *vm); virtual ~WidgetBase() {} diff --git a/engines/sherlock/tattoo/widget_tooltip.h b/engines/sherlock/tattoo/widget_tooltip.h index 3003831882..32e54ed2bb 100644 --- a/engines/sherlock/tattoo/widget_tooltip.h +++ b/engines/sherlock/tattoo/widget_tooltip.h @@ -34,6 +34,11 @@ class SherlockEngine; namespace Tattoo { class WidgetTooltip: public WidgetBase { +protected: + /** + * Overriden from base class, since tooltips have a completely transparent background + */ + virtual void drawBackground() {} public: WidgetTooltip(SherlockEngine *vm); virtual ~WidgetTooltip() {} |