From 48ca9861b7fa60704658a33f8b815731d2c0ae38 Mon Sep 17 00:00:00 2001 From: Julia Nechaevskaya Date: Sun, 17 Dec 2023 20:36:36 +0300 Subject: [PATCH 1/5] Apply brightmaps to translucent columns --- src/r_draw.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/r_draw.c b/src/r_draw.c index ac83c1ed..0e36da0e 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -229,8 +229,9 @@ void R_DrawTLColumn (void) { register const byte *source = dc_source; - register const lighttable_t *colormap = dc_colormap[0]; + register lighttable_t *const *colormap = dc_colormap; register int heightmask = dc_texheight-1; + register const byte *brightmap = dc_brightmap; if (dc_texheight & heightmask) // not a power of 2 -- killough { heightmask++; @@ -249,7 +250,9 @@ void R_DrawTLColumn (void) // heightmask is the Tutti-Frutti fix -- killough - *dest = tranmap[(*dest<<8)+colormap[source[frac>>FRACBITS]]]; // phares + // [crispy] brightmaps + byte src = source[frac>>FRACBITS]; + *dest = tranmap[(*dest<<8)+colormap[brightmap[src]][src]]; // phares dest += linesize; // killough 11/98 if ((frac += fracstep) >= heightmask) frac -= heightmask; @@ -260,15 +263,19 @@ void R_DrawTLColumn (void) { while ((count-=2)>=0) // texture height is a power of 2 -- killough { - *dest = tranmap[(*dest<<8)+colormap[source[(frac>>FRACBITS) & heightmask]]]; // phares + byte src = source[(frac>>FRACBITS) & heightmask]; + *dest = tranmap[(*dest<<8)+colormap[brightmap[src]][src]]; // phares dest += linesize; // killough 11/98 frac += fracstep; - *dest = tranmap[(*dest<<8)+colormap[source[(frac>>FRACBITS) & heightmask]]]; // phares + *dest = tranmap[(*dest<<8)+colormap[brightmap[src]][src]]; // phares dest += linesize; // killough 11/98 frac += fracstep; } if (count & 1) - *dest = tranmap[(*dest<<8)+colormap[source[(frac>>FRACBITS) & heightmask]]]; // phares + { + byte src = source[(frac>>FRACBITS) & heightmask]; + *dest = tranmap[(*dest<<8)+colormap[brightmap[src]][src]]; // phares + } } } } From d419b820d51302858550241446bd640e89b4d29c Mon Sep 17 00:00:00 2001 From: Julia Nechaevskaya Date: Sun, 17 Dec 2023 20:52:26 +0300 Subject: [PATCH 2/5] Brightmaps for two sided mid-textures --- src/r_segs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/r_segs.c b/src/r_segs.c index da9da9c1..2f4cc408 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -162,7 +162,10 @@ void R_RenderMaskedSegRange(drawseg_t *ds, int x1, int x2) if (index >= MAXLIGHTSCALE ) index = MAXLIGHTSCALE-1; - dc_colormap[0] = dc_colormap[1] = walllights[index]; + // [crispy] brightmaps for two sided mid-textures + dc_brightmap = texturebrightmap[texnum]; + dc_colormap[0] = walllights[index]; + dc_colormap[1] = STRICTMODE(brightmaps) ? fullcolormap : dc_colormap[0]; } // killough 3/2/98: From fdc7f56f02cf4da0e260ce81e4925d6540d0a9ee Mon Sep 17 00:00:00 2001 From: Julia Nechaevskaya Date: Sun, 17 Dec 2023 22:53:08 +0300 Subject: [PATCH 3/5] Apply brightmaps to translated columns --- src/r_draw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/r_draw.c b/src/r_draw.c index 0e36da0e..abbb0f9f 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -661,7 +661,9 @@ void R_DrawTranslatedColumn (void) // Thus the "green" ramp of the player 0 sprite // is mapped to gray, red, black/indigo. - *dest = dc_colormap[0][dc_translation[dc_source[frac>>FRACBITS]]]; + // [crispy] brightmaps + byte src = dc_source[frac>>FRACBITS]; + *dest = dc_colormap[dc_brightmap[src]][dc_translation[src]]; dest += linesize; // killough 11/98 frac += fracstep; From c621ba482162c039ecb7d5871b53c6952b903806 Mon Sep 17 00:00:00 2001 From: Julia Nechaevskaya Date: Mon, 18 Dec 2023 11:55:02 +0300 Subject: [PATCH 4/5] Add R_DrawTranslatedTLColumn function --- src/r_draw.c | 38 ++++++++++++++++++++++++++++++++++++++ src/r_draw.h | 3 +++ src/r_things.c | 8 ++++++++ 3 files changed, 49 insertions(+) diff --git a/src/r_draw.c b/src/r_draw.c index abbb0f9f..ee118c73 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -671,6 +671,44 @@ void R_DrawTranslatedColumn (void) while (--count); } +// [JN] translated and translucent column + +void R_DrawTranslatedTLColumn (void) +{ + int count; + byte *dest; + fixed_t frac; + fixed_t fracstep; + + count = dc_yh - dc_yl; + if (count < 0) + return; + +#ifdef RANGECHECK + if ((unsigned)dc_x >= video.width + || dc_yl < 0 + || dc_yh >= video.height) + I_Error ( "R_DrawTranslatedTLColumn: %i to %i at %i", + dc_yl, dc_yh, dc_x); +#endif + + dest = ylookup[dc_yl] + columnofs[dc_x]; + fracstep = dc_iscale; + frac = dc_texturemid + (dc_yl-centery)*fracstep; + + count++; + + do + { + // [crispy] brightmaps + byte src = dc_translation[dc_source[frac>>FRACBITS]]; + *dest = tranmap[(*dest<<8)+dc_colormap[dc_brightmap[src]][src]]; + dest += linesize; + frac += fracstep; + } + while (--count); +} + // // R_InitTranslationTables // Creates the translation tables to map diff --git a/src/r_draw.h b/src/r_draw.h index 217ec330..eddc3b8a 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -57,6 +57,9 @@ void R_DrawSkyColumn(void); void R_DrawTranslatedColumn(void); +// [JN] translated and translucent column +void R_DrawTranslatedTLColumn(void); + extern lighttable_t *ds_colormap[2]; extern int ds_y; diff --git a/src/r_things.c b/src/r_things.c index 40785079..8f583f00 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -428,7 +428,15 @@ void R_DrawVisSprite(vissprite_t *vis, int x1, int x2) else if (vis->mobjflags & MF_TRANSLATION) { + // [JN] translated and translucent column + if (vis->mobjflags & MF_TRANSLUCENT) + { + colfunc = R_DrawTranslatedTLColumn; + } + else + { colfunc = R_DrawTranslatedColumn; + } dc_translation = translationtables - 256 + ((vis->mobjflags & MF_TRANSLATION) >> (MF_TRANSSHIFT-8) ); } From e4b1fbaf014355dd53eab1d9daa14b3a099c7793 Mon Sep 17 00:00:00 2001 From: Julia Nechaevskaya Date: Mon, 18 Dec 2023 16:41:41 +0300 Subject: [PATCH 5/5] Remove R_DrawTranslatedTLColumn function --- src/r_draw.c | 38 -------------------------------------- src/r_draw.h | 3 --- src/r_things.c | 8 -------- 3 files changed, 49 deletions(-) diff --git a/src/r_draw.c b/src/r_draw.c index ee118c73..abbb0f9f 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -671,44 +671,6 @@ void R_DrawTranslatedColumn (void) while (--count); } -// [JN] translated and translucent column - -void R_DrawTranslatedTLColumn (void) -{ - int count; - byte *dest; - fixed_t frac; - fixed_t fracstep; - - count = dc_yh - dc_yl; - if (count < 0) - return; - -#ifdef RANGECHECK - if ((unsigned)dc_x >= video.width - || dc_yl < 0 - || dc_yh >= video.height) - I_Error ( "R_DrawTranslatedTLColumn: %i to %i at %i", - dc_yl, dc_yh, dc_x); -#endif - - dest = ylookup[dc_yl] + columnofs[dc_x]; - fracstep = dc_iscale; - frac = dc_texturemid + (dc_yl-centery)*fracstep; - - count++; - - do - { - // [crispy] brightmaps - byte src = dc_translation[dc_source[frac>>FRACBITS]]; - *dest = tranmap[(*dest<<8)+dc_colormap[dc_brightmap[src]][src]]; - dest += linesize; - frac += fracstep; - } - while (--count); -} - // // R_InitTranslationTables // Creates the translation tables to map diff --git a/src/r_draw.h b/src/r_draw.h index eddc3b8a..217ec330 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -57,9 +57,6 @@ void R_DrawSkyColumn(void); void R_DrawTranslatedColumn(void); -// [JN] translated and translucent column -void R_DrawTranslatedTLColumn(void); - extern lighttable_t *ds_colormap[2]; extern int ds_y; diff --git a/src/r_things.c b/src/r_things.c index 8f583f00..40785079 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -428,15 +428,7 @@ void R_DrawVisSprite(vissprite_t *vis, int x1, int x2) else if (vis->mobjflags & MF_TRANSLATION) { - // [JN] translated and translucent column - if (vis->mobjflags & MF_TRANSLUCENT) - { - colfunc = R_DrawTranslatedTLColumn; - } - else - { colfunc = R_DrawTranslatedColumn; - } dc_translation = translationtables - 256 + ((vis->mobjflags & MF_TRANSLATION) >> (MF_TRANSSHIFT-8) ); }