From 9ad205f5ba8793949d9476d712875c88f650e838 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 17 Jul 2016 22:33:37 +0100 Subject: [PATCH 1/2] R_DrawTiltedSplat_8 fix: apply colormapping AFTER checking the source pixel is cyan first --- src/r_draw8.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/r_draw8.c b/src/r_draw8.c index c22cd236..ec80774a 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -913,9 +913,9 @@ void R_DrawTiltedSplat_8(void) for (i = SPANSIZE-1; i >= 0; i--) { colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - val = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; + val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; if (val != TRANSPARENTPIXEL) - *dest = val; + *dest = colormap[val]; dest++; u += stepu; v += stepv; @@ -931,9 +931,9 @@ void R_DrawTiltedSplat_8(void) u = (INT64)(startu); v = (INT64)(startv); colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - val = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; + val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; if (val != TRANSPARENTPIXEL) - *dest = val; + *dest = colormap[val]; } else { @@ -954,9 +954,9 @@ void R_DrawTiltedSplat_8(void) for (; width != 0; width--) { colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - val = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; + val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; if (val != TRANSPARENTPIXEL) - *dest = val; + *dest = colormap[val]; dest++; u += stepu; v += stepv; From 77a40e9016bade8091a9134e77040b8a8c07885d Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 17 Jul 2016 23:01:07 +0100 Subject: [PATCH 2/2] Slightly unrelated, but if R_DrawTranslucentSplat_8 is ever going to be used this is probably more efficient (also fixing early colormap application for the last part) --- src/r_draw8.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/r_draw8.c b/src/r_draw8.c index ec80774a..9f5ab62c 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -874,9 +874,9 @@ void R_DrawTiltedSplat_8(void) colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - val = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; + val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; if (val != TRANSPARENTPIXEL) - *dest = val; + *dest = colormap[val]; dest++; iz += ds_sz.x; uz += ds_su.x; @@ -1124,49 +1124,49 @@ void R_DrawTranslucentSplat_8 (void) // need! val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]; if (val != TRANSPARENTPIXEL) - dest[0] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[0])]; + dest[0] = colormap[*(ds_transmap + (val << 8) + dest[0])]; xposition += xstep; yposition += ystep; val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]; if (val != TRANSPARENTPIXEL) - dest[1] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[1])]; + dest[1] = colormap[*(ds_transmap + (val << 8) + dest[1])]; xposition += xstep; yposition += ystep; val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]; if (val != TRANSPARENTPIXEL) - dest[2] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[2])]; + dest[2] = colormap[*(ds_transmap + (val << 8) + dest[2])]; xposition += xstep; yposition += ystep; val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]; if (val != TRANSPARENTPIXEL) - dest[3] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[3])]; + dest[3] = colormap[*(ds_transmap + (val << 8) + dest[3])]; xposition += xstep; yposition += ystep; val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]; if (val != TRANSPARENTPIXEL) - dest[4] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[4])]; + dest[4] = colormap[*(ds_transmap + (val << 8) + dest[4])]; xposition += xstep; yposition += ystep; val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]; if (val != TRANSPARENTPIXEL) - dest[5] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[5])]; + dest[5] = colormap[*(ds_transmap + (val << 8) + dest[5])]; xposition += xstep; yposition += ystep; val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]; if (val != TRANSPARENTPIXEL) - dest[6] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[6])]; + dest[6] = colormap[*(ds_transmap + (val << 8) + dest[6])]; xposition += xstep; yposition += ystep; val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]; if (val != TRANSPARENTPIXEL) - dest[7] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[7])]; + dest[7] = colormap[*(ds_transmap + (val << 8) + dest[7])]; xposition += xstep; yposition += ystep; @@ -1175,9 +1175,9 @@ void R_DrawTranslucentSplat_8 (void) } while (count--) { - val =colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]]; + val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]; if (val != TRANSPARENTPIXEL) - *dest = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dest)]; + *dest = colormap[*(ds_transmap + (val << 8) + *dest)]; dest++; xposition += xstep;