diff -ur ScummVM-cvs20020723/scummvm/gfx.cpp ScummVM-cvs20020723+hack/scummvm/gfx.cpp
old
|
new
|
|
2359 | 2359 | } |
2360 | 2360 | } |
2361 | 2361 | |
| 2362 | void 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 | |
2362 | 2397 | void Scumm::grabCursor(int x, int y, int w, int h) |
2363 | 2398 | { |
2364 | 2399 | VirtScreen *vs = findVirtScreen(y); |
diff -ur ScummVM-cvs20020723/scummvm/script_v2.cpp ScummVM-cvs20020723+hack/scummvm/script_v2.cpp
old
|
new
|
|
2836 | 2836 | createSpecialPalette(args[1], args[2], args[3], args[4], args[5], args[6], args[7]); |
2837 | 2837 | break; |
2838 | 2838 | |
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()"); |
2841 | 2845 | break; |
2842 | 2846 | |
2843 | 2847 | case 117: |
diff -ur ScummVM-cvs20020723/scummvm/scumm.h ScummVM-cvs20020723+hack/scummvm/scumm.h
old
|
new
|
|
880 | 880 | void moveMemInPalRes(int start, int end, byte direction); |
881 | 881 | void setupShadowPalette(int slot, int rfact, int gfact, int bfact, int from, int to); |
882 | 882 | void darkenPalette(int a, int b, int c, int d, int e); |
| 883 | void desaturatePalette(); |
883 | 884 | |
884 | 885 | void setShake(int mode); |
885 | 886 | |
diff -ur ScummVM-cvs20020723/scummvm/scummvm.cpp ScummVM-cvs20020723+hack/scummvm/scummvm.cpp
old
|
new
|
|
1376 | 1376 | int i; |
1377 | 1377 | byte *data = _currentPalette + first * 3; |
1378 | 1378 | |
| 1379 | // Sam & Max film noir mode |
| 1380 | if (_gameId == GID_SAMNMAX && readVar(0x8000)) |
| 1381 | desaturatePalette(); |
| 1382 | |
1379 | 1383 | byte palette_colors[1024],*p = palette_colors; |
1380 | 1384 | |
1381 | 1385 | for (i = 0; i != num; i++, data += 3, p+=4) { |