From: leathm AT solwarra DOT gbrmpa DOT gov DOT au (Leath Muller) Message-Id: <199703052352.JAA14542@solwarra.gbrmpa.gov.au> Subject: Re: Lighting Techniques To: sly AT aussie DOT net (Sly) Date: Thu, 6 Mar 1997 09:52:27 +1000 (EST) Cc: djgpp AT delorie DOT com In-Reply-To: <01bc290e$ccc6e8c0$8a081ecb@sly> from "Sly" at Mar 5, 97 02:38:10 am Content-Type: text > > If you want to tint the sprites to some color other than black, pass a > > color other than "0, 0, 0" to the create_light_table() routine, eg. > > "255, 255, 255" to tint the images to white. If you want to tint them in > > both directions, you could (a bit more work) use the > > create_color_table() function to build a lookup table which will treat > > light level 128 as the original color, 0 as black, and 255 as white. > When I read this, I started thinking how this would be achieved (the lookup > table to treat light level 128 as the original colour, 0 as black, and 255 > as white). But I can't think of how it would be done. Any tips? Well, for true colour stuff I use this sort of setup... char *brightness = (char *)malloc(256 * 256)); for (i = 0; i < 256; i++) for (j = 0; j < 256; j++) { val = (i / 128) * j; brightness[i][j] = (unsigned char) val; } You get the point.... :) You should make sure you do correct int/float conversions etc, but otherwise, this is extremely effective for me... Leathal.