diff options
author | Martin Kiewitz | 2010-06-20 21:12:15 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-06-20 21:12:15 +0000 |
commit | 6f195ae5a4c862fede87126e2587b0fdc2952827 (patch) | |
tree | 46f37ea3a41727365417c4963316aba7b084fd0f | |
parent | 4a83b2c5f6a0b43c25d8870168baca9a76eee103 (diff) | |
download | scummvm-rg350-6f195ae5a4c862fede87126e2587b0fdc2952827.tar.gz scummvm-rg350-6f195ae5a4c862fede87126e2587b0fdc2952827.tar.bz2 scummvm-rg350-6f195ae5a4c862fede87126e2587b0fdc2952827.zip |
SCI: implemented kPalVary(changeTicks)
svn-id: r50100
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 17 | ||||
-rw-r--r-- | engines/sci/graphics/palette.cpp | 16 | ||||
-rw-r--r-- | engines/sci/graphics/palette.h | 2 |
3 files changed, 27 insertions, 8 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index ca2bec39d7..0b2f37f690 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(1) called with parameter %d (argc %d)", argv[1].toUint16(), argc); + warning("kPalVary(reverse) called with parameter %d (argc %d)", argv[1].toUint16(), argc); } } case 2: { // Get Current Step @@ -694,13 +694,18 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) { } break; } - case 4: { // Unknown - warning("kPalVary(4) called with parameter %d (argc %d)", argv[1].toUint16(), argc); + case 4: { // Change Target + // seems to be 1 parameter, we should find a game that is using this feature before implementing it + warning("kPalVary(changeTarget) called with parameter %d (argc %d)", argv[1].toUint16(), argc); break; } - case 5: { // Unknown - // Called in xmas 1992 demo (2 parameters) - warning("kPalVary(5) called with parameter %d (argc %d)", argv[1].toUint16(), argc); + case 5: { // Change ticks + if (argc == 2) { + uint16 ticks = argv[1].toUint16(); + g_sci->_gfxPalette->kernelPalVaryChangeTicks(ticks); + } else { + warning("kPalVary(changeTicks) called with parameter %d (argc %d)", argv[1].toUint16(), argc); + } break; } case 6: { // Pause/Resume diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp index c9fb42b48d..228e5dfced 100644 --- a/engines/sci/graphics/palette.cpp +++ b/engines/sci/graphics/palette.cpp @@ -519,6 +519,10 @@ void GfxPalette::palVaryInstallTimer() { g_sci->getTimerManager()->installTimerProc(&palVaryCallback, 1000000 / 60 * ticks, this); } +void GfxPalette::palVaryRemoveTimer() { + g_sci->getTimerManager()->removeTimerProc(&palVaryCallback); +} + bool GfxPalette::kernelPalVaryInit(GuiResourceId resourceId, uint16 ticks, uint16 stepStop, uint16 direction) { if (_palVaryResourceId != -1) // another palvary is taking place, return return false; @@ -564,6 +568,14 @@ int16 GfxPalette::kernelPalVaryGetCurrentStep() { return -_palVaryStep; } +void GfxPalette::kernelPalVaryChangeTicks(uint16 ticks) { + _palVaryTicks = ticks; + if (_palVaryStep - _palVaryStepStop) { + palVaryRemoveTimer(); + palVaryInstallTimer(); + } +} + void GfxPalette::kernelPalVaryPause(bool pause) { if (_palVaryResourceId == -1) return; @@ -578,7 +590,7 @@ void GfxPalette::kernelPalVaryPause(bool pause) { } void GfxPalette::kernelPalVaryDeinit() { - g_sci->getTimerManager()->removeTimerProc(&palVaryCallback); + palVaryRemoveTimer(); _palVaryResourceId = -1; // invalidate the target palette } @@ -624,7 +636,7 @@ void GfxPalette::palVaryProcess(int signal, bool setPalette) { // We don't need updates anymore, if we reached end-position if (_palVaryStep == _palVaryStepStop) - g_sci->getTimerManager()->removeTimerProc(&palVaryCallback); + palVaryRemoveTimer(); if (_palVaryStep == 0) _palVaryResourceId = -1; diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h index af193e4b62..021096873b 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(); + void kernelPalVaryChangeTicks(uint16 ticks); void kernelPalVaryPause(bool pause); void kernelPalVaryDeinit(); void palVaryUpdate(); @@ -77,6 +78,7 @@ public: private: void palVaryInit(); void palVaryInstallTimer(); + void palVaryRemoveTimer(); bool palVaryLoadTargetPalette(GuiResourceId resourceId); static void palVaryCallback(void *refCon); void palVaryIncreaseSignal(); |