diff options
author | Bastien Bouclet | 2010-11-29 20:58:10 +0000 |
---|---|---|
committer | Bastien Bouclet | 2010-11-29 20:58:10 +0000 |
commit | 90b336ec344157c1896e409ecbb8beab1c45923d (patch) | |
tree | 9de01789cade3b0f8a62c7f2b0d47812175821e9 /engines/mohawk/myst.cpp | |
parent | a9617cbe2888be357d6dbee9899f34827d159b26 (diff) | |
download | scummvm-rg350-90b336ec344157c1896e409ecbb8beab1c45923d.tar.gz scummvm-rg350-90b336ec344157c1896e409ecbb8beab1c45923d.tar.bz2 scummvm-rg350-90b336ec344157c1896e409ecbb8beab1c45923d.zip |
MOHAWK: Changed sliders to restore the main background instead of doing their own background caching. It is possible now there is the image cache.
svn-id: r54626
Diffstat (limited to 'engines/mohawk/myst.cpp')
-rw-r--r-- | engines/mohawk/myst.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp index 6e24101331..ce6b5e8bc6 100644 --- a/engines/mohawk/myst.cpp +++ b/engines/mohawk/myst.cpp @@ -396,16 +396,24 @@ void MohawkEngine_Myst::changeToStack(uint16 stack) { _gfx->clearCache(); } -void MohawkEngine_Myst::drawCardBackground() { -if (_view.conditionalImageCount != 0) { - for (uint16 i = 0; i < _view.conditionalImageCount; i++) { - if (_scriptParser->getVar(_view.conditionalImages[i].var) < _view.conditionalImages[i].numStates) - _gfx->copyImageToScreen(_view.conditionalImages[i].values[_scriptParser->getVar(_view.conditionalImages[i].var)], Common::Rect(0, 0, 544, 333)); - else - warning("Conditional image %d variable %d: %d exceeds maximum state of %d", i, _view.conditionalImages[i].var, _scriptParser->getVar(_view.conditionalImages[i].var), _view.conditionalImages[i].numStates-1); +uint16 MohawkEngine_Myst::getCardBackgroundId() { + uint16 imageToDraw = 0; + + if (_view.conditionalImageCount == 0) + imageToDraw = _view.mainImage; + else { + for (uint16 i = 0; i < _view.conditionalImageCount; i++) { + uint16 varValue = _scriptParser->getVar(_view.conditionalImages[i].var); + if (varValue < _view.conditionalImages[i].numStates) + imageToDraw = _view.conditionalImages[i].values[varValue]; + } } -} else if (_view.mainImage != 0) - _gfx->copyImageToScreen(_view.mainImage, Common::Rect(0, 0, 544, 333)); + + return imageToDraw; +} + +void MohawkEngine_Myst::drawCardBackground() { + _gfx->copyImageToScreen(getCardBackgroundId(), Common::Rect(0, 0, 544, 333)); } void MohawkEngine_Myst::changeToCard(uint16 card) { |