Ticket #4160: bs1-palette.diff

File bs1-palette.diff, 1.8 KB (added by eriktorbjorn, 15 years ago)

Patch against current SVN

  • engines/sword1/screen.h

     
    137137        uint8  _rleBuffer[RLE_BUFFER_SIZE];
    138138        uint8  _shrinkBuffer[SHRINK_BUFFER_SIZE];
    139139        bool   _fullRefresh;
     140        bool   _updatePalette;
    140141        uint16 _oldScrollX, _oldScrollY; // for drawing additional frames
    141142
    142143        uint32  _foreList[MAX_FORE];
  • engines/sword1/screen.cpp

     
    5555        _backLength = _foreLength = _sortLength = 0;
    5656        _fadingStep = 0;
    5757        _currentScreen = 0xFFFF;
     58        _updatePalette = false;
    5859}
    5960
    6061Screen::~Screen(void) {
     
    186187}
    187188
    188189void Screen::updateScreen(void) {
     190        if (_updatePalette) {
     191                fnSetPalette(0, 184, _roomDefTable[_currentScreen].palettes[0], false);
     192                fnSetPalette(184, 72, _roomDefTable[_currentScreen].palettes[1], false);
     193                _updatePalette = false;
     194        }
    189195        if (Logic::_scriptVars[NEW_PALETTE]) {
    190196                _fadingStep = 1;
    191197                _fadingDirection = FADE_UP;
     
    338344        if (_roomDefTable[_currentScreen].parallax[1])
    339345                _parallax[1] = (uint8*)_resMan->openFetchRes(_roomDefTable[_currentScreen].parallax[1]);
    340346
    341         fnSetPalette(0, 184, _roomDefTable[_currentScreen].palettes[0], SwordEngine::_systemVars.wantFade);
    342         fnSetPalette(184, 72, _roomDefTable[_currentScreen].palettes[1], SwordEngine::_systemVars.wantFade);
     347        if (SwordEngine::_systemVars.wantFade) {
     348                fnSetPalette(0, 184, _roomDefTable[_currentScreen].palettes[0], SwordEngine::_systemVars.wantFade);
     349                fnSetPalette(184, 72, _roomDefTable[_currentScreen].palettes[1], SwordEngine::_systemVars.wantFade);
     350        } else
     351                _updatePalette = true;
    343352        _fullRefresh = true;
    344353}
    345354