Apply patch from Chris Ison <wildcode@users.sourceforge.net> with some

changes from me.
This commit is contained in:
Jeff Teunissen 2000-09-26 07:53:50 +00:00
parent 62d4749552
commit b0fc35b3e3

View file

@ -251,11 +251,9 @@ R_BuildLightMap (msurface_t *surf, byte *dest, int stride)
lightmap = surf->samples;
// set to full bright if no light data
if (/*r_fullbright->value ||*/ !cl.worldmodel->lightdata)
{
if (!cl.worldmodel->lightdata) {
bl = blocklights;
for (i=0 ; i<size ; i++)
{
for (i=0 ; i<size ; i++) {
*bl++ = 255*256;
*bl++ = 255*256;
*bl++ = 255*256;
@ -263,30 +261,26 @@ R_BuildLightMap (msurface_t *surf, byte *dest, int stride)
goto store;
}
// clear to no light
bl = blocklights;
for (i=0 ; i<size ; i++)
{
*bl++ = 0;
*bl++ = 0;
*bl++ = 0;
}
bl = blocklights;
// add all the lightmaps
if (lightmap)
bl = blocklights;
if (lightmap) {
for (maps = 0;
maps < MAXLIGHTMAPS && surf->styles[maps] != 255;
maps++)
{
maps++) {
scale = d_lightstylevalue[surf->styles[maps]];
surf->cached_light[maps] = scale; // 8.8 fraction
bl = blocklights;
for (i=0 ; i<size ; i++)
{
*bl++ += *lightmap++ * scale;
*bl++ += *lightmap++ * scale;
*bl++ += *lightmap++ * scale;
for (i = 0; i < size; i++) {
*bl++ = *lightmap++ * scale;
*bl++ = *lightmap++ * scale;
*bl++ = *lightmap++ * scale;
}
}
} else {
for (i = 0; i < size; i++) {
*bl++ = 0;
*bl++ = 0;
*bl++ = 0;
}
}
@ -296,15 +290,12 @@ R_BuildLightMap (msurface_t *surf, byte *dest, int stride)
store:
// bound and shift
if (gl_colorlights->value)
{
if (gl_colorlights->value) {
stride -= smax * 3;
bl = blocklights;
if (lighthalf)
{
for (i = 0; i < tmax; i++, dest += stride)
for (j=0 ; j<smax ; j++)
{
if (lighthalf) {
for (i = 0; i < tmax; i++, dest += stride) {
for (j=0 ; j<smax ; j++) {
t = (int) *bl++ >> 8;
*dest++ = bound(0, t, 255);
t = (int) *bl++ >> 8;
@ -313,11 +304,9 @@ store:
*dest++ = bound(0, t, 255);
}
}
else
{
for (i = 0; i < tmax; i++, dest += stride)
for (j=0 ; j<smax ; j++)
{
} else {
for (i = 0; i < tmax; i++, dest += stride) {
for (j=0; j < smax; j++) {
t = (int) *bl++ >> 7;
*dest++ = bound(0, t, 255);
t = (int) *bl++ >> 7;
@ -327,15 +316,12 @@ store:
}
}
}
else
{
} else {
stride -= smax;
bl = blocklights;
if (lighthalf)
{
for (i = 0; i < tmax; i++, dest += stride)
for (j=0 ; j<smax ; j++)
{
if (lighthalf) {
for (i = 0; i < tmax; i++, dest += stride) {
for (j=0 ; j<smax ; j++) {
t = (int) *bl++ >> 8;
t2 = bound(0, t, 255);
t = (int) *bl++ >> 8;
@ -346,11 +332,9 @@ store:
*dest++ = t2;
}
}
else
{
for (i = 0; i < tmax; i++, dest += stride)
for (j=0 ; j<smax ; j++)
{
} else {
for (i = 0; i < tmax; i++, dest += stride) {
for (j=0 ; j<smax ; j++) {
t = (int) *bl++ >> 7;
t2 = bound(0, t, 255);
t = (int) *bl++ >> 7;
@ -362,6 +346,7 @@ store:
}
}
}
}
}
/*