mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-02-17 00:52:00 +00:00
Apply patch from Chris Ison <wildcode@users.sourceforge.net> with some
changes from me.
This commit is contained in:
parent
62d4749552
commit
b0fc35b3e3
1 changed files with 35 additions and 50 deletions
|
@ -251,11 +251,9 @@ R_BuildLightMap (msurface_t *surf, byte *dest, int stride)
|
||||||
lightmap = surf->samples;
|
lightmap = surf->samples;
|
||||||
|
|
||||||
// set to full bright if no light data
|
// set to full bright if no light data
|
||||||
if (/*r_fullbright->value ||*/ !cl.worldmodel->lightdata)
|
if (!cl.worldmodel->lightdata) {
|
||||||
{
|
|
||||||
bl = blocklights;
|
bl = blocklights;
|
||||||
for (i=0 ; i<size ; i++)
|
for (i=0 ; i<size ; i++) {
|
||||||
{
|
|
||||||
*bl++ = 255*256;
|
*bl++ = 255*256;
|
||||||
*bl++ = 255*256;
|
*bl++ = 255*256;
|
||||||
*bl++ = 255*256;
|
*bl++ = 255*256;
|
||||||
|
@ -263,30 +261,26 @@ R_BuildLightMap (msurface_t *surf, byte *dest, int stride)
|
||||||
goto store;
|
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
|
// add all the lightmaps
|
||||||
if (lightmap)
|
bl = blocklights;
|
||||||
|
if (lightmap) {
|
||||||
for (maps = 0;
|
for (maps = 0;
|
||||||
maps < MAXLIGHTMAPS && surf->styles[maps] != 255;
|
maps < MAXLIGHTMAPS && surf->styles[maps] != 255;
|
||||||
maps++)
|
maps++) {
|
||||||
{
|
|
||||||
scale = d_lightstylevalue[surf->styles[maps]];
|
scale = d_lightstylevalue[surf->styles[maps]];
|
||||||
surf->cached_light[maps] = scale; // 8.8 fraction
|
surf->cached_light[maps] = scale; // 8.8 fraction
|
||||||
bl = blocklights;
|
bl = blocklights;
|
||||||
for (i=0 ; i<size ; i++)
|
for (i = 0; i < size; i++) {
|
||||||
{
|
*bl++ = *lightmap++ * scale;
|
||||||
*bl++ += *lightmap++ * scale;
|
*bl++ = *lightmap++ * scale;
|
||||||
*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:
|
store:
|
||||||
// bound and shift
|
// bound and shift
|
||||||
if (gl_colorlights->value)
|
if (gl_colorlights->value) {
|
||||||
{
|
|
||||||
stride -= smax * 3;
|
stride -= smax * 3;
|
||||||
bl = blocklights;
|
bl = blocklights;
|
||||||
if (lighthalf)
|
if (lighthalf) {
|
||||||
{
|
for (i = 0; i < tmax; i++, dest += stride) {
|
||||||
for (i = 0; i < tmax; i++, dest += stride)
|
for (j=0 ; j<smax ; j++) {
|
||||||
for (j=0 ; j<smax ; j++)
|
|
||||||
{
|
|
||||||
t = (int) *bl++ >> 8;
|
t = (int) *bl++ >> 8;
|
||||||
*dest++ = bound(0, t, 255);
|
*dest++ = bound(0, t, 255);
|
||||||
t = (int) *bl++ >> 8;
|
t = (int) *bl++ >> 8;
|
||||||
|
@ -313,11 +304,9 @@ store:
|
||||||
*dest++ = bound(0, t, 255);
|
*dest++ = bound(0, t, 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
} else {
|
||||||
{
|
for (i = 0; i < tmax; i++, dest += stride) {
|
||||||
for (i = 0; i < tmax; i++, dest += stride)
|
for (j=0; j < smax; j++) {
|
||||||
for (j=0 ; j<smax ; j++)
|
|
||||||
{
|
|
||||||
t = (int) *bl++ >> 7;
|
t = (int) *bl++ >> 7;
|
||||||
*dest++ = bound(0, t, 255);
|
*dest++ = bound(0, t, 255);
|
||||||
t = (int) *bl++ >> 7;
|
t = (int) *bl++ >> 7;
|
||||||
|
@ -327,15 +316,12 @@ store:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
stride -= smax;
|
stride -= smax;
|
||||||
bl = blocklights;
|
bl = blocklights;
|
||||||
if (lighthalf)
|
if (lighthalf) {
|
||||||
{
|
for (i = 0; i < tmax; i++, dest += stride) {
|
||||||
for (i = 0; i < tmax; i++, dest += stride)
|
for (j=0 ; j<smax ; j++) {
|
||||||
for (j=0 ; j<smax ; j++)
|
|
||||||
{
|
|
||||||
t = (int) *bl++ >> 8;
|
t = (int) *bl++ >> 8;
|
||||||
t2 = bound(0, t, 255);
|
t2 = bound(0, t, 255);
|
||||||
t = (int) *bl++ >> 8;
|
t = (int) *bl++ >> 8;
|
||||||
|
@ -346,11 +332,9 @@ store:
|
||||||
*dest++ = t2;
|
*dest++ = t2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
} else {
|
||||||
{
|
for (i = 0; i < tmax; i++, dest += stride) {
|
||||||
for (i = 0; i < tmax; i++, dest += stride)
|
for (j=0 ; j<smax ; j++) {
|
||||||
for (j=0 ; j<smax ; j++)
|
|
||||||
{
|
|
||||||
t = (int) *bl++ >> 7;
|
t = (int) *bl++ >> 7;
|
||||||
t2 = bound(0, t, 255);
|
t2 = bound(0, t, 255);
|
||||||
t = (int) *bl++ >> 7;
|
t = (int) *bl++ >> 7;
|
||||||
|
@ -362,6 +346,7 @@ store:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue