[Scummvm-git-logs] scummvm master -> 6e04b361b242a8c50ad4e5c7f757a00b167e27e3

stevenhoefel stevenhoefel at hotmail.com
Fri Jan 13 02:17:45 CET 2017


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:
6e04b361b2 DIRECTOR: Implement Shape Patterns and Borders for D3.


Commit: 6e04b361b242a8c50ad4e5c7f757a00b167e27e3
    https://github.com/scummvm/scummvm/commit/6e04b361b242a8c50ad4e5c7f757a00b167e27e3
Author: stevenhoefel (stevenhoefel at hotmail.com)
Date: 2017-01-13T12:17:36+11:00

Commit Message:
DIRECTOR: Implement Shape Patterns and Borders for D3.

Changed paths:
  A engines/director/graphics.cpp
    engines/director/director.cpp
    engines/director/director.h
    engines/director/frame.cpp
    engines/director/frame.h
    engines/director/module.mk
    engines/director/score.cpp
    engines/director/sprite.cpp
    graphics/macgui/macwindowmanager.cpp
    graphics/macgui/macwindowmanager.h


diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index c216241..fa5ae94 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -51,6 +51,9 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
 	// Setup mixer
 	syncSoundSettings();
 
+	// Load Patterns
+	loadPatterns();
+
 	_sharedCasts = nullptr;
 
 	_currentScore = nullptr;
diff --git a/engines/director/director.h b/engines/director/director.h
index ead1437..3a7a4c8 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -34,7 +34,8 @@ class MacResManager;
 }
 
 namespace Graphics {
-class MacWindowManager;
+class MacWindowManager; 
+typedef Common::Array<byte *> MacPatterns;
 }
 
 namespace Director {
@@ -82,6 +83,8 @@ public:
 	const byte *getPalette() const { return _currentPalette; }
 	uint16 getPaletteColorCount() const { return _currentPaletteLength; }
 	void loadSharedCastsFrom(Common::String filename);
+	void loadPatterns();
+	Graphics::MacPatterns &getPatterns();
 
 	void loadMainArchive();
 	Archive *createArchive();
@@ -134,6 +137,9 @@ private:
 	uint16 _currentPaletteLength;
 	Lingo *_lingo;
 
+	Graphics::MacPatterns _director3Patterns;
+	Graphics::MacPatterns _director3QuickDrawPatterns;
+
 	Common::String _sharedCastFile;
 
 private:
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 8bf71b6..c0e1872 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -202,6 +202,8 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 		else
 			sprite._trails = 0;
 
+		sprite._lineSize = (sprite._flags >> 8) & 0x03;
+
 		sprite._castId = stream->readUint16();
 		sprite._startPoint.y = stream->readUint16();
 		sprite._startPoint.x = stream->readUint16();
@@ -217,9 +219,10 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
 				sprite._unk3 = stream->readUint32();
 		}
 
-		debugC(kDebugLoading, 8, "%03d(%d)[%x,%x,%04x,%d/%d/%d/%d] script:%d",
+		debugC(kDebugLoading, 8, "%03d(%d)[%x,%x,%04x,%d/%d/%d/%d/%d] script:%d",
 			sprite._castId, sprite._enabled, sprite._x1, sprite._x2, sprite._flags,
-			sprite._startPoint.x, sprite._startPoint.y, sprite._width, sprite._height, sprite._scriptId);
+			sprite._startPoint.x, sprite._startPoint.y, sprite._width, sprite._height,
+			sprite._lineSize, sprite._scriptId);
 	}
 }
 
@@ -651,30 +654,38 @@ void Frame::addDrawRect(uint16 spriteId, Common::Rect &rect) {
 	_drawRects.push_back(fi);
 }
 
-void Frame::renderShape(Graphics::ManagedSurface &surface, uint16 spriteID) {
-	Common::Rect r = Common::Rect(_sprites[spriteID]->_startPoint.x,
-		_sprites[spriteID]->_startPoint.y,
-		_sprites[spriteID]->_startPoint.x + _sprites[spriteID]->_width,
-		_sprites[spriteID]->_startPoint.y + _sprites[spriteID]->_height);
+void Frame::renderShape(Graphics::ManagedSurface &surface, uint16 spriteId) {
+	Common::Rect r = Common::Rect(_sprites[spriteId]->_startPoint.x,
+		_sprites[spriteId]->_startPoint.y,
+		_sprites[spriteId]->_startPoint.x + _sprites[spriteId]->_width,
+		_sprites[spriteId]->_startPoint.y + _sprites[spriteId]->_height);
 
-	Graphics::Surface tmpSurface;
+	Graphics::ManagedSurface tmpSurface;
 	tmpSurface.create(r.width(), r.height(), Graphics::PixelFormat::createFormatCLUT8());
-	if (_vm->getVersion() <= 3 && _sprites[spriteID]->_spriteType == 0x0c) {
+	if (_vm->getVersion() <= 3 && _sprites[spriteId]->_spriteType == 0x0c) {
 		tmpSurface.fillRect(Common::Rect(r.width(), r.height()), 255); 
 		tmpSurface.frameRect(Common::Rect(r.width(), r.height()), 0);
 		//TODO: don't override, work out how to display correctly.
-		_sprites[spriteID]->_ink = kInkTypeTransparent;
+		_sprites[spriteId]->_ink = kInkTypeTransparent;
 	} else {
-		tmpSurface.fillRect(Common::Rect(r.width(), r.height()), 0);
+		//No minus one on the pattern here! MacPlotData will do that for us!
+		Graphics::MacPlotData pd(&tmpSurface, &_vm->getPatterns(), _sprites[spriteId]->_castId, 1, _sprites[spriteId]->_backColor);
+		Common::Rect r(r.width(), r.height());
+		Graphics::drawFilledRect(r, _sprites[spriteId]->_foreColor, Graphics::macDrawPixel, &pd);
+	}
+
+	if (_sprites[spriteId]->_lineSize > 0) {
+		for (int rr = 0; rr < (_sprites[spriteId]->_lineSize - 1); rr++)
+			tmpSurface.frameRect(Common::Rect(rr, rr, r.width() - (rr * 2), r.height() - (rr * 2)), 0);
 	}
 
-	switch (_sprites[spriteID]->_ink) {
+	switch (_sprites[spriteId]->_ink) {
 	case kInkTypeCopy:
-		surface.blitFrom(tmpSurface, Common::Point(_sprites[spriteID]->_startPoint.x, _sprites[spriteID]->_startPoint.y));
+		surface.blitFrom(tmpSurface, Common::Point(_sprites[spriteId]->_startPoint.x, _sprites[spriteId]->_startPoint.y));
 		break;
 	case kInkTypeTransparent:
 		// FIXME: is it always white (last entry in pallette)?
-		surface.transBlitFrom(tmpSurface, Common::Point(_sprites[spriteID]->_startPoint.x, _sprites[spriteID]->_startPoint.y), _vm->getPaletteColorCount() - 1);
+		surface.transBlitFrom(tmpSurface, Common::Point(_sprites[spriteId]->_startPoint.x, _sprites[spriteId]->_startPoint.y), _vm->getPaletteColorCount() - 1);
 		break;
 	case kInkTypeBackgndTrans:
 		drawBackgndTransSprite(surface, tmpSurface, r);
@@ -689,19 +700,19 @@ void Frame::renderShape(Graphics::ManagedSurface &surface, uint16 spriteID) {
 		drawReverseSprite(surface, tmpSurface, r);
 		break;
 	default:
-		warning("Unhandled ink type %d", _sprites[spriteID]->_ink);
-		surface.blitFrom(tmpSurface, Common::Point(_sprites[spriteID]->_startPoint.x, _sprites[spriteID]->_startPoint.y));
+		warning("Unhandled ink type %d", _sprites[spriteId]->_ink);
+		surface.blitFrom(tmpSurface, Common::Point(_sprites[spriteId]->_startPoint.x, _sprites[spriteId]->_startPoint.y));
 		break;
 	}
 
-	addDrawRect(spriteID, r);
+	addDrawRect(spriteId, r);
 }
 
 void Frame::renderButton(Graphics::ManagedSurface &surface, uint16 spriteId, uint16 textId) {
 	renderText(surface, spriteId, _vm->getMainArchive()->getResource(MKTAG('S', 'T', 'X', 'T'), textId), true);
 
-	uint16 castID = _sprites[spriteId]->_castId;
-	ButtonCast *button = static_cast<ButtonCast *>(_vm->_currentScore->_casts[castID]);
+	uint16 castId = _sprites[spriteId]->_castId;
+	ButtonCast *button = static_cast<ButtonCast *>(_vm->_currentScore->_casts[castId]);
 
 	uint32 rectLeft = button->initialRect.left;
 	uint32 rectTop = button->initialRect.top;
@@ -799,13 +810,13 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
 }
 
 
-void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID, uint16 castID) {
+void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, uint16 castId) {
 	Common::SeekableSubReadStreamEndian *textStream = NULL;
 
-	if (_vm->_currentScore->_movieArchive->hasResource(MKTAG('S', 'T', 'X', 'T'), castID)) {
-		textStream = _vm->_currentScore->_movieArchive->getResource(MKTAG('S', 'T', 'X', 'T'), castID);
+	if (_vm->_currentScore->_movieArchive->hasResource(MKTAG('S', 'T', 'X', 'T'), castId)) {
+		textStream = _vm->_currentScore->_movieArchive->getResource(MKTAG('S', 'T', 'X', 'T'), castId);
 	} else if (_vm->getSharedSTXT() != nullptr) {
-		textStream = _vm->getSharedSTXT()->getVal(spriteID + 1024);
+		textStream = _vm->getSharedSTXT()->getVal(spriteId + 1024);
 	}
 
 	byte buf[1024];
@@ -813,15 +824,15 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID, uint1
 	textStream->seek(0);
 	Common::hexdump(buf, textStream->size());
 
-	renderText(surface, spriteID, textStream, false);
+	renderText(surface, spriteId, textStream, false);
 }
 
-void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID, Common::SeekableSubReadStreamEndian *textStream, bool isButtonLabel) {
+void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Common::SeekableSubReadStreamEndian *textStream, bool isButtonLabel) {
 	if (textStream == NULL)
 		return;
 
-	uint16 castID = _sprites[spriteID]->_castId;
-	TextCast *textCast = static_cast<TextCast *>(_vm->_currentScore->_casts[castID]);
+	uint16 castId = _sprites[spriteId]->_castId;
+	TextCast *textCast = static_cast<TextCast *>(_vm->_currentScore->_casts[castId]);
 
 	uint32 unk1 = textStream->readUint32();
 	uint32 strLen = textStream->readUint32();
@@ -866,14 +877,14 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID, Commo
 	//uint32 rectLeft = textCast->initialRect.left;
 	//uint32 rectTop = textCast->initialRect.top;
 
-	int x = _sprites[spriteID]->_startPoint.x; // +rectLeft;
-	int y = _sprites[spriteID]->_startPoint.y; // +rectTop;
+	int x = _sprites[spriteId]->_startPoint.x; // +rectLeft;
+	int y = _sprites[spriteId]->_startPoint.y; // +rectTop;
 
-	int height = _sprites[spriteID]->_height;
+	int height = _sprites[spriteId]->_height;
 	if (_vm->getVersion() >= 4 && !isButtonLabel) height = textCast->initialRect.bottom;
 	height += textShadow;
 
-	int width = _sprites[spriteID]->_width;
+	int width = _sprites[spriteId]->_width;
 	if (_vm->getVersion() >= 4 && !isButtonLabel) width = textCast->initialRect.right;
 
 	Graphics::MacFont macFont(textCast->fontId, textCast->fontSize, textCast->textSlant);
@@ -911,7 +922,7 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID, Commo
 		if (textShadow > 0) {
 			if (borderSize == 0) textX += 1;
 			font->drawString(&surface, text, textX + textShadow, textY + textShadow,
-				width, (_sprites[spriteID]->_ink == kInkTypeReverse ? 255 : 0), (Graphics::TextAlign)alignment);
+				width, (_sprites[spriteId]->_ink == kInkTypeReverse ? 255 : 0), (Graphics::TextAlign)alignment);
 			height -= textShadow;
 		}
 	} else {
@@ -920,7 +931,7 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID, Commo
 
 	//TODO: the colour is wrong here... need to determine the correct colour for all versions!
 	font->drawString(&surface, text, textX, textY,
-					 width, (_sprites[spriteID]->_ink == kInkTypeReverse ? 255 : 0), (Graphics::TextAlign)alignment);
+					 width, (_sprites[spriteId]->_ink == kInkTypeReverse ? 255 : 0), (Graphics::TextAlign)alignment);
 
 	if (isButtonLabel)
 		return;
diff --git a/engines/director/frame.h b/engines/director/frame.h
index b71afb7..f21e3a7 100644
--- a/engines/director/frame.h
+++ b/engines/director/frame.h
@@ -124,14 +124,14 @@ private:
 	void playTransition(Score *score);
 	void playSoundChannel();
 	void renderSprites(Graphics::ManagedSurface &surface, bool renderTrail);
-	void renderText(Graphics::ManagedSurface &surface, uint16 spriteId, uint16 castID);
-	void renderText(Graphics::ManagedSurface &surface, uint16 spriteID, Common::SeekableSubReadStreamEndian *textStream, bool isButtonLabel);
-	void renderShape(Graphics::ManagedSurface &surface, uint16 spriteID);
+	void renderText(Graphics::ManagedSurface &surface, uint16 spriteId, uint16 castId);
+	void renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Common::SeekableSubReadStreamEndian *textStream, bool isButtonLabel);
+	void renderShape(Graphics::ManagedSurface &surface, uint16 spriteId);
 	void renderButton(Graphics::ManagedSurface &surface, uint16 spriteId, uint16 textId);
 	void readPaletteInfo(Common::SeekableSubReadStreamEndian &stream);
 	void readSprite(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size);
 	void readMainChannels(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size);
-	Image::ImageDecoder *getImageFrom(uint16 spriteID);
+	Image::ImageDecoder *getImageFrom(uint16 spriteId);
 	void drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
 	void drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
 	void drawGhostSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
diff --git a/engines/director/graphics.cpp b/engines/director/graphics.cpp
new file mode 100644
index 0000000..e2f7f58
--- /dev/null
+++ b/engines/director/graphics.cpp
@@ -0,0 +1,155 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#include "director/director.h"
+
+namespace Director {
+
+static byte director3Patterns[][8]{ { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, 
+									{ 0xFF, 0xFF, 0x77, 0xFF, 0xFF, 0xFF, 0x77, 0xFF }, 
+									{ 0x77, 0xFF, 0xDD, 0xFF, 0x77, 0xFF, 0xDD, 0xFF }, 
+									{ 0xFF, 0xDD, 0xFF, 0x55, 0xFF, 0xDD, 0xFF, 0x55 }, 
+									{ 0xFF, 0xD5, 0xFF, 0x55, 0xFF, 0x5D, 0xFF, 0x55 },
+									{ 0xFF, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA },
+									{ 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA },
+									{ 0xAA, 0x44, 0xAA, 0x11, 0xAA, 0x44, 0xAA, 0x11 },
+									{ 0xAA, 0x44, 0xAA, 0x00, 0xAA, 0x44, 0xAA, 0x00 },
+									{ 0xAA, 0x00, 0xAA, 0x00, 0xAA, 0x00, 0xAA, 0x00 },
+									{ 0x00, 0x22, 0x00, 0x88, 0x00, 0x22, 0x00, 0x88 },
+									{ 0x88, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00 },
+									{ 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00 },
+									{ 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+									{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+									{ 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 },
+									{ 0x21, 0x42, 0x84, 0x09, 0x12, 0x24, 0x48, 0x90 },
+									{ 0x11, 0x22, 0x44, 0x88, 0x11, 0x22, 0x44, 0x88 },
+									{ 0xEE, 0xDD, 0xBB, 0x77, 0xEE, 0xDD, 0xBB, 0x77 },
+									{ 0xF6, 0xED, 0xDB, 0xB7, 0x6F, 0xDE, 0xBD, 0x7B },
+									{ 0xFE, 0xFD, 0xFB, 0xF7, 0xEF, 0xDF, 0xBF, 0x7F },
+									{ 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF },
+									{ 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF },
+									{ 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF },
+									{ 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF },
+									{ 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00 },
+									{ 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00 },
+									{ 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00 },
+									{ 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00 },
+									{ 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+									{ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 },
+									{ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82 },
+									{ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88 },
+									{ 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94 },
+									{ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA },
+									{ 0xAD, 0xAD, 0xAD, 0xAD, 0xAD, 0xAD, 0xAD, 0xAD },
+									{ 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB },
+									{ 0xB7, 0xB7, 0xB7, 0xB7, 0xB7, 0xB7, 0xB7, 0xB7 },
+									{ 0xBF, 0xBF, 0xBF, 0xBF, 0xBF, 0xBF, 0xBF, 0xBF },
+									{ 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00 },
+									{ 0x7F, 0x7F, 0x7F, 0x00, 0x7F, 0x7F, 0x7F, 0x00 },
+									{ 0x77, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77, 0x00 },
+									{ 0x88, 0x88, 0x88, 0xFF, 0x88, 0x88, 0x88, 0xFF },
+									{ 0x80, 0x80, 0x80, 0xFF, 0x80, 0x80, 0x80, 0xFF },
+									{ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xFF },
+									{ 0x01, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82 },
+									{ 0x11, 0x82, 0x45, 0xAB, 0xD7, 0xAB, 0x45, 0x82 },
+									{ 0xF7, 0x7F, 0xBE, 0x5D, 0x2A, 0x5D, 0xBE, 0x7F },
+									{ 0xFE, 0x7D, 0xBB, 0xD7, 0xEF, 0xD7, 0xBB, 0x7D },
+									{ 0xFE, 0x7F, 0xBF, 0xDF, 0xEF, 0xDF, 0xBF, 0x7F },
+									{ 0xEE, 0x77, 0xBB, 0xDD, 0xEE, 0xDD, 0xBB, 0x77 },
+									{ 0x11, 0x88, 0x44, 0x22, 0x11, 0x22, 0x44, 0x88 },
+									{ 0x01, 0x80, 0x40, 0x20, 0x10, 0x20, 0x40, 0x80 },
+									{ 0x22, 0x00, 0x01, 0x22, 0x54, 0x88, 0x01, 0x00 },
+									{ 0xBF, 0xAF, 0xAB, 0xAA, 0xEA, 0xFA, 0xFE, 0xFF },
+									{ 0xFF, 0xFF, 0xBE, 0x9C, 0xAA, 0xB6, 0xBE, 0xFF }
+};
+
+static byte director3QuickDrawPatterns[][8]{ { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
+											 { 0xDD, 0xFF, 0x77, 0xFF, 0xDD, 0xFF, 0x77, 0xFF },
+											 { 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77 },
+											 { 0xEE, 0xDD, 0xBB, 0x77, 0xEE, 0xDD, 0xBB, 0x77 },
+											 { 0xFF, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA },
+											 { 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55 },
+											 { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55 },
+											 { 0x11, 0x22, 0x44, 0x88, 0x11, 0x22, 0x44, 0x88 },
+											 { 0xAA, 0x00, 0xAA, 0x00, 0xAA, 0x00, 0xAA, 0x00 },
+											 { 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22 },
+											 { 0x00, 0x22, 0x00, 0x88, 0x00, 0x22, 0x00, 0x88 },
+											 { 0x10, 0x20, 0x40, 0x80, 0x01, 0x02, 0x04, 0x08 },
+											 { 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00 },
+											 { 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+											 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+											 { 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88 },
+											 { 0x58, 0xDF, 0x00, 0xDF, 0xDF, 0x58, 0x58, 0x58 },
+											 { 0xB1, 0x36, 0x06, 0x60, 0x63, 0x1B, 0x18, 0x81 },
+											 { 0x08, 0xFF, 0x01, 0x01, 0x01, 0xFF, 0x08, 0x08 },
+											 { 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00 },
+											 { 0x80, 0x80, 0x80, 0xFF, 0x80, 0x80, 0x80, 0x80 },
+											 { 0x80, 0x10, 0x02, 0x40, 0x04, 0x20, 0x09, 0x00 },
+											 { 0x80, 0x01, 0x82, 0x44, 0x38, 0x10, 0x20, 0x40 },
+											 { 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00 },
+											 { 0x22, 0xFF, 0x22, 0x22, 0x22, 0xFF, 0x22, 0x22 },
+											 { 0x00, 0x08, 0x14, 0x2A, 0x55, 0x2A, 0x14, 0x08 },
+											 { 0x81, 0xAA, 0x14, 0x08, 0x08, 0xAA, 0x41, 0x80 },
+											 { 0x3E, 0x1D, 0x88, 0xD1, 0xE3, 0xC5, 0x88, 0x5C },
+											 { 0xAA, 0x00, 0x80, 0x00, 0x88, 0x00, 0x80, 0x00 },
+											 { 0x00, 0x11, 0x82, 0x44, 0x28, 0x11, 0x00, 0x55 },
+											 { 0x7C, 0x10, 0x10, 0x28, 0xC7, 0x01, 0x01, 0x82 },
+											 { 0xEE, 0x31, 0xF1, 0xF1, 0xEE, 0x13, 0x1F, 0x1F },
+											 { 0x00, 0x40, 0x20, 0x10, 0x00, 0x01, 0x02, 0x04 },
+											 { 0x00, 0x00, 0x40, 0xA0, 0x00, 0x04, 0x0A, 0x00 },
+											 { 0x20, 0x60, 0x90, 0x09, 0x06, 0x81, 0x40, 0x20 },
+											 { 0x00, 0x7F, 0x43, 0x5F, 0x5F, 0x5F, 0x7F, 0x7F },
+											 { 0x01, 0x02, 0x45, 0xAA, 0xFF, 0x20, 0x40, 0x80 },
+											 { 0x00, 0x44, 0x0A, 0x11, 0x11, 0x11, 0x51, 0x24 },
+											 { 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0 },
+											 { 0xF8, 0xFC, 0xFA, 0xFC, 0xFA, 0x54, 0x2A, 0x00 },
+											 { 0x42, 0xC3, 0x3C, 0x3C, 0x3C, 0x3C, 0xC3, 0x42 },
+											 { 0x10, 0x38, 0x7C, 0xFE, 0x7D, 0x3A, 0x14, 0x08 },
+											 { 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF },
+											 { 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC },
+											 { 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00 },
+											 { 0xBB, 0xDD, 0xAE, 0x77, 0xEE, 0xDD, 0xAB, 0x77 },
+											 { 0x80, 0x40, 0x40, 0x20, 0x20, 0x18, 0x06, 0x01 },
+											 { 0x01, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82 },
+											 { 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xFF, 0xFF },
+											 { 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xFF, 0xFF, 0xFF },
+											 { 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00 },
+											 { 0xC3, 0x87, 0x0F, 0x1E, 0x3C, 0x78, 0xF0, 0xE1 },
+											 { 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0 },
+											 { 0xFF, 0xFF, 0xE7, 0xC3, 0x81, 0x18, 0x3C, 0x7E },
+											 { 0x1F, 0x8F, 0xC7, 0xE3, 0xC7, 0x8F, 0x1F, 0x3E },
+											 { 0xFF, 0x2A, 0xFF, 0xC8, 0xFF, 0x65, 0xFF, 0x9D }
+};
+
+void DirectorEngine::loadPatterns() {
+	for (int i = 0; i < ARRAYSIZE(director3Patterns); i++)
+		_director3Patterns.push_back(director3Patterns[i]);
+
+	for (int i = 0; i < ARRAYSIZE(director3QuickDrawPatterns); i++)
+		_director3QuickDrawPatterns.push_back(director3QuickDrawPatterns[i]);
+}
+
+Graphics::MacPatterns &DirectorEngine::getPatterns() {
+	//TOOD: implement switch and other version patterns. (use getVersion());
+	return _director3QuickDrawPatterns;
+}
+
+}
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 38e3cfe..e947af4 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -6,6 +6,7 @@ MODULE_OBJS = \
 	detection.o \
 	director.o \
 	frame.o \
+	graphics.o \
 	images.o \
 	movie.o \
 	resource.o \
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 50f36ee..052190f 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -323,6 +323,7 @@ void Score::loadFrames(Common::SeekableSubReadStreamEndian &stream) {
 		}
 
 		Common::MemoryReadStreamEndian *str = new Common::MemoryReadStreamEndian(channelData, ARRAYSIZE(channelData), stream.isBE());
+		//Common::hexdump(channelData, ARRAYSIZE(channelData));
 		frame->readChannels(str);
 
 		delete str;
diff --git a/engines/director/sprite.cpp b/engines/director/sprite.cpp
index a59313a..62897ed 100644
--- a/engines/director/sprite.cpp
+++ b/engines/director/sprite.cpp
@@ -38,7 +38,7 @@ Sprite::Sprite() {
 	_constraint = 0;
 	_moveable = 0;
 	_castId = 0;
-	_backColor = 0;
+	_backColor = 255;
 	_foreColor = 0;
 	_left = 0;
 	_right = 0;
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index ebc2a8f..77f22a1 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -232,7 +232,7 @@ void macDrawPixel(int x, int y, int color, void *data) {
 
 			*((byte *)p->surface->getBasePtr(xu, yu)) =
 				(pat[yu % 8] & (1 << (7 - xu % 8))) ?
-					color : kColorWhite;
+					color : p->bgColor;
 		}
 	} else {
 		int x1 = x;
@@ -247,7 +247,7 @@ void macDrawPixel(int x, int y, int color, void *data) {
 					uint yu = (uint)y;
 					*((byte *)p->surface->getBasePtr(xu, yu)) =
 						(pat[yu % 8] & (1 << (7 - xu % 8))) ?
-							color : kColorWhite;
+							color : p->bgColor;
 				}
 	}
 }
diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index d359369..8f04861 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -70,9 +70,10 @@ struct MacPlotData {
 	MacPatterns *patterns;
 	uint fillType;
 	int thickness;
+	uint bgColor;
 
-	MacPlotData(Graphics::ManagedSurface *s, MacPatterns *p, int f, int t) :
-		surface(s), patterns(p), fillType(f), thickness(t) {
+	MacPlotData(Graphics::ManagedSurface *s, MacPatterns *p, int f, int t, uint bg = kColorWhite) :
+		surface(s), patterns(p), fillType(f), thickness(t), bgColor(bg) {
 	}
 };
 





More information about the Scummvm-git-logs mailing list