changeset 487:09df21060be6

merge
author Robert McIntyre <rlm@mit.edu>
date Mon, 07 May 2012 11:15:49 -0500
parents 3f0156038802 (current diff) cd6a96a07d2e (diff)
children 09b3bc0b71b5
files
diffstat 2 files changed, 72 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
     1.1 Binary file save-states/rlm-lt-surge.sav has changed
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/temp-c-stuff	Mon May 07 11:15:49 2012 -0500
     2.3 @@ -0,0 +1,72 @@
     2.4 +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     2.5 +
     2.6 +
     2.7 +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     2.8 +
     2.9 +
    2.10 +// This section of code is used to convert an RGB (pc) triplet into a RGB (gameboy)
    2.11 +// triplet. This section of code was kindly donated by Brett Bibby (GameBrains).
    2.12 +
    2.13 +BYTE intensity[32] = 
    2.14 +  {
    2.15 +    0x00,0x10,0x20,0x30,0x40,0x50,0x5e,0x6c,0x7a,0x88,0x94,0xa0,0xae,0xb7,0xbf,0xc6,
    2.16 +    0xce,0xd3,0xd9,0xdf,0xe3,0xe7,0xeb,0xef,0xf3,0xf6,0xf9,0xfb,0xfd,0xfe,0xff,0xff
    2.17 +  };
    2.18 +
    2.19 +unsigned char influence[3][3] = 
    2.20 +  {
    2.21 +    {16,4,4},
    2.22 +    {8,16,8},
    2.23 +    {0,8,16}
    2.24 +  };
    2.25 +
    2.26 +RGBQUAD translate(BYTE rgb[3])
    2.27 +{
    2.28 +  RGBQUAD color;
    2.29 +  BYTE	tmp[3];
    2.30 +  BYTE	m[3][3];
    2.31 +  BYTE	i,j;
    2.32 +
    2.33 +  for (i=0;i<3;i++)
    2.34 +    for (j=0;j<3;j++)
    2.35 +      m[i][j] = (intensity[rgb[i]>>3]*influence[i][j]) >> 5;
    2.36 +
    2.37 +  for (i=0;i<3;i++)
    2.38 +    {
    2.39 +      if (m[0][i]>m[1][i])
    2.40 +	{
    2.41 +	  j=m[0][i]; 
    2.42 +	  m[0][i]=m[1][i]; 
    2.43 +	  m[1][i]=j;
    2.44 +	}
    2.45 +
    2.46 +      if (m[1][i]>m[2][i])
    2.47 +	{
    2.48 +	  j=m[1][i]; 
    2.49 +	  m[1][i]=m[2][i]; 
    2.50 +	  m[2][i]=j;
    2.51 +	}
    2.52 +
    2.53 +      if (m[0][i]>m[1][i])
    2.54 +	{
    2.55 +	  j=m[0][i]; 
    2.56 +	  m[0][i]=m[1][i]; 
    2.57 +	  m[1][i]=j;
    2.58 +	}
    2.59 +
    2.60 +      tmp[i]=(((m[0][i]+m[1][i]*2+m[2][i]*4)*5) >> 4)+32;
    2.61 +    }
    2.62 +
    2.63 +  color.rgbRed	= tmp[0];
    2.64 +  color.rgbGreen	= tmp[1];
    2.65 +  color.rgbBlue	= tmp[2];
    2.66 +
    2.67 +  return color;
    2.68 +}
    2.69 +
    2.70 +
    2.71 +
    2.72 +
    2.73 +
    2.74 +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    2.75 +