[Scummvm-cvs-logs] scummvm master -> f09a15f27636149b267d0e0b23a9dcfa4bc8c854

m-kiewitz m_kiewitz at users.sourceforge.net
Fri Feb 5 16:41:25 CET 2016


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:
f09a15f276 AGI: Render mode Macintosh added


Commit: f09a15f27636149b267d0e0b23a9dcfa4bc8c854
    https://github.com/scummvm/scummvm/commit/f09a15f27636149b267d0e0b23a9dcfa4bc8c854
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2016-02-05T16:41:02+01:00

Commit Message:
AGI: Render mode Macintosh added

Palette + mouse cursor + box frame color only atm
Thanks to wjp for gamma correction
Not sure, if our current color adjustment is correct
Should be checked by using actual hardware

Changed paths:
    engines/agi/agi.cpp
    engines/agi/graphics.cpp
    engines/agi/graphics.h
    engines/agi/mouse_cursor.h
    engines/agi/palette.h



diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index 933aa50..9eeca62 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -305,6 +305,9 @@ void AgiBase::initRenderMode() {
 	case Common::kPlatformAtariST:
 		_renderMode = Common::kRenderAtariST;
 		break;
+	case Common::kPlatformMacintosh:
+		_renderMode = Common::kRenderMacintosh;
+		break;
 	default:
 		break;
 	}
@@ -320,6 +323,9 @@ void AgiBase::initRenderMode() {
 	case Common::kRenderAtariST:
 		_renderMode = Common::kRenderAtariST;
 		break;
+	case Common::kRenderMacintosh:
+		_renderMode = Common::kRenderMacintosh;
+		break;
 	default:
 		break;
 	}
diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp
index 7f367a0..cfe6599 100644
--- a/engines/agi/graphics.cpp
+++ b/engines/agi/graphics.cpp
@@ -92,6 +92,9 @@ int GfxMgr::initVideo() {
 	case Common::kRenderAtariST:
 		initPalette(_paletteGfxMode, PALETTE_ATARI_ST, 16, 3);
 		break;
+	case Common::kRenderMacintosh:
+		initPaletteCLUT(_paletteGfxMode, PALETTE_MACINTOSH_CLUT, 16);
+		break;
 	default:
 		error("initVideo: unsupported render mode");
 		break;
@@ -118,6 +121,12 @@ int GfxMgr::initVideo() {
 		initMouseCursor(&_mouseCursor, MOUSECURSOR_ATARI_ST, 11, 16, 1, 1);
 		initMouseCursor(&_mouseCursorBusy, MOUSECURSOR_SCI_BUSY, 15, 16, 7, 8);
 		break;
+	case Common::kRenderMacintosh:
+		// It looks like Atari ST + Macintosh used the same standard mouse cursor
+		// TODO: Verify by checking actual hardware
+		initMouseCursor(&_mouseCursor, MOUSECURSOR_ATARI_ST, 11, 16, 1, 1);
+		initMouseCursor(&_mouseCursorBusy, MOUSECURSOR_MACINTOSH_BUSY, 10, 14, 7, 8);
+		break;
 	default:
 		error("initVideo: unsupported render mode");
 		break;
@@ -813,9 +822,21 @@ int16 GfxMgr::priorityFromY(int16 yPos) {
 void GfxMgr::initPalette(uint8 *destPalette, const uint8 *paletteData, uint colorCount, uint fromBits, uint toBits) {
 	const uint srcMax  = (1 << fromBits) - 1;
 	const uint destMax = (1 << toBits) - 1;
-	for (uint col = 0; col < colorCount; col++) {
-		for (uint comp = 0; comp < 3; comp++) { // Convert RGB components
-			destPalette[col * 3 + comp] = (paletteData[col * 3 + comp] * destMax) / srcMax;
+	for (uint colorNr = 0; colorNr < colorCount; colorNr++) {
+		for (uint componentNr = 0; componentNr < 3; componentNr++) { // Convert RGB components
+			destPalette[colorNr * 3 + componentNr] = (paletteData[colorNr * 3 + componentNr] * destMax) / srcMax;
+		}
+	}
+}
+
+// Converts CLUT data to a palette, that we can use
+void GfxMgr::initPaletteCLUT(uint8 *destPalette, const uint16 *paletteCLUTData, uint colorCount) {
+	for (uint colorNr = 0; colorNr < colorCount; colorNr++) {
+		for (uint componentNr = 0; componentNr < 3; componentNr++) { // RGB component
+			byte component = (paletteCLUTData[colorNr * 3 + componentNr] >> 8);
+			// Adjust gamma (1.8 to 2.2)
+			component = (byte)(255 * powf(component / 255.0f, 0.8181f));
+			destPalette[colorNr * 3 + componentNr] = component;
 		}
 	}
 }
diff --git a/engines/agi/graphics.h b/engines/agi/graphics.h
index 7a7d340..fb59662 100644
--- a/engines/agi/graphics.h
+++ b/engines/agi/graphics.h
@@ -69,6 +69,7 @@ public:
 	int initVideo();
 	int deinitVideo();
 	void initPalette(uint8 *destPalette, const uint8 *paletteData, uint colorCount = 16, uint fromBits = 6, uint toBits = 8);
+	void initPaletteCLUT(uint8 *destPalette, const uint16 *paletteCLUTData, uint colorCount = 16);
 	void setAGIPal(int);
 	int getAGIPalFileNum();
 	void setPalette(bool GfxModePalette);
diff --git a/engines/agi/mouse_cursor.h b/engines/agi/mouse_cursor.h
index 381ad9f..c086359 100644
--- a/engines/agi/mouse_cursor.h
+++ b/engines/agi/mouse_cursor.h
@@ -178,6 +178,29 @@ static const byte MOUSECURSOR_AMIGA_BUSY[] = {
 	1,1,1,1,1,1,1,1,1,1,1,1,1
 };
 
+/**
+ * A Macintosh-style busy cursor showing an hourglass (10x14).
+ * 0 = Transparent.
+ * 1 = Black     (#000000 in 24-bit RGB).
+ * 2 = White (#FFFFFF in 24-bit RGB).
+ */
+static const byte MOUSECURSOR_MACINTOSH_BUSY[] = {
+	0,0,1,1,1,1,1,1,0,0,
+	0,0,1,1,1,1,1,1,0,0,
+	0,0,1,1,1,1,1,1,0,0,
+	0,1,2,2,2,2,2,2,1,0,
+	1,2,2,2,2,1,2,2,2,1,
+	1,2,2,2,2,1,2,2,2,1,
+	1,2,2,2,2,1,2,2,2,1,
+	1,2,2,1,1,1,2,2,2,1,		
+	1,2,2,2,2,2,2,2,2,1,
+	1,2,2,2,2,2,2,2,2,1,
+	0,1,2,2,2,2,2,2,1,0,
+	0,0,1,1,1,1,1,1,0,0,
+	0,0,1,1,1,1,1,1,0,0,
+	0,0,1,1,1,1,1,1,0,0
+};
+
 } // End of namespace Agi
 
 #endif /* AGI_MOUSE_CURSOR_H */
diff --git a/engines/agi/palette.h b/engines/agi/palette.h
index 88ccce7..4be29e4 100644
--- a/engines/agi/palette.h
+++ b/engines/agi/palette.h
@@ -235,6 +235,28 @@ static const uint8 PALETTE_AMIGA_ALT[16 * 3] = {
 };
 
 /**
+ * 16 color Macintosh palette (CLUT format).
+ */
+static const uint16 PALETTE_MACINTOSH_CLUT[16 * 3] = {
+	0x0000, 0x0000, 0x0000,
+	0x0000, 0x0000, 0xC000,
+	0x0000, 0xA800, 0x0000,
+	0x0000, 0xA000, 0xA000,
+	0xCE50, 0x0000, 0x0000,
+	0xC080, 0x0000, 0xFFFF,
+	0xD000, 0x6130, 0x32D0,
+	0xC000, 0xC000, 0xC000,
+	0x6000, 0x6000, 0x6000,
+	0x6800, 0x6800, 0xFFFF,
+	0x0000, 0xFFFF, 0x0000,
+	0x0000, 0xFFFF, 0xFFFF,
+	0xFFFF, 0x5390, 0x64B0,
+	0xFFFF, 0x8000, 0x0000,
+	0xFFFF, 0xFFFF, 0x0000,
+	0xFFFF, 0xFFFF, 0xFFFF
+};
+
+/**
  * 256 color palette used with AGI256 and AGI256-2 games.
  * Uses full 8 bits per color component.
  * This is NOT the standard VGA palette.






More information about the Scummvm-git-logs mailing list