1 #define BLOCK_SIZE	( 1 << BLOCK_SHIFT )
2 
BLOCK_FUNC(void)3 void BLOCK_FUNC( void ){
4 	int				v, i, b, lightstep, lighttemp, light;
5 	byte	pix, *psource, *prowdest;
6 
7 	psource = pbasesource;
8 	prowdest = prowdestbase;
9 
10 	for (v=0 ; v<r_numvblocks ; v++)
11 	{
12 	// FIXME: make these locals?
13 	// FIXME: use delta rather than both right and left, like ASM?
14 		lightleft = r_lightptr[0];
15 		lightright = r_lightptr[1];
16 		r_lightptr += r_lightwidth;
17 		lightleftstep = (r_lightptr[0] - lightleft) >> BLOCK_SHIFT;
18 		lightrightstep = (r_lightptr[1] - lightright) >> BLOCK_SHIFT;
19 
20 		for (i=0 ; i<BLOCK_SIZE ; i++)
21 		{
22 			lighttemp = lightleft - lightright;
23 			lightstep = lighttemp >> BLOCK_SHIFT;
24 
25 			light = lightright;
26 
27 			for (b=BLOCK_SIZE-1; b>=0; b--)
28 			{
29 				pix = psource[b];
30 				prowdest[b] = ((unsigned char *)vid.colormap)
31 						[(light & 0xFF00) + pix];
32 				light += lightstep;
33 			}
34 
35 			psource += sourcetstep;
36 			lightright += lightrightstep;
37 			lightleft += lightleftstep;
38 			prowdest += surfrowbytes;
39 		}
40 
41 		if (psource >= r_sourcemax)
42 			psource -= r_stepback;
43 	}
44 }
45 
46 #undef BLOCK_FUNC
47 #undef BLOCK_SIZE
48 #undef BLOCK_SHIFT
49