Ticket #8307: palManipulateInit_new.patch

File palManipulateInit_new.patch, 4.2 KB (added by SF/madm00se, 20 years ago)

Implement palManipulateInit_new

  • gfx.cpp

    ? palManipulateInit_new.diff
    RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
    retrieving revision 2.235
    diff -u -r2.235 gfx.cpp
     
    29162916        _palManipCounter = time;
    29172917}
    29182918
     2919void ScummEngine::palManipulateInit_new(int palindex, int start, int end, int time) {
     2920        byte *pal, *target, *between;
     2921        const byte *new_pal;
     2922        int i;
     2923
     2924        new_pal = getPalettePtr(palindex);
     2925
     2926        new_pal+=start*3;
     2927
     2928        _palManipStart = start;
     2929        _palManipEnd = end;
     2930        _palManipCounter = 0;
     2931
     2932        if (!_palManipPalette)
     2933                _palManipPalette = (byte *)calloc(0x300, 1);
     2934        if (!_palManipIntermediatePal)
     2935                _palManipIntermediatePal = (byte *)calloc(0x600, 1);
     2936
     2937        pal = _currentPalette + start * 3;
     2938        target = _palManipPalette + start * 3;
     2939        between = _palManipIntermediatePal + start * 6;
     2940
     2941        for (i = start; i < end; ++i) {
     2942                *target++ = *new_pal++;
     2943                *target++ = *new_pal++;
     2944                *target++ = *new_pal++;
     2945                *(uint16 *)between = ((uint16) *pal++) << 8;
     2946                between += 2;
     2947                *(uint16 *)between = ((uint16) *pal++) << 8;
     2948                between += 2;
     2949                *(uint16 *)between = ((uint16) *pal++) << 8;
     2950                between += 2;
     2951        }
     2952
     2953        _palManipCounter = time;
     2954}
     2955
     2956
    29192957void ScummEngine::palManipulate() {
    29202958        byte *target, *pal, *between;
    29212959        int i, j;
     
    29693007}
    29703008
    29713009void ScummEngine::setupShadowPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor) {
    2972         const byte *basepal = getPalettePtr();
     3010        const byte *basepal = getPalettePtr(_curPalIndex);
    29733011        const byte *pal = basepal;
    29743012        const byte *compareptr;
    29753013        byte *table = _shadowPalette;
     
    30543092
    30553093        int i, j;
    30563094
    3057         palPtr = getPalettePtr();
     3095        palPtr = getPalettePtr(_curPalIndex);
    30583096
    30593097        for (i = 0; i < 256; i++)
    30603098                _proc_special_palette[i] = i;
     
    31033141                int j;
    31043142                int color;
    31053143
    3106                 cptr = getPalettePtr() + startColor * 3;
     3144                cptr = getPalettePtr(_curPalIndex) + startColor * 3;
    31073145                cur = _currentPalette + startColor * 3;
    31083146
    31093147                for (j = startColor; j <= endColor; j++) {
     
    31633201                byte *cur;
    31643202                int j;
    31653203
    3166                 cptr = getPalettePtr() + startColor * 3;
     3204                cptr = getPalettePtr(_curPalIndex) + startColor * 3;
    31673205                cur = _currentPalette + startColor * 3;
    31683206
    31693207                for (j = startColor; j <= endColor; j++) {
     
    33303368        const byte *pals;
    33313369
    33323370        _curPalIndex = palindex;
    3333         pals = getPalettePtr();
     3371        pals = getPalettePtr(_curPalIndex);
    33343372        setPaletteFromPtr(pals);
    33353373}
    33363374
     
    33543392        return offs + READ_LE_UINT32(offs + idx * sizeof(uint32));
    33553393}
    33563394
    3357 const byte *ScummEngine::getPalettePtr() {
     3395const byte *ScummEngine::getPalettePtr(int palindex) {
    33583396        const byte *cptr;
    33593397
    33603398        cptr = getResourceAddress(rtRoom, _roomResource);
     
    33623400        if (_CLUT_offs) {
    33633401                cptr += _CLUT_offs;
    33643402        } else {
    3365                 cptr = findPalInPals(cptr + _PALS_offs, _curPalIndex);
     3403                cptr = findPalInPals(cptr + _PALS_offs, palindex);
    33663404        }
    33673405        assert(cptr);
    33683406        return cptr;
  • script_v6.cpp

    RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
    retrieving revision 1.218
    diff -u -r1.218 script_v6.cpp
     
    15891589                c = pop();
    15901590                b = pop();
    15911591                a = pop();
    1592                 palManipulateInit(a, b, c, d);
     1592                palManipulateInit_new(a, b, c, d);
    15931593                break;
    15941594
    15951595        case 187:               // SO_CYCLE_SPEED
  • scumm.h

    RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
    retrieving revision 1.333
    diff -u -r1.333 scumm.h
     
    827827        void clampCameraPos(Common::Point *pt);
    828828        void actorFollowCamera(int act);
    829829
    830         const byte *getPalettePtr();
     830        const byte *getPalettePtr(int palindex);
    831831        void setupAmigaPalette();
    832832        void setupEGAPalette();
    833833        void setupV1ManiacPalette();
     
    843843        void cyclePalette();
    844844        void stopCycle(int i);
    845845        void palManipulateInit(int start, int end, int string_id, int time);
     846        void palManipulateInit_new(int palindex, int start, int end, int time);
    846847        void palManipulate();
    847848public:
    848849        int remapPaletteColor(int r, int g, int b, uint threshold);             // Used by Actor::remapActorPalette