[Scummvm-cvs-logs] SF.net SVN: scummvm:[44222] scummvm/trunk/engines/cine

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Mon Sep 21 01:00:08 CEST 2009


Revision: 44222
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44222&view=rev
Author:   lordhoto
Date:     2009-09-20 23:00:08 +0000 (Sun, 20 Sep 2009)

Log Message:
-----------
Implement support for transparent dialgue boxes in the Amiga version of Future Wars.

Modified Paths:
--------------
    scummvm/trunk/engines/cine/gfx.cpp
    scummvm/trunk/engines/cine/pal.cpp

Modified: scummvm/trunk/engines/cine/gfx.cpp
===================================================================
--- scummvm/trunk/engines/cine/gfx.cpp	2009-09-20 22:59:30 UTC (rev 44221)
+++ scummvm/trunk/engines/cine/gfx.cpp	2009-09-20 23:00:08 UTC (rev 44222)
@@ -286,7 +286,7 @@
 	ty += 9;
 	if (color >= 0) {
 		drawPlainBox(x, ty, width, 4, color);
-		drawDoubleBorder(x, y, width, ty - y + 4, 2);
+		drawDoubleBorder(x, y, width, ty - y + 4, g_cine->getPlatform() == Common::kPlatformAmiga ? 1 : 2);
 	}
 }
 
@@ -331,9 +331,30 @@
 	boxRect.clip(screenRect);
 
 	// Draw the filled rectangle
-	byte *dest = _backBuffer + boxRect.top * 320 + boxRect.left;
-	for (int i = 0; i < boxRect.height(); i++) {
-		memset(dest + i * 320, color, boxRect.width());
+	//
+	// Since the Amiga version uses a transparent boxes we need to decide whether:
+	//  - we draw a box, that should be the case then both width and height is greater than 1
+	//  - we draw a line, that should be the case then either width or height is 1
+	// When we draw a box and we're running an Amiga version we do use the special code to make
+	// the boxes transparent.
+	// When on the other hand we are drawing a line or are not running an Amiga version, we will
+	// always use the code, which simply fills the rect.
+	//
+	// TODO: Think over whether this is the nicest / best solution we can find for handling
+	// the transparency for Amiga boxes.
+	if (g_cine->getPlatform() == Common::kPlatformAmiga && width > 1 && height > 1) {
+		byte *dest = _backBuffer + boxRect.top * 320 + boxRect.left;
+		const int lineAdd = 320 - boxRect.width();
+		for (int i = 0; i < boxRect.height(); ++i) {
+			for (int j = 0; j < boxRect.width(); ++j)
+				*dest++ += 16;
+			dest += lineAdd;
+		}
+	} else {
+		byte *dest = _backBuffer + boxRect.top * 320 + boxRect.left;
+		for (int i = 0; i < boxRect.height(); i++) {
+			memset(dest + i * 320, color, boxRect.width());
+		}
 	}
 }
 
@@ -783,7 +804,7 @@
 	}
 
 	drawPlainBox(x, ty, width, 4, _messageBg);
-	drawDoubleBorder(x, y, width, ty - y + 4, 2);
+	drawDoubleBorder(x, y, width, ty - y + 4, g_cine->getPlatform() == Common::kPlatformAmiga ? 1 : 2);
 }
 
 /*! \brief Draw text input box
@@ -856,7 +877,7 @@
 
 	ty += 9;
 	drawPlainBox(x, ty, width, 4, _messageBg);
-	drawDoubleBorder(x, y, width, ty - y + 4, 2);
+	drawDoubleBorder(x, y, width, ty - y + 4, g_cine->getPlatform() == Common::kPlatformAmiga ? 1 : 2);
 }
 
 /*! \brief Fade to black

Modified: scummvm/trunk/engines/cine/pal.cpp
===================================================================
--- scummvm/trunk/engines/cine/pal.cpp	2009-09-20 22:59:30 UTC (rev 44221)
+++ scummvm/trunk/engines/cine/pal.cpp	2009-09-20 23:00:08 UTC (rev 44222)
@@ -187,7 +187,20 @@
 void Palette::setGlobalOSystemPalette() const {
 	byte buf[256 * 4]; // Allocate space for the largest possible palette
 	save(buf, sizeof(buf), Cine::kSystemPalFormat, CINE_LITTLE_ENDIAN);
-	g_system->setPalette(buf, 0, colorCount());
+
+	// TODO: Think over whether this is really the correct place to calculate the Amiga
+	// specific transparency palette.
+	if (g_cine->getPlatform() == Common::kPlatformAmiga && colorCount() == 16) {
+		// The Amiga version of Future Wars does use the upper 16 colors for a darkened
+		// game palette to allow transparent dialog boxes. To support that in our code
+		// we do calculate that palette over here and append it to the screen palette.
+		for (uint i = 0; i < 16 * 4; ++i)
+			buf[16 * 4 + i] = buf[i] >> 1;
+
+		g_system->setPalette(buf, 0, colorCount() * 2);
+	} else {
+		g_system->setPalette(buf, 0, colorCount());
+	}
 }
 
 Cine::Palette::Color Palette::getColor(byte index) const {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list