aboutsummaryrefslogtreecommitdiff
path: root/engines/sword1/screen.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2009-02-15 22:33:18 +0000
committerWillem Jan Palenstijn2009-02-15 22:33:18 +0000
commitd2e8256439423dcf9721c951de681b69a4e477b5 (patch)
treef6668a762ffd971b95fe457a286f18741e1dd39b /engines/sword1/screen.cpp
parent78e0d055eae23f701b1fc2467c1b2f90041c3679 (diff)
downloadscummvm-rg350-d2e8256439423dcf9721c951de681b69a4e477b5.tar.gz
scummvm-rg350-d2e8256439423dcf9721c951de681b69a4e477b5.tar.bz2
scummvm-rg350-d2e8256439423dcf9721c951de681b69a4e477b5.zip
defer BS1 palette update from newScreen to updateScreen, based on patch by eriktorbjorn for bug #2599963. Maybe suitable for branch-0-13-0 after more testing.
svn-id: r38320
Diffstat (limited to 'engines/sword1/screen.cpp')
-rw-r--r--engines/sword1/screen.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/engines/sword1/screen.cpp b/engines/sword1/screen.cpp
index d7498ade31..3f4938fe99 100644
--- a/engines/sword1/screen.cpp
+++ b/engines/sword1/screen.cpp
@@ -55,6 +55,7 @@ Screen::Screen(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan) {
_backLength = _foreLength = _sortLength = 0;
_fadingStep = 0;
_currentScreen = 0xFFFF;
+ _updatePalette = false;
}
Screen::~Screen(void) {
@@ -169,7 +170,7 @@ bool Screen::stillFading(void) {
}
bool Screen::showScrollFrame(void) {
- if ((!_fullRefresh) || Logic::_scriptVars[NEW_PALETTE])
+ if ((!_fullRefresh) || Logic::_scriptVars[NEW_PALETTE] || _updatePalette)
return false; // don't draw an additional frame if we aren't scrolling or have to change the palette
if ((_oldScrollX == Logic::_scriptVars[SCROLL_OFFSET_X]) &&
(_oldScrollY == Logic::_scriptVars[SCROLL_OFFSET_Y]))
@@ -187,10 +188,14 @@ void Screen::updateScreen(void) {
if (Logic::_scriptVars[NEW_PALETTE]) {
_fadingStep = 1;
_fadingDirection = FADE_UP;
- fnSetPalette(0, 184, _roomDefTable[_currentScreen].palettes[0], true);
- fnSetPalette(184, 72, _roomDefTable[_currentScreen].palettes[1], true);
+ _updatePalette = true;
Logic::_scriptVars[NEW_PALETTE] = 0;
}
+ if (_updatePalette) {
+ fnSetPalette(0, 184, _roomDefTable[_currentScreen].palettes[0], false);
+ fnSetPalette(184, 72, _roomDefTable[_currentScreen].palettes[1], false);
+ _updatePalette = false;
+ }
if (_fadingStep) {
fadePalette();
_system->setPalette(_currentPalette, 0, 256);
@@ -336,8 +341,7 @@ void Screen::newScreen(uint32 screen) {
if (_roomDefTable[_currentScreen].parallax[1])
_parallax[1] = (uint8*)_resMan->openFetchRes(_roomDefTable[_currentScreen].parallax[1]);
- fnSetPalette(0, 184, _roomDefTable[_currentScreen].palettes[0], SwordEngine::_systemVars.wantFade);
- fnSetPalette(184, 72, _roomDefTable[_currentScreen].palettes[1], SwordEngine::_systemVars.wantFade);
+ _updatePalette = true;
_fullRefresh = true;
}