diff options
author | Martin Kiewitz | 2010-06-20 17:08:39 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-06-20 17:08:39 +0000 |
commit | 7ecff0a300e2e8a809818472160121743971e17a (patch) | |
tree | c870fb48c105d6da3dee79231e7d7da5460bf59d /engines | |
parent | e8262d989e31742f554d37c962254c6ac37a1a7f (diff) | |
download | scummvm-rg350-7ecff0a300e2e8a809818472160121743971e17a.tar.gz scummvm-rg350-7ecff0a300e2e8a809818472160121743971e17a.tar.bz2 scummvm-rg350-7ecff0a300e2e8a809818472160121743971e17a.zip |
SCI: implementing kPalVary(2)
svn-id: r50085
Diffstat (limited to 'engines')
-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 | 5 |
3 files changed, 27 insertions, 11 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index f011f0e2d6..2ec2cdb4c3 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -653,7 +653,8 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) { ticks = argv[2].toUint16(); stepStop = argc >= 4 ? argv[3].toUint16() : 64; direction = argc >= 5 ? argv[4].toUint16() : 1; - g_sci->_gfxPalette->kernelPalVaryInit(paletteId, ticks, stepStop, direction); + if (g_sci->_gfxPalette->kernelPalVaryInit(paletteId, ticks, stepStop, direction)) + return SIGNAL_REG; warning("kPalVary(init) called with paletteId = %d, ticks = %d, stop = %d, direction = %d", paletteId, ticks, stepStop, direction); } else { warning("kPalVary(init) called with unsupported argc %d", argc); @@ -664,9 +665,13 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) { warning("kPalVary(1) called with parameter %d (argc %d)", argv[1].toUint16(), argc); break; } - case 2: { // Unknown - // Called in QFG4 demo (1 parameter) - warning("kPalVary(2) called with parameter %d (argc %d)", argv[1].toUint16(), argc); + case 2: { // Get Current Step + if (argc == 1) { + int16 currentStep = g_sci->_gfxPalette->kernelPalVaryGetCurrentStep(); + return make_reg(0, currentStep); + } else { + warning("kPalVary(GetCurrentStep) called with unsupported argc %d", argc); + } break; } case 3: { // DeInit @@ -687,11 +692,11 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) { warning("kPalVary(5) called with parameter %d (argc %d)", argv[1].toUint16(), argc); break; } - case 6: { // Pause + case 6: { // Pause/Resume bool pauseState; if (argc == 2) { pauseState = argv[1].isNull() ? false : true; - g_sci->_gfxPalette->kernelPalVaryToggle(pauseState); + g_sci->_gfxPalette->kernelPalVaryPause(pauseState); warning("kPalVary(pause) called with state = %d", pauseState); } else { warning("kPalVary(pause) called with unsupported argc %d", argc); diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp index 812bbfb234..f4222fabdd 100644 --- a/engines/sci/graphics/palette.cpp +++ b/engines/sci/graphics/palette.cpp @@ -488,11 +488,11 @@ void GfxPalette::palVaryInit() { _palVaryDirection = 0; } -void GfxPalette::kernelPalVaryInit(GuiResourceId resourceId, uint16 ticks, uint16 stepStop, int16 direction) { +bool GfxPalette::kernelPalVaryInit(GuiResourceId resourceId, uint16 ticks, uint16 stepStop, int16 direction) { //kernelSetFromResource(resourceId, true); //return; if (_palVaryResourceId != -1) // another palvary is taking place, return - return; + return false; _palVaryResourceId = resourceId; Resource *palResource = _resMan->findResource(ResourceId(kResourceTypePalette, resourceId), 0); @@ -513,10 +513,20 @@ void GfxPalette::kernelPalVaryInit(GuiResourceId resourceId, uint16 ticks, uint1 } // Call signal increase every [ticks] g_sci->getTimerManager()->installTimerProc(&palVaryCallback, 1000000 / 60 * ticks, this); + return true; } + return false; } -void GfxPalette::kernelPalVaryToggle(bool pause) { +int16 GfxPalette::kernelPalVaryGetCurrentStep() { + if (_palVaryDirection >= 0) + return _palVaryStep; + return -_palVaryStep; +} + +void GfxPalette::kernelPalVaryPause(bool pause) { + if (_palVaryResourceId == -1) + return; // this call is actually counting states, so calling this 3 times with true will require calling it later // 3 times with false to actually remove pause if (pause) { diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h index 861684ecb4..7ea231f13b 100644 --- a/engines/sci/graphics/palette.h +++ b/engines/sci/graphics/palette.h @@ -62,8 +62,9 @@ public: void kernelAnimateSet(); void kernelAssertPalette(GuiResourceId resourceId); - void kernelPalVaryInit(GuiResourceId resourceId, uint16 ticks, uint16 stopPercentage, int16 direction); - void kernelPalVaryToggle(bool pause); + bool kernelPalVaryInit(GuiResourceId resourceId, uint16 ticks, uint16 stopPercentage, int16 direction); + int16 kernelPalVaryGetCurrentStep(); + void kernelPalVaryPause(bool pause); void kernelPalVaryDeinit(); void palVaryUpdate(); void palVaryProcess(int signal, bool setPalette); |