diff options
author | Sven Hesse | 2012-06-14 15:24:49 +0200 |
---|---|---|
committer | Sven Hesse | 2012-06-14 15:24:49 +0200 |
commit | ccad083ab905b1e708bc9b7b3db501c9f1f028ab (patch) | |
tree | a3ce68e7d5f9e150bbdc4c764f42c9bcc5e03f30 | |
parent | 198c116061d58c19e5a0bd97f47925bb7d585923 (diff) | |
download | scummvm-rg350-ccad083ab905b1e708bc9b7b3db501c9f1f028ab.tar.gz scummvm-rg350-ccad083ab905b1e708bc9b7b3db501c9f1f028ab.tar.bz2 scummvm-rg350-ccad083ab905b1e708bc9b7b3db501c9f1f028ab.zip |
GOB: Fix a "condition depends on uninitialised value" in Geisha
-rw-r--r-- | engines/gob/palanim.cpp | 93 |
1 files changed, 24 insertions, 69 deletions
diff --git a/engines/gob/palanim.cpp b/engines/gob/palanim.cpp index 8a5327c3f1..f90b141725 100644 --- a/engines/gob/palanim.cpp +++ b/engines/gob/palanim.cpp @@ -75,47 +75,28 @@ bool PalAnim::fadeStepColor(int color) { bool PalAnim::fadeStep(int16 oper) { bool stop = true; - byte newRed; - byte newGreen; - byte newBlue; if (oper == 0) { - if (_vm->_global->_setAllPalette) { - if (_vm->_global->_inVM != 0) - error("PalAnim::fadeStep(): _vm->_global->_inVM != 0 not supported"); - - for (int i = 0; i < 256; i++) { - newRed = fadeColor(_vm->_global->_redPalette[i], _toFadeRed[i]); - newGreen = fadeColor(_vm->_global->_greenPalette[i], _toFadeGreen[i]); - newBlue = fadeColor(_vm->_global->_bluePalette[i], _toFadeBlue[i]); - - if ((_vm->_global->_redPalette[i] != newRed) || - (_vm->_global->_greenPalette[i] != newGreen) || - (_vm->_global->_bluePalette[i] != newBlue)) { - - _vm->_video->setPalElem(i, newRed, newGreen, newBlue, 0, 0x13); - - _vm->_global->_redPalette[i] = newRed; - _vm->_global->_greenPalette[i] = newGreen; - _vm->_global->_bluePalette[i] = newBlue; - stop = false; - } - } - } else { - for (int i = 0; i < 16; i++) { - - _vm->_video->setPalElem(i, - fadeColor(_vm->_global->_redPalette[i], _toFadeRed[i]), - fadeColor(_vm->_global->_greenPalette[i], _toFadeGreen[i]), - fadeColor(_vm->_global->_bluePalette[i], _toFadeBlue[i]), - -1, _vm->_global->_videoMode); - - if ((_vm->_global->_redPalette[i] != _toFadeRed[i]) || - (_vm->_global->_greenPalette[i] != _toFadeGreen[i]) || - (_vm->_global->_bluePalette[i] != _toFadeBlue[i])) - stop = false; + int colorCount = _vm->_global->_setAllPalette ? _vm->_global->_colorCount : 256; + + for (int i = 0; i < colorCount; i++) { + byte newRed = fadeColor(_vm->_global->_redPalette [i], _toFadeRed [i]); + byte newGreen = fadeColor(_vm->_global->_greenPalette[i], _toFadeGreen[i]); + byte newBlue = fadeColor(_vm->_global->_bluePalette [i], _toFadeBlue [i]); + + if ((_vm->_global->_redPalette [i] != newRed ) || + (_vm->_global->_greenPalette[i] != newGreen) || + (_vm->_global->_bluePalette [i] != newBlue)) { + + _vm->_video->setPalElem(i, newRed, newGreen, newBlue, 0, 0x13); + + _vm->_global->_redPalette [i] = newRed; + _vm->_global->_greenPalette[i] = newGreen; + _vm->_global->_bluePalette [i] = newBlue; + stop = false; } } + } else if ((oper > 0) && (oper < 4)) stop = fadeStepColor(oper - 1); @@ -124,44 +105,18 @@ bool PalAnim::fadeStep(int16 oper) { void PalAnim::fade(Video::PalDesc *palDesc, int16 fadeV, int16 allColors) { bool stop; - int16 i; if (_vm->shouldQuit()) return; _fadeValue = (fadeV < 0) ? -fadeV : 2; - if (!_vm->_global->_setAllPalette) { - if (!palDesc) { - for (i = 0; i < 16; i++) { - _toFadeRed[i] = 0; - _toFadeGreen[i] = 0; - _toFadeBlue[i] = 0; - } - } else { - for (i = 0; i < 16; i++) { - _toFadeRed[i] = palDesc->vgaPal[i].red; - _toFadeGreen[i] = palDesc->vgaPal[i].green; - _toFadeBlue[i] = palDesc->vgaPal[i].blue; - } - } - } else { - if (_vm->_global->_inVM != 0) - error("PalAnim::fade(): _vm->_global->_inVM != 0 is not supported"); - - if (!palDesc) { - for (i = 0; i < 256; i++) { - _toFadeRed[i] = 0; - _toFadeGreen[i] = 0; - _toFadeBlue[i] = 0; - } - } else { - for (i = 0; i < 256; i++) { - _toFadeRed[i] = palDesc->vgaPal[i].red; - _toFadeGreen[i] = palDesc->vgaPal[i].green; - _toFadeBlue[i] = palDesc->vgaPal[i].blue; - } - } + int colorCount = _vm->_global->_setAllPalette ? _vm->_global->_colorCount : 256; + + for (int i = 0; i < colorCount; i++) { + _toFadeRed [i] = (palDesc == 0) ? 0 : palDesc->vgaPal[i].red; + _toFadeGreen[i] = (palDesc == 0) ? 0 : palDesc->vgaPal[i].green; + _toFadeBlue [i] = (palDesc == 0) ? 0 : palDesc->vgaPal[i].blue; } if (allColors == 0) { |