[Scummvm-cvs-logs] CVS: scummvm gfx.cpp,1.103,1.104 script_v2.cpp,1.77,1.78 scumm.h,1.189,1.190 scummvm.cpp,1.190,1.191
Jonathan Gray
khalek at users.sourceforge.net
Fri Jul 26 10:04:02 CEST 2002
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv20993
Modified Files:
gfx.cpp script_v2.cpp scumm.h scummvm.cpp
Log Message:
samnmax film noir mode patch by eriktorbjorn
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gfx.cpp,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -d -r1.103 -r1.104
--- gfx.cpp 22 Jul 2002 13:40:03 -0000 1.103
+++ gfx.cpp 26 Jul 2002 17:03:02 -0000 1.104
@@ -2359,6 +2359,41 @@
}
}
+void Scumm::desaturatePalette()
+{
+ // FIXME: Should this be made to take a range of colors instead?
+
+ byte *cur;
+ int i;
+
+ cur = _currentPalette;
+
+ for (i = 0; i <= 255; i++)
+ {
+ int max, min;
+ int brightness;
+
+ // An algorithm that is good enough for The GIMP should be
+ // good enough for us...
+
+ max = (cur[0] > cur[1]) ? cur[0] : cur[1];
+ if (cur[2] > max)
+ max = cur[2];
+
+ min = (cur[0] < cur[1]) ? cur[0] : cur[1];
+ if (cur[2] < min)
+ min = cur[2];
+
+ brightness = (min + max) / 2;
+
+ *cur++ = brightness;
+ *cur++ = brightness;
+ *cur++ = brightness;
+ }
+
+ setDirtyColors(0, 255);
+}
+
void Scumm::grabCursor(int x, int y, int w, int h)
{
VirtScreen *vs = findVirtScreen(y);
Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script_v2.cpp,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- script_v2.cpp 18 Jul 2002 15:45:10 -0000 1.77
+++ script_v2.cpp 26 Jul 2002 17:03:03 -0000 1.78
@@ -2836,8 +2836,12 @@
createSpecialPalette(args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
break;
- case 114: /* palette? */
- warning("stub o6_miscOps_114()");
+ case 114:
+ // Sam & Max film noir mode
+ if (_gameId == GID_SAMNMAX)
+ desaturatePalette();
+ else
+ warning("stub o6_miscOps_114()");
break;
case 117:
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.189
retrieving revision 1.190
diff -u -d -r1.189 -r1.190
--- scumm.h 22 Jul 2002 18:11:48 -0000 1.189
+++ scumm.h 26 Jul 2002 17:03:03 -0000 1.190
@@ -880,6 +880,7 @@
void moveMemInPalRes(int start, int end, byte direction);
void setupShadowPalette(int slot, int rfact, int gfact, int bfact, int from, int to);
void darkenPalette(int a, int b, int c, int d, int e);
+ void desaturatePalette();
void setShake(int mode);
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.190
retrieving revision 1.191
diff -u -d -r1.190 -r1.191
--- scummvm.cpp 22 Jul 2002 18:11:48 -0000 1.190
+++ scummvm.cpp 26 Jul 2002 17:03:03 -0000 1.191
@@ -1376,6 +1376,10 @@
int i;
byte *data = _currentPalette + first * 3;
+ // Sam & Max film noir mode
+ if (_gameId == GID_SAMNMAX && readVar(0x8000))
+ desaturatePalette();
+
byte palette_colors[1024],*p = palette_colors;
for (i = 0; i != num; i++, data += 3, p+=4) {
More information about the Scummvm-git-logs
mailing list