Ticket #7990: noir.diff

File noir.diff, 2.6 KB (added by eriktorbjorn, 22 years ago)

Sam & Max "film noir" patch

  • scummvm/gfx.cpp

    diff -ur ScummVM-cvs20020723/scummvm/gfx.cpp ScummVM-cvs20020723+hack/scummvm/gfx.cpp
    old new  
    23592359        }
    23602360}
    23612361
     2362void Scumm::desaturatePalette()
     2363{
     2364        // FIXME: Should this be made to take a range of colors instead?
     2365
     2366        byte *cur;
     2367        int i;
     2368
     2369        cur = _currentPalette;
     2370   
     2371        for (i = 0; i <= 255; i++)
     2372        {
     2373                int max, min;
     2374                int brightness;
     2375
     2376                // An algorithm that is good enough for The GIMP should be
     2377                // good enough for us...
     2378
     2379                max = (cur[0] > cur[1]) ? cur[0] : cur[1];
     2380                if (cur[2] > max)
     2381                        max = cur[2];
     2382
     2383                min = (cur[0] < cur[1]) ? cur[0] : cur[1];
     2384                if (cur[2] < min)
     2385                        min = cur[2];
     2386
     2387                brightness = (min + max) / 2;
     2388
     2389                *cur++ = brightness;
     2390                *cur++ = brightness;
     2391                *cur++ = brightness;
     2392        }
     2393
     2394        setDirtyColors(0, 255);
     2395}
     2396
    23622397void Scumm::grabCursor(int x, int y, int w, int h)
    23632398{
    23642399        VirtScreen *vs = findVirtScreen(y);
  • scummvm/script_v2.cpp

    diff -ur ScummVM-cvs20020723/scummvm/script_v2.cpp ScummVM-cvs20020723+hack/scummvm/script_v2.cpp
    old new  
    28362836                        createSpecialPalette(args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
    28372837                        break;
    28382838
    2839                 case 114:                                                                       /* palette? */
    2840                         warning("stub o6_miscOps_114()");
     2839                case 114:
     2840                        // Sam & Max film noir mode
     2841                        if (_gameId == GID_SAMNMAX)
     2842                                desaturatePalette();
     2843                        else
     2844                                warning("stub o6_miscOps_114()");
    28412845                        break;
    28422846
    28432847                case 117:
  • scummvm/scumm.h

    diff -ur ScummVM-cvs20020723/scummvm/scumm.h ScummVM-cvs20020723+hack/scummvm/scumm.h
    old new  
    880880        void moveMemInPalRes(int start, int end, byte direction);
    881881        void setupShadowPalette(int slot, int rfact, int gfact, int bfact, int from, int to);
    882882        void darkenPalette(int a, int b, int c, int d, int e);
     883        void desaturatePalette();
    883884
    884885        void setShake(int mode);
    885886
  • scummvm/scummvm.cpp

    diff -ur ScummVM-cvs20020723/scummvm/scummvm.cpp ScummVM-cvs20020723+hack/scummvm/scummvm.cpp
    old new  
    13761376        int i;
    13771377        byte *data = _currentPalette + first * 3;
    13781378
     1379        // Sam & Max film noir mode
     1380        if (_gameId == GID_SAMNMAX && readVar(0x8000))
     1381                desaturatePalette();
     1382       
    13791383        byte palette_colors[1024],*p = palette_colors;
    13801384       
    13811385        for (i = 0; i != num; i++, data += 3, p+=4) {