#include #include #include #include #include #include #include #include #include #include #define RATIO1 1 //7 #define RATIO2 1 //4 #define TOTALR (RATIO1+RATIO2) typedef unsigned char byte; unsigned NUMLIGHTS; byte palette[768]; byte far lightpalette[255][256]; void RF_BuildLights (void) { int i,l,c,test,table; int red,green,blue; int dist,bestdist,rdist,gdist,bdist,bestcolor; byte *palptr, *palsrc; byte far *screen; screen = MK_FP(0xa000,0); for(l=0;l<256;l++) for(c=0;c<200;c++) *(screen+c*320+l)=l; for (l=1;l<256;l++) { palsrc = palette; for (c=0;c<256;c++) { red = (palsrc[c*3]*RATIO1+palsrc[l*3]*RATIO2)/TOTALR; green = (palsrc[c*3+1]*RATIO1+palsrc[l*3+1]*RATIO2)/TOTALR; blue = (palsrc[c*3+2]*RATIO1+palsrc[l*3+2]*RATIO2)/TOTALR; palptr = palette; bestdist = 32000; for (test=0;test<256;test++) { rdist = (int)*palptr++ - red; gdist = (int)*palptr++ - green; bdist = (int)*palptr++ - blue; dist = rdist*rdist + gdist*gdist + bdist*bdist; if (dist