[Scummvm-cvs-logs] scummvm master -> 10e2cec6b95f0e185f0522fdc7f10a076de24c7e

digitall digitall at scummvm.org
Sun Feb 20 04:21:32 CET 2011


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:
10e2cec6b9 M4: Updated for OSystem Palette RGBA->RGB Change.


Commit: 10e2cec6b95f0e185f0522fdc7f10a076de24c7e
    https://github.com/scummvm/scummvm/commit/10e2cec6b95f0e185f0522fdc7f10a076de24c7e
Author: D G Turner (digitall at scummvm.org)
Date: 2011-02-19T19:20:06-08:00

Commit Message:
M4: Updated for OSystem Palette RGBA->RGB Change.

Changed paths:
    engines/m4/dialogs.cpp
    engines/m4/graphics.cpp
    engines/m4/graphics.h
    engines/m4/mads_scene.cpp
    engines/m4/scene.cpp
    engines/m4/woodscript.cpp



diff --git a/engines/m4/dialogs.cpp b/engines/m4/dialogs.cpp
index 101f21f..da828cc 100644
--- a/engines/m4/dialogs.cpp
+++ b/engines/m4/dialogs.cpp
@@ -43,8 +43,8 @@ static void strToLower(char *s) {
 }
 
 const RGB8 DIALOG_PALETTE[8] = {
-	{0x80, 0x80, 0x80, 0xff}, {0x90, 0x90, 0x90, 0xff}, {0x70, 0x70, 0x70, 0xff}, {0x9c, 0x9c, 0x9c, 0xff},
-	{0x80, 0x80, 0x80, 0xff}, {0x90, 0x90, 0x90, 0xff}, {0xDC, 0xDC, 0xDC, 0xff}, {0x00, 0x00, 0x00, 0xff}
+	{0x80, 0x80, 0x80}, {0x90, 0x90, 0x90}, {0x70, 0x70, 0x70}, {0x9c, 0x9c, 0x9c},
+	{0x80, 0x80, 0x80}, {0x90, 0x90, 0x90}, {0xDC, 0xDC, 0xDC}, {0x00, 0x00, 0x00}
 };
 
 #define ROR16(v,amt) (((uint16)(v) >> amt) | ((uint16)(v) << (16 - amt)))
diff --git a/engines/m4/graphics.cpp b/engines/m4/graphics.cpp
index a651510..5fc46d3 100644
--- a/engines/m4/graphics.cpp
+++ b/engines/m4/graphics.cpp
@@ -795,7 +795,11 @@ void M4Surface::m4LoadBackground(Common::SeekableReadStream *source) {
 		palette[i].b = source->readByte() << 2;
 		palette[i].g = source->readByte() << 2;
 		palette[i].r = source->readByte() << 2;
-		palette[i].u = source->readByte() << 2;
+		// FIXME - Removed u field from RGB8 as the OSystem palette is now RGB.
+		//         If this is needed, then the system setPalette() call will need changing to skip this.
+		uint8 u = source->readByte() << 2;
+		if (u != 0)
+			debugC(1, kDebugGraphics, "Unused u field in Palette data non-zero: %d", u);
 
 		if ((blackIndex == 0) && !palette[i].r && !palette[i].g && !palette[i].b)
 			blackIndex = i;
@@ -1049,7 +1053,6 @@ void Palette::setEntry(uint index, uint8 r, uint8 g, uint8 b) {
 	c.r = r;
 	c.g = g;
 	c.b = b;
-	c.u = 255;
 	g_system->getPaletteManager()->setPalette((const byte *)&c, index, 1);
 }
 
diff --git a/engines/m4/graphics.h b/engines/m4/graphics.h
index ecb5048..d58ed69 100644
--- a/engines/m4/graphics.h
+++ b/engines/m4/graphics.h
@@ -47,7 +47,7 @@ struct BGR8 {
 };
 
 struct RGB8 {
-	uint8 r, g, b, u;
+	uint8 r, g, b;
 };
 
 //later use ScummVM's Rect?
@@ -214,8 +214,8 @@ private:
 	MadsM4Engine *_vm;
 	bool _colorsChanged;
 	bool _fading_in_progress;
-	byte _originalPalette[256 * 4];
-	byte _fadedPalette[256 * 4];
+	byte _originalPalette[256 * 3];
+	byte _fadedPalette[256 * 3];
 	int _usageCount[256];
 
 	void reset();
diff --git a/engines/m4/mads_scene.cpp b/engines/m4/mads_scene.cpp
index e88a21e..4d9dcc5 100644
--- a/engines/m4/mads_scene.cpp
+++ b/engines/m4/mads_scene.cpp
@@ -111,8 +111,8 @@ void MadsScene::loadSceneTemporary() {
 	/* Existing code that eventually needs to be replaced with the proper MADS code */
 	// Set system palette entries
 	_vm->_palette->blockRange(0, 18);
-	RGB8 sysColors[3] = { {0x1f<<2, 0x2d<<2, 0x31<<2, 0}, {0x24<<2, 0x37<<2, 0x3a<<2, 0},
-		{0x00<<2, 0x10<<2, 0x16<<2, 0}};
+	RGB8 sysColors[3] = { {0x1f<<2, 0x2d<<2, 0x31<<2}, {0x24<<2, 0x37<<2, 0x3a<<2},
+		{0x00<<2, 0x10<<2, 0x16<<2}};
 	_vm->_palette->setPalette(&sysColors[0], 4, 3);
 
 	_interfaceSurface->initialise();
diff --git a/engines/m4/scene.cpp b/engines/m4/scene.cpp
index 57d63c1..0f684eb 100644
--- a/engines/m4/scene.cpp
+++ b/engines/m4/scene.cpp
@@ -149,11 +149,11 @@ void Scene::showCodes() {
 		for (int i = 0; i < _walkSurface->width() * _walkSurface->height(); i++)
 			destP[i] = (srcP[i] & 0x10) ? 0xFF : 0;
 
-		byte colors[256 * 4];
+		byte colors[256 * 3];
 		memset(colors, 0, sizeof(colors));
-		colors[255 * 4 + 0] = 255;
-		colors[255 * 4 + 1] = 255;
-		colors[255 * 4 + 2] = 255;
+		colors[255 * 3 + 0] = 255;
+		colors[255 * 3 + 1] = 255;
+		colors[255 * 3 + 2] = 255;
 		_vm->_palette->setPalette(colors, 0, 256);
 	} else {
 		// MADS handling
diff --git a/engines/m4/woodscript.cpp b/engines/m4/woodscript.cpp
index f45e8fa..1235cc9 100644
--- a/engines/m4/woodscript.cpp
+++ b/engines/m4/woodscript.cpp
@@ -321,12 +321,12 @@ void WoodScript::update() {
 
 	{
 		// FIXME: This should be done when a new palette is set
-		byte palette[1024];
+		byte palette[768];
 		g_system->getPaletteManager()->grabPalette(palette, 0, 256);
 		for (int i = 0; i < 256; i++) {
-			_mainPalette[i].r = palette[i * 4 + 0];
-			_mainPalette[i].g = palette[i * 4 + 1];
-			_mainPalette[i].b = palette[i * 4 + 2];
+			_mainPalette[i].r = palette[i * 3 + 0];
+			_mainPalette[i].g = palette[i * 3 + 1];
+			_mainPalette[i].b = palette[i * 3 + 2];
 		}
 	}
 






More information about the Scummvm-git-logs mailing list