[Scummvm-cvs-logs] scummvm master -> 05ba90b7e79d17660e6103cf5d5a43eb5760e349

dreammaster dreammaster at scummvm.org
Thu Jun 25 14:29:52 CEST 2015


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
05ba90b7e7 SHERLOCK: RT: Implemented shaded background for dialogs


Commit: 05ba90b7e79d17660e6103cf5d5a43eb5760e349
    https://github.com/scummvm/scummvm/commit/05ba90b7e79d17660e6103cf5d5a43eb5760e349
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-06-25T08:28:49-04:00

Commit Message:
SHERLOCK: RT: Implemented shaded background for dialogs

Changed paths:
    engines/sherlock/tattoo/tattoo_user_interface.cpp
    engines/sherlock/tattoo/tattoo_user_interface.h
    engines/sherlock/tattoo/widget_base.cpp
    engines/sherlock/tattoo/widget_base.h
    engines/sherlock/tattoo/widget_tooltip.h



diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp
index 7e4b86f..e3df27d 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 f612696..5b623e7 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 cd4f8e0..b9bc0b1 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 &currentScroll = 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 3455074..4bd75a5 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 3003831..32e54ed 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() {}






More information about the Scummvm-git-logs mailing list