diff --git a/src/r_draw8.c b/src/r_draw8.c index 2011e46407cd46469d9ca6f0dd8de7fd4e7f84ef..c0ad8224015f3abb2dd042ea2c22c5d8ac53ccb2 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -48,6 +48,8 @@ void R_DrawColumn_8(void) fracstep = dc_iscale; frac = dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep); + //if (dc_brightmap) CONS_Printf("HI! =D R_DrawColumn_8\n"); + // Inner loop that does the actual texture mapping, e.g. a DDA-like scaling. // This is as fast as it gets. { @@ -70,7 +72,9 @@ void R_DrawColumn_8(void) // Re-map color indices from wall texture column // using a lighting/special effects LUT. // heightmask is the Tutti-Frutti fix - *dest = colormap[source[frac>>FRACBITS]]; + *dest = dc_brightmap && (dc_brightmap[frac >> FRACBITS] == BRIGHTPIXEL) // rr + ? dc_fullbright[source[frac>>FRACBITS]] + : colormap[source[frac>>FRACBITS]]; dest += vid.width; // Avoid overflow. @@ -87,15 +91,21 @@ void R_DrawColumn_8(void) { while ((count -= 2) >= 0) // texture height is a power of 2 { - *dest = colormap[source[(frac>>FRACBITS) & heightmask]]; + *dest = dc_brightmap && (dc_brightmap[(frac>>FRACBITS) & heightmask] == BRIGHTPIXEL) // rr + ? dc_fullbright[source[(frac>>FRACBITS) & heightmask]] + : colormap[source[(frac>>FRACBITS) & heightmask]]; dest += vid.width; frac += fracstep; - *dest = colormap[source[(frac>>FRACBITS) & heightmask]]; + *dest = dc_brightmap && (dc_brightmap[(frac>>FRACBITS) & heightmask] == BRIGHTPIXEL) // rr + ? dc_fullbright[source[(frac>>FRACBITS) & heightmask]] + : colormap[source[(frac>>FRACBITS) & heightmask]]; dest += vid.width; frac += fracstep; } if (count & 1) - *dest = colormap[source[(frac>>FRACBITS) & heightmask]]; + *dest = dc_brightmap && (dc_brightmap[(frac>>FRACBITS) & heightmask] == BRIGHTPIXEL) // rr + ? dc_fullbright[source[(frac>>FRACBITS) & heightmask]] + : colormap[source[(frac>>FRACBITS) & heightmask]]; } } } @@ -129,6 +139,8 @@ void R_DrawColumnClamped_8(void) fracstep = dc_iscale; frac = dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep); + //if (dc_brightmap) CONS_Printf("HI! =D R_DrawColumnClamped_8\n"); + // Inner loop that does the actual texture mapping, e.g. a DDA-like scaling. // This is as fast as it gets. { @@ -244,7 +256,9 @@ void R_Draw2sMultiPatchColumn_8(void) val = source[frac>>FRACBITS]; if (val != TRANSPARENTPIXEL) - *dest = colormap[val]; + *dest = dc_brightmap && (dc_brightmap[frac>>FRACBITS] == BRIGHTPIXEL) // rr + ? dc_fullbright[val] + : colormap[val]; dest += vid.width; @@ -264,12 +278,16 @@ void R_Draw2sMultiPatchColumn_8(void) { val = source[(frac>>FRACBITS) & heightmask]; if (val != TRANSPARENTPIXEL) - *dest = colormap[val]; + *dest = dc_brightmap && (dc_brightmap[(frac>>FRACBITS) & heightmask] == BRIGHTPIXEL) // rr + ? dc_fullbright[val] + : colormap[val]; dest += vid.width; frac += fracstep; val = source[(frac>>FRACBITS) & heightmask]; if (val != TRANSPARENTPIXEL) - *dest = colormap[val]; + *dest = dc_brightmap && (dc_brightmap[(frac>>FRACBITS) & heightmask] == BRIGHTPIXEL) // rr + ? dc_fullbright[val] + : colormap[val]; dest += vid.width; frac += fracstep; } @@ -277,7 +295,9 @@ void R_Draw2sMultiPatchColumn_8(void) { val = source[(frac>>FRACBITS) & heightmask]; if (val != TRANSPARENTPIXEL) - *dest = colormap[val]; + *dest = dc_brightmap && (dc_brightmap[(frac>>FRACBITS) & heightmask] == BRIGHTPIXEL) // rr + ? dc_fullbright[val] + : colormap[val]; } } } @@ -336,7 +356,9 @@ void R_Draw2sMultiPatchTranslucentColumn_8(void) val = source[frac>>FRACBITS]; if (val != TRANSPARENTPIXEL) - *dest = *(transmap + (colormap[val]<<8) + (*dest)); + *dest = dc_brightmap && (dc_brightmap[frac>>FRACBITS] == BRIGHTPIXEL) // rr + ? *(transmap + (dc_fullbright[val]<<8) + (*dest)) + : *(transmap + (colormap[val]<<8) + (*dest)); dest += vid.width; @@ -356,12 +378,16 @@ void R_Draw2sMultiPatchTranslucentColumn_8(void) { val = source[(frac>>FRACBITS) & heightmask]; if (val != TRANSPARENTPIXEL) - *dest = *(transmap + (colormap[val]<<8) + (*dest)); + *dest = dc_brightmap && (dc_brightmap[(frac>>FRACBITS) & heightmask] == BRIGHTPIXEL) // rr + ? *(transmap + (dc_fullbright[val]<<8) + (*dest)) + : *(transmap + (colormap[val]<<8) + (*dest)); dest += vid.width; frac += fracstep; val = source[(frac>>FRACBITS) & heightmask]; if (val != TRANSPARENTPIXEL) - *dest = *(transmap + (colormap[val]<<8) + (*dest)); + *dest = dc_brightmap && (dc_brightmap[(frac>>FRACBITS) & heightmask] == BRIGHTPIXEL) // rr + ? *(transmap + (dc_fullbright[val]<<8) + (*dest)) + : *(transmap + (colormap[val]<<8) + (*dest)); dest += vid.width; frac += fracstep; } @@ -369,7 +395,9 @@ void R_Draw2sMultiPatchTranslucentColumn_8(void) { val = source[(frac>>FRACBITS) & heightmask]; if (val != TRANSPARENTPIXEL) - *dest = *(transmap + (colormap[val]<<8) + (*dest)); + *dest = dc_brightmap && (dc_brightmap[(frac>>FRACBITS) & heightmask] == BRIGHTPIXEL) // rr + ? *(transmap + (dc_fullbright[val]<<8) + (*dest)) + : *(transmap + (colormap[val]<<8) + (*dest)); } } } @@ -406,7 +434,9 @@ void R_DrawShadeColumn_8(void) // Here we do an additional index re-mapping. do { - *dest = colormaps[(dc_source[frac>>FRACBITS] <<8) + (*dest)]; + *dest = dc_brightmap && (dc_brightmap[frac >> FRACBITS] == BRIGHTPIXEL) // rr + ? dc_fullbright[(dc_source[frac>>FRACBITS] <<8) + (*dest)] + : colormaps[(dc_source[frac>>FRACBITS] <<8) + (*dest)]; dest += vid.width; frac += fracstep; } while (count--); @@ -463,7 +493,9 @@ void R_DrawTranslucentColumn_8(void) // Re-map color indices from wall texture column // using a lighting/special effects LUT. // heightmask is the Tutti-Frutti fix - *dest = *(transmap + (colormap[source[frac>>FRACBITS]]<<8) + (*dest)); + *dest = dc_brightmap && (dc_brightmap[source[frac>>FRACBITS]] == BRIGHTPIXEL) // rr + ? *(transmap + (dc_fullbright[source[frac>>FRACBITS]]<<8) + (*dest)) + : *(transmap + (colormap[source[frac>>FRACBITS]]<<8) + (*dest)); dest += vid.width; if ((frac += fracstep) >= heightmask) frac -= heightmask; @@ -474,15 +506,21 @@ void R_DrawTranslucentColumn_8(void) { while ((count -= 2) >= 0) // texture height is a power of 2 { - *dest = *(transmap + (colormap[source[(frac>>FRACBITS)&heightmask]]<<8) + (*dest)); + *dest = dc_brightmap && (dc_brightmap[source[(frac>>FRACBITS)&heightmask]] == BRIGHTPIXEL) // rr + ? *(transmap + (dc_fullbright[source[(frac>>FRACBITS)&heightmask]]<<8) + (*dest)) + : *(transmap + (colormap[source[(frac>>FRACBITS)&heightmask]]<<8) + (*dest)); dest += vid.width; frac += fracstep; - *dest = *(transmap + (colormap[source[(frac>>FRACBITS)&heightmask]]<<8) + (*dest)); + *dest = dc_brightmap && (dc_brightmap[source[(frac>>FRACBITS)&heightmask]] == BRIGHTPIXEL) // rr + ? *(transmap + (dc_fullbright[source[(frac>>FRACBITS)&heightmask]]<<8) + (*dest)) + : *(transmap + (colormap[source[(frac>>FRACBITS)&heightmask]]<<8) + (*dest)); dest += vid.width; frac += fracstep; } if (count & 1) - *dest = *(transmap + (colormap[source[(frac>>FRACBITS)&heightmask]]<<8) + (*dest)); + *dest = dc_brightmap && (dc_brightmap[source[(frac>>FRACBITS)&heightmask]] == BRIGHTPIXEL) // rr + ? *(transmap + (dc_fullbright[source[(frac>>FRACBITS)&heightmask]]<<8) + (*dest)) + : *(transmap + (colormap[source[(frac>>FRACBITS)&heightmask]]<<8) + (*dest)); } } } @@ -647,7 +685,9 @@ void R_DrawTranslatedTranslucentColumn_8(void) // using a lighting/special effects LUT. // heightmask is the Tutti-Frutti fix - *dest = *(dc_transmap + (dc_colormap[dc_translation[dc_source[frac>>FRACBITS]]]<<8) + (*dest)); + *dest = dc_brightmap && (dc_brightmap[dc_source[frac>>FRACBITS]] == BRIGHTPIXEL) // rr + ? *(dc_transmap + (dc_fullbright[dc_translation[dc_source[frac>>FRACBITS]]]<<8) + (*dest)) + : *(dc_transmap + (dc_colormap[dc_translation[dc_source[frac>>FRACBITS]]]<<8) + (*dest)); dest += vid.width; if ((frac += fracstep) >= heightmask) @@ -659,15 +699,21 @@ void R_DrawTranslatedTranslucentColumn_8(void) { while ((count -= 2) >= 0) // texture height is a power of 2 { - *dest = *(dc_transmap + (dc_colormap[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]]<<8) + (*dest)); + *dest = dc_brightmap && (dc_brightmap[dc_source[(frac>>FRACBITS)&heightmask]] == BRIGHTPIXEL) // rr + ? *(dc_transmap + (dc_fullbright[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]]<<8) + (*dest)) + : *(dc_transmap + (dc_colormap[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]]<<8) + (*dest)); dest += vid.width; frac += fracstep; - *dest = *(dc_transmap + (dc_colormap[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]]<<8) + (*dest)); + *dest = dc_brightmap && (dc_brightmap[dc_source[(frac>>FRACBITS)&heightmask]] == BRIGHTPIXEL) // rr + ? *(dc_transmap + (dc_fullbright[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]]<<8) + (*dest)) + : *(dc_transmap + (dc_colormap[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]]<<8) + (*dest)); dest += vid.width; frac += fracstep; } if (count & 1) - *dest = *(dc_transmap + (dc_colormap[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]]<<8) + (*dest)); + *dest = dc_brightmap && (dc_brightmap[dc_source[(frac>>FRACBITS)&heightmask]] == BRIGHTPIXEL) // rr + ? *(dc_transmap + (dc_fullbright[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]]<<8) + (*dest)) + : *(dc_transmap + (dc_colormap[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]]<<8) + (*dest)); } } } @@ -706,7 +752,9 @@ void R_DrawTranslatedColumn_8(void) // used with PLAY sprites. // Thus the "green" ramp of the player 0 sprite // is mapped to gray, red, black/indigo. - *dest = dc_colormap[dc_translation[dc_source[frac>>FRACBITS]]]; + *dest = dc_brightmap && (dc_brightmap[dc_source[frac>>FRACBITS]] == BRIGHTPIXEL) // rr + ? dc_fullbright[dc_translation[dc_source[frac>>FRACBITS]]] + : dc_colormap[dc_translation[dc_source[frac>>FRACBITS]]]; dest += vid.width; @@ -762,44 +810,31 @@ void R_DrawSpan_8 (void) // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't // have the uber complicated math to calculate it now, so that was a memory write we didn't // need! - dest[0] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; - xposition += xstep; - yposition += ystep; - - dest[1] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; - xposition += xstep; - yposition += ystep; - - dest[2] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; - xposition += xstep; - yposition += ystep; - - dest[3] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; - xposition += xstep; - yposition += ystep; - - dest[4] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; - xposition += xstep; - yposition += ystep; - - dest[5] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; - xposition += xstep; - yposition += ystep; - - dest[6] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; - xposition += xstep; - yposition += ystep; - - dest[7] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; - xposition += xstep; - yposition += ystep; + + // rr + size_t i; + UINT32 bit; + for (i = 0; i < 8; i++) { + bit = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); + dest[i] = ds_brightmap && (ds_brightmap[bit] == BRIGHTPIXEL) + ? ds_fullbright[source[bit]] + : colormap[source[bit]]; + + xposition += xstep; + yposition += ystep; + } dest += 8; count -= 8; } while (count-- && dest <= deststop) { - *dest++ = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; + // rr + UINT32 bit = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); + *dest++ = ds_brightmap && (ds_brightmap[bit] == BRIGHTPIXEL) + ? ds_fullbright[source[bit]] + : colormap[source[bit]]; + xposition += xstep; yposition += ystep; } @@ -880,7 +915,13 @@ void R_DrawTiltedSpan_8(void) for (i = SPANSIZE-1; i >= 0; i--) { colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - *dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; + + // rr + UINT32 bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift); + *dest = ds_brightmap && (ds_brightmap[bit] == BRIGHTPIXEL) + ? ds_fullbright[source[bit]] + : colormap[source[bit]]; + dest++; u += stepu; v += stepv; @@ -896,7 +937,12 @@ void R_DrawTiltedSpan_8(void) u = (INT64)(startu); v = (INT64)(startv); colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - *dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; + + // rr + UINT32 bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift); + *dest = ds_brightmap && (ds_brightmap[bit] == BRIGHTPIXEL) + ? ds_fullbright[source[bit]] + : colormap[source[bit]]; } else { @@ -917,7 +963,13 @@ void R_DrawTiltedSpan_8(void) for (; width != 0; width--) { colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - *dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; + + // rr + UINT32 bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift); + *dest = ds_brightmap && (ds_brightmap[bit] == BRIGHTPIXEL) + ? ds_fullbright[source[bit]] + : colormap[source[bit]]; + dest++; u += stepu; v += stepv; @@ -1001,7 +1053,13 @@ void R_DrawTiltedTranslucentSpan_8(void) for (i = SPANSIZE-1; i >= 0; i--) { colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - *dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest); + + // rr + UINT32 bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift); + *dest = ds_brightmap && (ds_brightmap[bit] == BRIGHTPIXEL) + ? *(ds_transmap + (ds_fullbright[source[bit]] << 8) + *dest) + : *(ds_transmap + (colormap[source[bit]] << 8) + *dest); + dest++; u += stepu; v += stepv; @@ -1017,7 +1075,12 @@ void R_DrawTiltedTranslucentSpan_8(void) u = (INT64)(startu); v = (INT64)(startv); colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - *dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest); + + // rr + UINT32 bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift); + *dest = ds_brightmap && (ds_brightmap[bit] == BRIGHTPIXEL) + ? *(ds_transmap + (ds_fullbright[source[bit]] << 8) + *dest) + : *(ds_transmap + (colormap[source[bit]] << 8) + *dest); } else { @@ -1038,7 +1101,13 @@ void R_DrawTiltedTranslucentSpan_8(void) for (; width != 0; width--) { colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - *dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest); + + // rr + UINT32 bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift); + *dest = ds_brightmap && (ds_brightmap[bit] == BRIGHTPIXEL) + ? *(ds_transmap + (ds_fullbright[source[bit]] << 8) + *dest) + : *(ds_transmap + (colormap[source[bit]] << 8) + *dest); + dest++; u += stepu; v += stepv; @@ -1124,7 +1193,13 @@ void R_DrawTiltedWaterSpan_8(void) for (i = SPANSIZE-1; i >= 0; i--) { colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - *dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dsrc++); + + // rr + UINT32 bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift); + *dest = ds_brightmap && (ds_brightmap[bit] == BRIGHTPIXEL) + ? *(ds_transmap + (ds_fullbright[source[bit]] << 8) + *dsrc++) + : *(ds_transmap + (colormap[source[bit]] << 8) + *dsrc++); + dest++; u += stepu; v += stepv; @@ -1140,7 +1215,12 @@ void R_DrawTiltedWaterSpan_8(void) u = (INT64)(startu); v = (INT64)(startv); colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - *dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dsrc++); + + // rr + UINT32 bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift); + *dest = ds_brightmap && (ds_brightmap[bit] == BRIGHTPIXEL) + ? *(ds_transmap + (ds_fullbright[source[bit]] << 8) + *dsrc++) + : *(ds_transmap + (colormap[source[bit]] << 8) + *dsrc++); } else { @@ -1161,7 +1241,13 @@ void R_DrawTiltedWaterSpan_8(void) for (; width != 0; width--) { colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - *dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dsrc++); + + // rr + UINT32 bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift); + *dest = ds_brightmap && (ds_brightmap[bit] == BRIGHTPIXEL) + ? *(ds_transmap + (ds_fullbright[source[bit]] << 8) + *dsrc++) + : *(ds_transmap + (colormap[source[bit]] << 8) + *dsrc++); + dest++; u += stepu; v += stepv; @@ -1250,7 +1336,10 @@ void R_DrawTiltedSplat_8(void) colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; if (val != TRANSPARENTPIXEL) - *dest = colormap[val]; + // rr + *dest = ds_brightmap && (ds_brightmap[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)] == BRIGHTPIXEL) + ? ds_fullbright[val] + : colormap[val]; dest++; u += stepu; v += stepv; @@ -1268,7 +1357,10 @@ void R_DrawTiltedSplat_8(void) colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; if (val != TRANSPARENTPIXEL) - *dest = colormap[val]; + // rr + *dest = ds_brightmap && (ds_brightmap[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)] == BRIGHTPIXEL) + ? ds_fullbright[val] + : colormap[val]; } else { @@ -1291,7 +1383,10 @@ void R_DrawTiltedSplat_8(void) colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; if (val != TRANSPARENTPIXEL) - *dest = colormap[val]; + // rr + *dest = ds_brightmap && (ds_brightmap[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)] == BRIGHTPIXEL) + ? ds_fullbright[val] + : colormap[val]; dest++; u += stepu; v += stepv; @@ -1343,69 +1438,25 @@ void R_DrawSplat_8 (void) // // <Callum> 4194303 = (2048x2048)-1 (2048x2048 is maximum flat size) // Why decimal? 0x3FFFFF == 4194303... ~Golden - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 0x3FFFFF; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[0] = colormap[val]; - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 0x3FFFFF; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[1] = colormap[val]; - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 0x3FFFFF; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[2] = colormap[val]; - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 0x3FFFFF; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[3] = colormap[val]; - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 0x3FFFFF; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[4] = colormap[val]; - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 0x3FFFFF; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[5] = colormap[val]; - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 0x3FFFFF; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[6] = colormap[val]; - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 0x3FFFFF; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[7] = colormap[val]; - xposition += xstep; - yposition += ystep; + + // rr + size_t i; + UINT32 bit; + for (i = 0; i < 8; i++) + { + bit = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); + val = bit; + val &= 0x3FFFFF; + val = source[val]; + + if (val != TRANSPARENTPIXEL) + dest[i] = ds_brightmap && (ds_brightmap[bit] == BRIGHTPIXEL) + ? ds_fullbright[val] + : colormap[val]; + + xposition += xstep; + yposition += ystep; + } dest += 8; count -= 8; @@ -1414,7 +1465,9 @@ void R_DrawSplat_8 (void) { val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; if (val != TRANSPARENTPIXEL) - *dest = colormap[val]; + *dest = ds_brightmap && (ds_brightmap[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)] == BRIGHTPIXEL) // rr + ? ds_fullbright[val] + : colormap[val]; dest++; xposition += xstep; yposition += ystep; @@ -1460,53 +1513,21 @@ void R_DrawTranslucentSplat_8 (void) // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't // have the uber complicated math to calculate it now, so that was a memory write we didn't // need! - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - dest[0] = *(ds_transmap + (colormap[val] << 8) + dest[0]); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - dest[1] = *(ds_transmap + (colormap[val] << 8) + dest[1]); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - dest[2] = *(ds_transmap + (colormap[val] << 8) + dest[2]); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - dest[3] = *(ds_transmap + (colormap[val] << 8) + dest[3]); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - dest[4] = *(ds_transmap + (colormap[val] << 8) + dest[4]); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - dest[5] = *(ds_transmap + (colormap[val] << 8) + dest[5]); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - dest[6] = *(ds_transmap + (colormap[val] << 8) + dest[6]); - xposition += xstep; - yposition += ystep; - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - dest[7] = *(ds_transmap + (colormap[val] << 8) + dest[7]); - xposition += xstep; - yposition += ystep; + // rr + size_t i; + UINT32 bit; + for (i = 0; i < 8; i++) + { + bit = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); + val = source[bit]; + if (val != TRANSPARENTPIXEL) + dest[i] = ds_brightmap && (ds_brightmap[bit] == BRIGHTPIXEL) + ? *(ds_transmap + (ds_fullbright[val] << 8) + dest[i]) + : *(ds_transmap + (colormap[val] << 8) + dest[i]); + xposition += xstep; + yposition += ystep; + } dest += 8; count -= 8; @@ -1515,7 +1536,9 @@ void R_DrawTranslucentSplat_8 (void) { val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; if (val != TRANSPARENTPIXEL) - *dest = *(ds_transmap + (colormap[val] << 8) + *dest); + *dest = ds_brightmap && (ds_brightmap[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)] == BRIGHTPIXEL) // rr + ? *(ds_transmap + (ds_fullbright[val] << 8) + *dest) + : *(ds_transmap + (colormap[val] << 8) + *dest); dest++; xposition += xstep; yposition += ystep; @@ -1993,37 +2016,21 @@ void R_DrawTranslucentSpan_8 (void) // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't // have the uber complicated math to calculate it now, so that was a memory write we didn't // need! - dest[0] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[0]); - xposition += xstep; - yposition += ystep; - - dest[1] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[1]); - xposition += xstep; - yposition += ystep; - - dest[2] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[2]); - xposition += xstep; - yposition += ystep; - - dest[3] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[3]); - xposition += xstep; - yposition += ystep; - - dest[4] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[4]); - xposition += xstep; - yposition += ystep; - dest[5] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[5]); - xposition += xstep; - yposition += ystep; + // rr + size_t i; + UINT32 bit; + for (i = 0; i < 8; i++) + { + bit = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - dest[6] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[6]); - xposition += xstep; - yposition += ystep; + dest[i] = ds_brightmap && (ds_brightmap[bit] == BRIGHTPIXEL) + ? *(ds_transmap + (ds_fullbright[source[bit]] << 8) + dest[i]) + : *(ds_transmap + (colormap[source[bit]] << 8) + dest[i]); - dest[7] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[7]); - xposition += xstep; - yposition += ystep; + xposition += xstep; + yposition += ystep; + } dest += 8; count -= 8; @@ -2031,7 +2038,9 @@ void R_DrawTranslucentSpan_8 (void) while (count-- && dest <= deststop) { val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - *dest = *(ds_transmap + (colormap[source[val]] << 8) + *dest); + *dest = ds_brightmap && (ds_brightmap[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)] == BRIGHTPIXEL) // rr + ? *(ds_transmap + (ds_fullbright[source[val]] << 8) + *dest) + : *(ds_transmap + (colormap[source[val]] << 8) + *dest); dest++; xposition += xstep; yposition += ystep; @@ -2072,44 +2081,30 @@ void R_DrawWaterSpan_8(void) // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't // have the uber complicated math to calculate it now, so that was a memory write we didn't // need! - dest[0] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)]; - xposition += xstep; - yposition += ystep; - - dest[1] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)]; - xposition += xstep; - yposition += ystep; - dest[2] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)]; - xposition += xstep; - yposition += ystep; - - dest[3] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)]; - xposition += xstep; - yposition += ystep; - - dest[4] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)]; - xposition += xstep; - yposition += ystep; - - dest[5] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)]; - xposition += xstep; - yposition += ystep; + // rr + size_t i; + UINT32 bit; + for (i = 0; i < 8; i++) + { + bit = ((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift); - dest[6] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)]; - xposition += xstep; - yposition += ystep; + dest[i] = ds_brightmap && (ds_brightmap[bit] == BRIGHTPIXEL) + ? ds_fullbright[*(ds_transmap + (source[bit] << 8) + *dsrc++)] + : colormap[*(ds_transmap + (source[bit] << 8) + *dsrc++)]; - dest[7] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)]; - xposition += xstep; - yposition += ystep; + xposition += xstep; + yposition += ystep; + } dest += 8; count -= 8; } while (count--) { - *dest++ = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)]; + *dest++ = ds_brightmap && (ds_brightmap[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] == BRIGHTPIXEL) // rr + ? ds_fullbright[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)] + : colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)]; xposition += xstep; yposition += ystep; }