Ticket #8226: spec-palette2.diff

File spec-palette2.diff, 4.2 KB (added by eriktorbjorn, 21 years ago)

Revised patch against a May 17 CVS snapshot

  • scummvm/scumm/costume.cpp

    diff -ur ScummVM/scummvm/scumm/costume.cpp ScummVM+hack/scummvm/scumm/costume.cpp
    old new  
    299299        if (masking || charsetmask) {
    300300                _mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + _ypos * _numStrips + _vm->_screenStartStrip;
    301301                _imgbufoffs = _vm->gdi._imgBufOffs[_zbuf];
    302                 if (!charsetmask && _zbuf != 0)
     302                if (!charsetmask && _zbuf != 0) {
    303303                        _mask_ptr += _imgbufoffs;
     304                        _imgbufoffs = 0;
     305                }
    304306                _mask_ptr_dest = _mask_ptr + _xpos / 8;
    305307        }
    306308
    307309        CHECK_HEAP
    308310        if (_shadow_mode) {
    309                 proc_special((masking << 1) + charsetmask);
     311                proc_special((masking << 1) | (charsetmask ? 1 : 0));
    310312                return b;
    311313        }
    312314
     
    652654}
    653655
    654656void CostumeRenderer::proc1() {
    655         byte *mask, *src, *dst, *dstorg;
     657        byte *mask, *src, *dst;
    656658        byte maskbit, len, height, pcolor, width;
    657659        int color, t;
    658660        uint y;
     
    661663        maskbit = revBitMask[_xpos & 7];
    662664        y = _ypos;
    663665        src = _srcptr;
    664         dstorg = dst = _backbuff_ptr;
     666        dst = _backbuff_ptr;
    665667        len = _replen;
    666668        color = _repcolor;
    667669        height = _height2;
     
    10781080}
    10791081
    10801082void CostumeRenderer::proc_special(byte mask2) {
    1081         byte *mask, *src, *dst, *dstorg;
     1083        byte *mask, *src, *dst;
    10821084        byte maskbit, len, height, pcolor, width;
     1085        int color, t;
    10831086        uint y;
    1084         int color;
    1085         int t;
    10861087
    10871088        byte shadow1;
    10881089        byte shadow2;
     
    10961097        shadow4 = _shadow_mode & 0x10;
    10971098        shadow5 = _shadow_mode & 0x0F;
    10981099
    1099         mask = _mask_ptr = _mask_ptr_dest;
    1100         maskbit = revBitMask[_xpos & 7];
    1101         y = _ypos;
    1102 
    1103         mask = _mask_ptr_dest;
    1104         dstorg = dst = _backbuff_ptr;
    1105         height = _height2;
    1106         width = _width2;
    1107         len = _replen;
    1108         color = _repcolor;
    1109         src = _srcptr;
    1110 
    11111100        if (_mirror == 0)
    11121101                shadow5 = -shadow5;
    11131102
     1103        mask = _mask_ptr_dest;
    11141104        maskbit = revBitMask[_xpos & 7];
    1115 
     1105        y = _ypos;
     1106        src = _srcptr;
    11161107        dst = _backbuff_ptr;
    1117 
    1118         if (mask2 != 0 && mask2 < 3)
    1119                 _imgbufoffs = 0;
     1108        len = _replen;
     1109        color = _repcolor;
     1110        height = _height2;
     1111        width = _width2;
    11201112
    11211113        if (_docontinue)
    11221114                goto StartPos;
     
    11281120                if (!len)
    11291121                        len = *src++;
    11301122
    1131                 do {                                                                                            // ok
    1132                         if (cost_scaleTable[_scaleIndexY++] < _scaleY) {
    1133                                 if (color && y < _outheight) {
    1134                                         if (!mask2 || (mask2 && !((*mask | mask[_imgbufoffs]) & maskbit))) {
    1135                                                 if (shadow3 == 0) {
    1136                                                         pcolor = _palette[color];
    1137                                                         if (pcolor != 13)
    1138                                                                 goto proc_special_end;
    1139 
    1140                                                 }
    1141                                                 if (shadow2 != 0) {
    1142                                                         warning("proc_special: shadow2 unimplemented");
    1143                                                         pcolor = 0;
    1144                                                 } else                                                  // we don't need all the random stuff, just the background copy
    1145                                                 {
    1146                                                         pcolor = _vm->_proc_special_palette[*dst];
    1147                                                 }
    1148                                         proc_special_end:;
    1149                                                 *dst = pcolor;
     1123                do {
     1124                        if (_scaleY == 255 || cost_scaleTable[_scaleIndexY++] < _scaleY) {
     1125                                if (color && y < _outheight && (!mask2 || !((*mask | mask[_imgbufoffs]) & maskbit))) {
     1126                                        if (shadow3 == 0) {
     1127                                                pcolor = _palette[color];
     1128                                                if (pcolor != 13)
     1129                                                        goto proc_special_end;
    11501130                                        }
     1131                                        if (shadow2 != 0) {
     1132                                                warning("proc_special: shadow2 unimplemented");
     1133                                                pcolor = 0;
     1134                                        } else {
     1135                                                // we don't need all the random stuff, just the background copy
     1136                                                pcolor = _vm->_proc_special_palette[*dst];
     1137                                        }
     1138                                                proc_special_end:;
     1139                                                *dst = pcolor;
    11511140                                }
    11521141                                dst += _vm->_screenWidth;
    11531142                                mask += _numStrips;
     
    11611150                                _scaleIndexY = _scaleIndexYTop;
    11621151                                t = _scaleIndexX;
    11631152                                _scaleIndexX = t + _scaleIndexXStep;
    1164                                 if (cost_scaleTable[t] < _scaleX) {
     1153                                if (_scaleX == 255 || cost_scaleTable[t] < _scaleX) {
    11651154                                        _xpos += _scaleIndexXStep;
    11661155                                        if (_xpos < 0 || _xpos >= _vm->_screenWidth)
    11671156                                                return;
  • scummvm/scumm/gfx.cpp

    diff -ur ScummVM/scummvm/scumm/gfx.cpp ScummVM+hack/scummvm/scumm/gfx.cpp
    old new  
    31043104                int g = (int) (*curPtr++ * greenScale) >> 8;
    31053105                int b = (int) (*curPtr++ * blueScale) >> 8;
    31063106
    3107                 searchPtr = palPtr;
     3107                searchPtr = palPtr + from * 3;
    31083108                bestResult = 32000;
    3109                 currentIndex = 0;
     3109                currentIndex = from;
    31103110
    31113111                for (j = from; j < to; j++) {
    31123112                        int ar = (*searchPtr++);