diff options
author | Florian Kagerer | 2009-12-20 14:11:56 +0000 |
---|---|---|
committer | Florian Kagerer | 2009-12-20 14:11:56 +0000 |
commit | a21a8082505ff2abf5d403e8d129e35cd7ea58fd (patch) | |
tree | 6fad16440be6970666489eb907bb3b3916605b17 | |
parent | 980b8bb89937952529d0bc39ba04e9f306b1e792 (diff) | |
download | scummvm-rg350-a21a8082505ff2abf5d403e8d129e35cd7ea58fd.tar.gz scummvm-rg350-a21a8082505ff2abf5d403e8d129e35cd7ea58fd.tar.bz2 scummvm-rg350-a21a8082505ff2abf5d403e8d129e35cd7ea58fd.zip |
LOL: fixed text fading
svn-id: r46431
-rw-r--r-- | engines/kyra/lol.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/screen_lol.cpp | 26 | ||||
-rw-r--r-- | engines/kyra/screen_lol.h | 2 | ||||
-rw-r--r-- | engines/kyra/sound_towns.cpp | 15 |
4 files changed, 22 insertions, 23 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 7fb2ff2701..f08246a6da 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -1649,7 +1649,7 @@ void LoLEngine::fadeText() { if (!_fadeText) return; - if (_screen->fadeColor(192, 252, _system->getMillis() - _palUpdateTimer, 60 * _tickLength)) + if (_screen->fadeColor(192, 252, (_system->getMillis() - _palUpdateTimer) / _tickLength, 60)) return; if (_needSceneRestore) diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index 63545b252b..f15c8dd612 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -866,7 +866,7 @@ void Screen_LoL::copyColor(int dstColorIndex, int srcColorIndex) { _system->setPalette(ci, dstColorIndex, 1); } -bool Screen_LoL::fadeColor(int dstColorIndex, int srcColorIndex, uint32 elapsedTime, uint32 targetTime) { +bool Screen_LoL::fadeColor(int dstColorIndex, int srcColorIndex, uint32 elapsedTicks, uint32 totalTicks) { if (_use16ColorMode) return false; @@ -876,30 +876,28 @@ bool Screen_LoL::fadeColor(int dstColorIndex, int srcColorIndex, uint32 elapsedT bool res = false; - int16 t1 = 0; - int16 t2 = 0; - int32 t3 = 0; + int16 srcV = 0; + int16 dstV = 0; + int32 outV = 0; uint8 tmpPalEntry[3]; for (int i = 0; i < 3; i++) { - if (elapsedTime < targetTime) { - t1 = *src & 0x3f; - t2 = *dst & 0x3f; + if (elapsedTicks < totalTicks) { + srcV = *src & 0x3f; + dstV = *dst & 0x3f; - t3 = t1 - t2; - if (t3) + outV = srcV - dstV; + if (outV) res = true; - t3 = (((t3 << 8) / (int)targetTime) * (int)elapsedTime) >> 8; - t3 = t2 + t3; + outV = dstV + ((((outV << 8) / (int32)totalTicks) * (int32)elapsedTicks) >> 8); } else { - t1 = *dst & 0x3f; - *p = t3 = t1; + *p = outV = *src; res = false; } - tmpPalEntry[i] = t3 & 0xff; + tmpPalEntry[i] = outV & 0xff; src++; dst++; p++; diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h index 9c55b8a882..cdd18f98f6 100644 --- a/engines/kyra/screen_lol.h +++ b/engines/kyra/screen_lol.h @@ -74,7 +74,7 @@ public: void fadeToPalette1(int delay); void loadSpecialColors(Palette &dst); void copyColor(int dstColorIndex, int srcColorIndex); - bool fadeColor(int dstColorIndex, int srcColorIndex, uint32 elapsedTime, uint32 targetTime); + bool fadeColor(int dstColorIndex, int srcColorIndex, uint32 elapsedTicks, uint32 totalTicks); bool fadePaletteStep(uint8 *pal1, uint8 *pal2, uint32 elapsedTime, uint32 targetTime); Palette **generateFadeTable(Palette **dst, Palette *src1, Palette *src2, int numTabs); diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp index 089cc00c03..8e24d6f47b 100644 --- a/engines/kyra/sound_towns.cpp +++ b/engines/kyra/sound_towns.cpp @@ -3561,6 +3561,14 @@ void TownsPC98_OpnDriver::loadSoundEffectData(uint8 *data, uint8 trackNum) { void TownsPC98_OpnDriver::reset() { Common::StackLock lock(_mutex); + + _musicPlaying = false; + _sfxPlaying = false; + _fading = false; + _looping = 0; + _musicTickCounter = 0; + _sfxData = 0; + TownsPC98_OpnCore::reset(); for (int i = 0; i < _numChan; i++) @@ -3577,13 +3585,6 @@ void TownsPC98_OpnDriver::reset() { if (_rhythmChannel) _rhythmChannel->reset(); - - _musicPlaying = false; - _sfxPlaying = false; - _fading = false; - _looping = 0; - _musicTickCounter = 0; - _sfxData = 0; } void TownsPC98_OpnDriver::fadeStep() { |