From b0fc35b3e364537b062a36f1cc0d5450153c7430 Mon Sep 17 00:00:00 2001 From: Jeff Teunissen Date: Tue, 26 Sep 2000 07:53:50 +0000 Subject: [PATCH] Apply patch from Chris Ison with some changes from me. --- source/gl_rsurf.c | 85 +++++++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 50 deletions(-) diff --git a/source/gl_rsurf.c b/source/gl_rsurf.c index 3b6575c..8b3115e 100644 --- a/source/gl_rsurf.c +++ b/source/gl_rsurf.c @@ -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 ; istyles[maps] != 255; - maps++) - { + maps < MAXLIGHTMAPS && surf->styles[maps] != 255; + maps++) { scale = d_lightstylevalue[surf->styles[maps]]; surf->cached_light[maps] = scale; // 8.8 fraction bl = blocklights; - for (i=0 ; idlightframe == r_framecount) @@ -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> 8; *dest++ = bound(0, t, 255); t = (int) *bl++ >> 8; @@ -312,12 +303,10 @@ store: t = (int) *bl++ >> 8; *dest++ = bound(0, t, 255); } - } - else - { - for (i = 0; i < tmax; i++, dest += stride) - for (j=0 ; j> 7; *dest++ = bound(0, t, 255); t = (int) *bl++ >> 7; @@ -325,17 +314,14 @@ store: t = (int) *bl++ >> 7; *dest++ = bound(0, t, 255); } + } } - } - else - { + } else { stride -= smax; bl = blocklights; - if (lighthalf) - { - for (i = 0; i < tmax; i++, dest += stride) - for (j=0 ; j> 8; t2 = bound(0, t, 255); t = (int) *bl++ >> 8; @@ -345,12 +331,10 @@ store: t2 *= (1.0/3.0); *dest++ = t2; } - } - else - { - for (i = 0; i < tmax; i++, dest += stride) - for (j=0 ; j> 7; t2 = bound(0, t, 255); t = (int) *bl++ >> 7; @@ -360,6 +344,7 @@ store: t2 *= (1.0/3.0); *dest++ = t2; } + } } } }