diff options
author | Filippos Karapetis | 2012-07-24 00:16:42 +0300 |
---|---|---|
committer | Filippos Karapetis | 2012-07-24 00:18:31 +0300 |
commit | 61e8fdbf1d05bbe37910a787fa53958f4aa5e7f1 (patch) | |
tree | f6fa30eab983731a3bcacca4acaae9f19d494992 /engines/sci/engine | |
parent | 8ac70ac94a6ecfcbb74c65aac730fa707ab6fa6e (diff) | |
download | scummvm-rg350-61e8fdbf1d05bbe37910a787fa53958f4aa5e7f1.tar.gz scummvm-rg350-61e8fdbf1d05bbe37910a787fa53958f4aa5e7f1.tar.bz2 scummvm-rg350-61e8fdbf1d05bbe37910a787fa53958f4aa5e7f1.zip |
SCI: Separate the early SCI11 version of kRemapColors from the SCI32 one
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/kernel.h | 1 | ||||
-rw-r--r-- | engines/sci/engine/kernel_tables.h | 5 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 60 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics32.cpp | 74 |
4 files changed, 85 insertions, 55 deletions
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index 441ea2624f..f985a69ebc 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 825ec90fa9..f5f46285be 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 6d938b6d22..2ce44db772 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 7cfac57675..245c265ba6 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 |