Ticket #1745: updated.diff

File updated.diff, 5.0 KB (added by Kirben, 19 years ago)

Updated patch for current ScummVM cvs

  • scumm/insane/insane.cpp

    RCS file: /cvsroot/scummvm/scummvm/scumm/insane/insane.cpp,v
    retrieving revision 1.57
    diff -u -r1.57 insane.cpp
     
    619619}
    620620
    621621void Insane::smush_warpMouse(int x, int y, int buttons) {
    622         _vm->_system->warpMouse(x, y);
     622        _player->warpMouse(x, y, buttons);
    623623}
    624624
    625625void Insane::putActors(void) {
  • scumm/smush/smush_player.cpp

    RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_player.cpp,v
    retrieving revision 1.157
    diff -u -r1.157 smush_player.cpp
     
    696696                        _deltaPal[i] = b.getWord();
    697697                }
    698698                readPalette(_pal, b);
    699                 setPalette(_pal);
     699                setDirtyColors(0, 255);
    700700        } else if (b.getSize() == 6) {
    701701
    702702                b.getWord();
     
    706706                for (int i = 0; i < 0x300; i++) {
    707707                        _pal[i] = delta_color(_pal[i], _deltaPal[i]);
    708708                }
    709                 setPalette(_pal);
     709                setDirtyColors(0, 255);
    710710        } else {
    711711                error("SmushPlayer::handleDeltaPalette() Wrong size for DeltaPalette");
    712712        }
     
    717717        debugC(DEBUG_SMUSH, "SmushPlayer::handleNewPalette()");
    718718
    719719        readPalette(_pal, b);
    720         setPalette(_pal);
     720        setDirtyColors(0, 255);
    721721}
    722722
    723723void smush_decode_codec1(byte *dst, byte *src, int left, int top, int height, int width, int dstWidth);
     
    970970        _nbframes = b.getWord();
    971971        b.getWord();
    972972        readPalette(_pal, b);
    973         setPalette(_pal);
     973        setDirtyColors(0, 255);
    974974}
    975975
    976976void SmushPlayer::setupAnim(const char *file) {
     
    10551055}
    10561056
    10571057void SmushPlayer::setPalette(const byte *palette) {
    1058         byte palette_colors[1024];
    1059         byte *p = palette_colors;
    1060 
    1061         for (int i = 0; i != 256; ++i) {
    1062                 *p++ = _pal[i * 3 + 0] = *palette++; // red
    1063                 *p++ = _pal[i * 3 + 1] = *palette++; // green
    1064                 *p++ = _pal[i * 3 + 2] = *palette++; // blue
    1065                 *p++ = 0;
    1066         }
    1067 
    1068         _vm->_system->setPalette(palette_colors, 0, 256);
     1058        memcpy(_pal, palette, 0x300);
     1059        setDirtyColors(0, 255);
    10691060}
    10701061
    10711062void SmushPlayer::setPaletteValue(int n, byte r, byte g, byte b) {
    10721063        _pal[n * 3 + 0] = r;
    10731064        _pal[n * 3 + 1] = g;
    10741065        _pal[n * 3 + 2] = b;
     1066        setDirtyColors(n, n);
     1067}
     1068
     1069void SmushPlayer::setDirtyColors(int min, int max) {
     1070        if (_palDirtyMin > min)
     1071                _palDirtyMin = min;
     1072        if (_palDirtyMax < max)
     1073                _palDirtyMax = max;
     1074}
    10751075
    1076         _vm->_system->setPalette(_pal, n, 1);
     1076void SmushPlayer::warpMouse(int x, int y, int buttons) {
     1077        _warpNeeded = true;
     1078        _warpX = x;
     1079        _warpY = y;
     1080        _warpButtons = buttons;
    10771081}
    10781082
    10791083void SmushPlayer::updateScreen() {
     
    11291133#endif
    11301134
    11311135        uint32 end_time, start_time = _vm->_system->getMillis();
    1132         _vm->_system->copyRectToScreen(_dst, _width, 0, 0, _width, _height);
    11331136        _updateNeeded = true;
    11341137        end_time = _vm->_system->getMillis();
    11351138        debugC(DEBUG_SMUSH, "Smush stats: updateScreen( %03d )", end_time - start_time);
     
    12151218        tryCmpFile(filename);
    12161219
    12171220        _updateNeeded = false;
     1221        _warpNeeded = false;
     1222        _palDirtyMin = 256;
     1223        _palDirtyMax = -1;
    12181224       
    12191225        // Hide mouse
    12201226        bool oldMouseState = _vm->_system->showMouse(false);
     
    12301236        }
    12311237
    12321238        for (;;) {
     1239                if (_warpNeeded) {
     1240                        _vm->_system->warpMouse(_warpX, _warpY);
     1241                        _warpNeeded = false;
     1242                }
    12331243                _vm->parseEvents();
    12341244                _vm->processKbd(true);
     1245                if (_palDirtyMax >= _palDirtyMin) {
     1246                        byte palette_colors[1024];
     1247                        byte *p = palette_colors;
     1248
     1249                        for (int i = _palDirtyMin; i <= _palDirtyMax; i++) {
     1250                                byte *data = _pal + i * 3;
     1251
     1252                                *p++ = data[0];
     1253                                *p++ = data[1];
     1254                                *p++ = data[2];
     1255                                *p++ = 0;
     1256                        }
     1257
     1258                        _vm->_system->setPalette(palette_colors, _palDirtyMin, _palDirtyMax - _palDirtyMin + 1);
     1259
     1260                        _palDirtyMax = -1;
     1261                        _palDirtyMin = 256;
     1262                }
    12351263                if (_updateNeeded) {
    12361264                       
    12371265                        uint32 end_time, start_time;
    12381266                       
    12391267                        start_time = _vm->_system->getMillis();
     1268                        _vm->_system->copyRectToScreen(_dst, _width, 0, 0, _width, _height);
    12401269                        _vm->_system->updateScreen();
    12411270                        _updateNeeded = false;
    12421271#ifdef _WIN32_WCE
  • scumm/smush/smush_player.h

    RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_player.h,v
    retrieving revision 1.45
    diff -u -r1.45 smush_player.h
     
    7373
    7474        byte *_dst;
    7575        bool _updateNeeded;
     76        bool _warpNeeded;
     77        int _palDirtyMin, _palDirtyMax;
     78        int _warpX, _warpY;
     79        int _warpButtons;
    7680        bool _insanity;
    7781        bool _middleAudio;
    7882#ifdef _WIN32_WCE
     
    8892        ~SmushPlayer();
    8993
    9094        void play(const char *filename, int32 offset = 0, int32 startFrame = 0);
     95        void warpMouse(int x, int y, int buttons);
    9196
    9297protected:
    9398        SmushFont *_sf[5];
     
    98103        void insanity(bool);
    99104        void setPalette(const byte *palette);
    100105        void setPaletteValue(int n, byte r, byte g, byte b);
     106        void setDirtyColors(int min, int max);
    101107        void seekSan(const char *file, int32 pos, int32 contFrame);
    102108        const char *getString(int id);
    103109