mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 12:39:56 +00:00
SCI: Separate the early SCI11 version of kRemapColors from the SCI32 one
This commit is contained in:
parent
8ac70ac94a
commit
61e8fdbf1d
@ -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);
|
||||
|
@ -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 },
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user