diff options
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 15 | ||||
-rw-r--r-- | engines/sci/graphics/palette.cpp | 15 | ||||
-rw-r--r-- | engines/sci/graphics/palette.h | 1 |
3 files changed, 26 insertions, 5 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 82a565c6d2..bc278a2bb1 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -673,7 +673,7 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) { warning("kPalVary(reverse) called with ticks = %d, stop = %d, direction = %d", ticks, stepStop, direction); return make_reg(0, result); } else { - warning("kPalVary(reverse) called with parameter %d (argc %d)", argv[1].toUint16(), argc); + warning("kPalVary(reverse) called with unsupported argc %d", argc); } } case 2: { // Get Current Step @@ -681,7 +681,7 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) { int16 currentStep = g_sci->_gfxPalette->kernelPalVaryGetCurrentStep(); return make_reg(0, currentStep); } else { - warning("kPalVary(GetCurrentStep) called with unsupported argc %d", argc); + warning("kPalVary(getCurrentStep) called with unsupported argc %d", argc); } break; } @@ -695,8 +695,13 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) { break; } case 4: { // Change Target - // seems to be 1 parameter, we should find a game that is using this feature before implementing it - error("kPalVary(changeTarget) called with parameter %d (argc %d)", argv[1].toUint16(), argc); + if (argc == 2) { + GuiResourceId paletteId = argv[1].toUint16(); + int16 currentStep = g_sci->_gfxPalette->kernelPalVaryChangeTarget(paletteId); + return make_reg(0, currentStep); + } else { + warning("kPalVary(changeTarget) called with unsupported argc %d", argc); + } break; } case 5: { // Change ticks @@ -704,7 +709,7 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) { uint16 ticks = argv[1].toUint16(); g_sci->_gfxPalette->kernelPalVaryChangeTicks(ticks); } else { - warning("kPalVary(changeTicks) called with parameter %d (argc %d)", argv[1].toUint16(), argc); + warning("kPalVary(changeTicks) called with unsupported argc %d", argc); } break; } diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp index d256227ea8..339cac8e15 100644 --- a/engines/sci/graphics/palette.cpp +++ b/engines/sci/graphics/palette.cpp @@ -572,6 +572,21 @@ int16 GfxPalette::kernelPalVaryGetCurrentStep() { return -_palVaryStep; } +int16 GfxPalette::kernelPalVaryChangeTarget(GuiResourceId resourceId) { + if (_palVaryResourceId != -1) { + Resource *palResource = _resMan->findResource(ResourceId(kResourceTypePalette, resourceId), false); + if (palResource) { + Palette insertPalette; + createFromData(palResource->data, &insertPalette); + // insert new palette into target + insert(&insertPalette, &_palVaryTargetPalette); + // update palette and set on screen + palVaryProcess(0, true); + } + } + return kernelPalVaryGetCurrentStep(); +} + void GfxPalette::kernelPalVaryChangeTicks(uint16 ticks) { _palVaryTicks = ticks; if (_palVaryStep - _palVaryStepStop) { diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h index 021096873b..ce9888c7db 100644 --- a/engines/sci/graphics/palette.h +++ b/engines/sci/graphics/palette.h @@ -66,6 +66,7 @@ public: bool kernelPalVaryInit(GuiResourceId resourceId, uint16 ticks, uint16 stepStop, uint16 direction); int16 kernelPalVaryReverse(int16 ticks, uint16 stepStop, int16 direction); int16 kernelPalVaryGetCurrentStep(); + int16 kernelPalVaryChangeTarget(GuiResourceId resourceId); void kernelPalVaryChangeTicks(uint16 ticks); void kernelPalVaryPause(bool pause); void kernelPalVaryDeinit(); |