diff options
author | Paul Gilbert | 2014-11-01 22:20:23 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-12-12 22:19:55 -0500 |
commit | f3063a13f08a2b085d92d0a79231e568671501b3 (patch) | |
tree | 2bc4544ce8ee93bf4f25d0a45b0d20df411941c1 /engines/access/screen.cpp | |
parent | 7e4d76b1fb41662cd48e21d775322d2a0ad3325e (diff) | |
download | scummvm-rg350-f3063a13f08a2b085d92d0a79231e568671501b3.tar.gz scummvm-rg350-f3063a13f08a2b085d92d0a79231e568671501b3.tar.bz2 scummvm-rg350-f3063a13f08a2b085d92d0a79231e568671501b3.zip |
ACCESS: Implement palette cycling script commands
Diffstat (limited to 'engines/access/screen.cpp')
-rw-r--r-- | engines/access/screen.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp index 227d9d7d0c..17f36fc072 100644 --- a/engines/access/screen.cpp +++ b/engines/access/screen.cpp @@ -59,6 +59,9 @@ Screen::Screen(AccessEngine *vm) : _vm(vm) { _vWindowLinesTall = this->h; _clipWidth = _vWindowBytesWide - 1; _clipHeight = _vWindowLinesTall - 1; + _startCycle = 0; + _cycleStart = 0; + _endCycle = 0; } void Screen::clearScreen() { @@ -244,4 +247,39 @@ void Screen::copyBlock(ASurface *src, const Common::Rect &bounds) { copyRectToSurface(*src, destBounds.left, destBounds.top, bounds); } +void Screen::setPaletteCycle(int startCycle, int endCycle, int timer) { + _startCycle = _cycleStart = startCycle; + _endCycle = endCycle; + + TimerEntry &te = _vm->_timers[6]; + te._timer = te._initTm = timer; + te._flag++; +} + +void Screen::cyclePaletteForward() { + cyclePaletteBackwards(); +} + +void Screen::cyclePaletteBackwards() { + if (!_vm->_timers[6]._flag) { + _vm->_timers[6]._flag++; + byte *pStart = &_rawPalette[_cycleStart * 3]; + byte *pEnd = &_rawPalette[_endCycle * 3]; + + for (int idx = _startCycle; idx < _endCycle; ++idx) { + g_system->getPaletteManager()->setPalette(pStart, idx, 1); + + pStart += 3; + if (pStart == pEnd) + pStart = &_rawPalette[_cycleStart * 3]; + } + + if (--_cycleStart <= _startCycle) + _cycleStart = _endCycle - 1; + + g_system->updateScreen(); + g_system->delayMillis(10); + } +} + } // End of namespace Access |