[Scummvm-cvs-logs] scummvm master -> 61e8fdbf1d05bbe37910a787fa53958f4aa5e7f1

bluegr md5 at scummvm.org
Mon Jul 23 23:20:57 CEST 2012


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:
61e8fdbf1d SCI: Separate the early SCI11 version of kRemapColors from the SCI32 one


Commit: 61e8fdbf1d05bbe37910a787fa53958f4aa5e7f1
    https://github.com/scummvm/scummvm/commit/61e8fdbf1d05bbe37910a787fa53958f4aa5e7f1
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-07-23T14:18:31-07:00

Commit Message:
SCI: Separate the early SCI11 version of kRemapColors from the SCI32 one

Changed paths:
    engines/sci/engine/kernel.h
    engines/sci/engine/kernel_tables.h
    engines/sci/engine/kgraphics.cpp
    engines/sci/engine/kgraphics32.cpp



diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 441ea26..f985a69 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -412,6 +412,7 @@ reg_t kListAt(EngineState *s, int argc, reg_t *argv);
 reg_t kString(EngineState *s, int argc, reg_t *argv);
 reg_t kMulDiv(EngineState *s, int argc, reg_t *argv);
 reg_t kCantBeHere32(EngineState *s, int argc, reg_t *argv);
+reg_t kRemapColors32(EngineState *s, int argc, reg_t *argv);
 // "Screen items" in SCI32 are views
 reg_t kAddScreenItem(EngineState *s, int argc, reg_t *argv);
 reg_t kUpdateScreenItem(EngineState *s, int argc, reg_t *argv);
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 825ec90..f5f4628 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -419,7 +419,10 @@ static SciKernelMapEntry s_kernelMap[] = {
 	{ MAP_CALL(PriCoord),          SIG_EVERYWHERE,           "i",                     NULL,            NULL },
 	{ MAP_CALL(Random),            SIG_EVERYWHERE,           "i(i)(i)",               NULL,            NULL },
 	{ MAP_CALL(ReadNumber),        SIG_EVERYWHERE,           "r",                     NULL,            NULL },
-	{ MAP_CALL(RemapColors),       SIG_EVERYWHERE,           "i(i)(i)(i)(i)(i)",      NULL,            NULL },
+	{ MAP_CALL(RemapColors),       SIG_SCI11, SIGFOR_ALL,    "i(i)(i)(i)(i)",         NULL,            NULL },
+#ifdef ENABLE_SCI32
+	{ "RemapColors", kRemapColors32, SIG_SCI32, SIGFOR_ALL,  "i(i)(i)(i)(i)(i)",      NULL,            NULL },
+#endif
 	{ MAP_CALL(ResCheck),          SIG_EVERYWHERE,           "ii(iiii)",              NULL,            NULL },
 	{ MAP_CALL(RespondsTo),        SIG_EVERYWHERE,           ".i",                    NULL,            NULL },
 	{ MAP_CALL(RestartGame),       SIG_EVERYWHERE,           "",                      NULL,            NULL },
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 6d938b6..2ce44db 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -1221,73 +1221,25 @@ reg_t kShow(EngineState *s, int argc, reg_t *argv) {
 	return s->r_acc;
 }
 
+// Early variant of the SCI32 remapcolors kernel function, used in the demo of QFG4
 reg_t kRemapColors(EngineState *s, int argc, reg_t *argv) {
 	uint16 operation = argv[0].toUint16();
 
 	switch (operation) {
-	case 0:	{ // Set remapping to base. 0 turns remapping off.
-		int16 base = (argc >= 2) ? argv[1].toSint16() : 0;
-		if (base != 0)	// 0 is the default behavior when changing rooms in GK1, thus silencing the warning
-			warning("kRemapColors: Set remapping to base %d", base);
+	case 0: { // remap by percent
+		uint16 percent = argv[1].toUint16();
+		warning("RemapColors(RemapByPercent) %d", percent);
 		}
 		break;
 	case 1:	{ // unknown
-		// The demo of QFG4 calls this with 1+3 parameters, thus there are differences here
 		//int16 unk1 = argv[1].toSint16();
 		//int16 unk2 = argv[2].toSint16();
 		//int16 unk3 = argv[3].toSint16();
-		//uint16 unk4 = argv[4].toUint16();
-		//uint16 unk5 = (argc >= 6) ? argv[5].toUint16() : 0;
 		kStub(s, argc, argv);
 		}
 		break;
-	case 2:	{ // remap by percent
-		// This adjusts the alpha value of a specific color, and it operates on
-		// an RGBA palette. Since we're operating on an RGB palette, we just
-		// modify the color intensity instead
-		// TODO: From what I understand, palette remapping should be placed
-		// separately, so that it can be reset by case 0 above. Thus, we
-		// should adjust the functionality of the Palette class accordingly.
-		int16 color = argv[1].toSint16();
-		if (color >= 10)
-			color -= 10;
-		uint16 percent = argv[2].toUint16(); // 0 - 100
-		if (argc >= 4)
-			warning("RemapByPercent called with 4 parameters, unknown parameter is %d", argv[3].toUint16());
-		warning("kRemapColors: RemapByPercent color %d by %d percent", color, percent);
-		// TODO: It's not correct to set intensity here
-		//g_sci->_gfxPalette->kernelSetIntensity(color, 255, percent, false);
-		}
-		break;
-	case 3:	{ // remap to gray
-		// NOTE: This adjusts the alpha value of a specific color, and it operates on
-		// an RGBA palette
-		int16 color = argv[1].toSint16();	// this is subtracted from a maximum color value, and can be offset by 10
-		int16 percent = argv[2].toSint16(); // 0 - 100
-		uint16 unk3 = (argc >= 4) ? argv[3].toUint16() : 0;
-		warning("kRemapColors: RemapToGray color %d by %d percent (unk3 = %d)", color, percent, unk3);
-		}
-		break;
-	case 4:	{ // unknown
-		//int16 unk1 = argv[1].toSint16();
-		//uint16 unk2 = argv[2].toUint16();
-		//uint16 unk3 = argv[3].toUint16();
-		//uint16 unk4 = (argc >= 5) ? argv[4].toUint16() : 0;
-		kStub(s, argc, argv);
-		}
-		break;
-	case 5:	{ // set color intensity
-		// TODO: This isn't right, it should be setting a mapping table instead.
-		// For PQ4, we can emulate this with kernelSetIntensity(). In QFG4, this
-		// won't do.
-		//int16 mapping = argv[1].toSint16();
-		uint16 intensity = argv[2].toUint16();
-		// HACK for PQ4
-		if (g_sci->getGameId() == GID_PQ4)
-			g_sci->_gfxPalette->kernelSetIntensity(0, 255, intensity, true);
-
-		kStub(s, argc, argv);
-		}
+	case 2:	// turn remapping off (unused)
+		error("Unused subop kRemapColors(2) has been called");
 		break;
 	default:
 		break;
diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp
index 7cfac57..245c265 100644
--- a/engines/sci/engine/kgraphics32.cpp
+++ b/engines/sci/engine/kgraphics32.cpp
@@ -733,6 +733,80 @@ reg_t kPalCycle(EngineState *s, int argc, reg_t *argv) {
 	return s->r_acc;
 }
 
+reg_t kRemapColors32(EngineState *s, int argc, reg_t *argv) {
+	uint16 operation = argv[0].toUint16();
+
+	switch (operation) {
+	case 0:	{ // Set remapping to base. 0 turns remapping off.
+		int16 base = (argc >= 2) ? argv[1].toSint16() : 0;
+		if (base != 0)	// 0 is the default behavior when changing rooms in GK1, thus silencing the warning
+			warning("kRemapColors: Set remapping to base %d", base);
+		}
+		break;
+	case 1:	{ // unknown
+		//int16 unk1 = argv[1].toSint16();
+		//int16 unk2 = argv[2].toSint16();
+		//int16 unk3 = argv[3].toSint16();
+		//uint16 unk4 = argv[4].toUint16();
+		//uint16 unk5 = (argc >= 6) ? argv[5].toUint16() : 0;
+		kStub(s, argc, argv);
+		}
+		break;
+	case 2:	{ // remap by percent
+		// This adjusts the alpha value of a specific color, and it operates on
+		// an RGBA palette. Since we're operating on an RGB palette, we just
+		// modify the color intensity instead
+		// TODO: From what I understand, palette remapping should be placed
+		// separately, so that it can be reset by case 0 above. Thus, we
+		// should adjust the functionality of the Palette class accordingly.
+		int16 color = argv[1].toSint16();
+		if (color >= 10)
+			color -= 10;
+		uint16 percent = argv[2].toUint16(); // 0 - 100
+		if (argc >= 4)
+			warning("RemapByPercent called with 4 parameters, unknown parameter is %d", argv[3].toUint16());
+		warning("kRemapColors: RemapByPercent color %d by %d percent", color, percent);
+		// TODO: It's not correct to set intensity here
+		//g_sci->_gfxPalette->kernelSetIntensity(color, 255, percent, false);
+		}
+		break;
+	case 3:	{ // remap to gray
+		// NOTE: This adjusts the alpha value of a specific color, and it operates on
+		// an RGBA palette
+		int16 color = argv[1].toSint16();	// this is subtracted from a maximum color value, and can be offset by 10
+		int16 percent = argv[2].toSint16(); // 0 - 100
+		uint16 unk3 = (argc >= 4) ? argv[3].toUint16() : 0;
+		warning("kRemapColors: RemapToGray color %d by %d percent (unk3 = %d)", color, percent, unk3);
+		}
+		break;
+	case 4:	{ // unknown
+		//int16 unk1 = argv[1].toSint16();
+		//uint16 unk2 = argv[2].toUint16();
+		//uint16 unk3 = argv[3].toUint16();
+		//uint16 unk4 = (argc >= 5) ? argv[4].toUint16() : 0;
+		kStub(s, argc, argv);
+		}
+		break;
+	case 5:	{ // set color intensity
+		// TODO: This isn't right, it should be setting a mapping table instead.
+		// For PQ4, we can emulate this with kernelSetIntensity(). In QFG4, this
+		// won't do.
+		//int16 mapping = argv[1].toSint16();
+		uint16 intensity = argv[2].toUint16();
+		// HACK for PQ4
+		if (g_sci->getGameId() == GID_PQ4)
+			g_sci->_gfxPalette->kernelSetIntensity(0, 255, intensity, true);
+
+		kStub(s, argc, argv);
+		}
+		break;
+	default:
+		break;
+	}
+
+	return s->r_acc;
+}
+
 #endif
 
 } // End of namespace Sci






More information about the Scummvm-git-logs mailing list