From 80482e98a389c84b12770ffdfcd990065013f35c Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 24 Dec 2016 10:15:02 -0500 Subject: [PATCH] - renamed r_blendmode to r_blendmethod - did another drawer --- src/r_draw_pal.cpp | 59 ++++++++++++++++++++++++++++++++-------------- src/v_video.cpp | 4 ++-- 2 files changed, 43 insertions(+), 20 deletions(-) diff --git a/src/r_draw_pal.cpp b/src/r_draw_pal.cpp index 19015d8e1..0da9e38be 100644 --- a/src/r_draw_pal.cpp +++ b/src/r_draw_pal.cpp @@ -43,8 +43,8 @@ #include "v_video.h" #include "r_draw_pal.h" -// [SP] r_blendmode - false = rgb555 matching (ZDoom classic), true = rgb666 (refactored) -CVAR(Bool, r_blendmode, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE) +// [SP] r_blendmethod - false = rgb555 matching (ZDoom classic), true = rgb666 (refactored) +CVAR(Bool, r_blendmethod, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE) /* [RH] This translucency algorithm is based on DOSDoom 0.65's, but uses @@ -309,7 +309,7 @@ namespace swrenderer fracstep *= thread->num_cores; pitch *= thread->num_cores; - if (!r_blendmode) + if (!r_blendmethod) { do { @@ -370,7 +370,7 @@ namespace swrenderer } pitch *= thread->num_cores; - if (!r_blendmode) + if (!r_blendmethod) { do { @@ -433,7 +433,7 @@ namespace swrenderer fracstep *= thread->num_cores; pitch *= thread->num_cores; - if (!r_blendmode) + if (!r_blendmethod) { do { @@ -539,7 +539,7 @@ namespace swrenderer fracstep *= thread->num_cores; pitch *= thread->num_cores; - if (!r_blendmode) + if (!r_blendmethod) { do { @@ -603,7 +603,7 @@ namespace swrenderer } pitch *= thread->num_cores; - if (!r_blendmode) + if (!r_blendmethod) { do { @@ -667,19 +667,42 @@ namespace swrenderer fracstep *= thread->num_cores; pitch *= thread->num_cores; - do + if (!r_blendmethod) { - uint8_t pix = source[frac >> bits]; - if (pix != 0) + do { - int r = clamp(GPalette.BaseColors[colormap[pix]].r - GPalette.BaseColors[*dest].r, 0, 255); - int g = clamp(GPalette.BaseColors[colormap[pix]].g - GPalette.BaseColors[*dest].g, 0, 255); - int b = clamp(GPalette.BaseColors[colormap[pix]].b - GPalette.BaseColors[*dest].b, 0, 255); - *dest = RGB256k.RGB[r>>2][g>>2][b>>2]; - } - frac += fracstep; - dest += pitch; - } while (--count); + uint8_t pix = source[frac >> bits]; + if (pix != 0) + { + uint32_t a = (bg2rgb[*dest] | 0x40100400) - fg2rgb[colormap[pix]]; + uint32_t b = a; + + b &= 0x40100400; + b = b - (b >> 5); + a &= b; + a |= 0x01f07c1f; + *dest = RGB32k.All[a & (a >> 15)]; + } + frac += fracstep; + dest += pitch; + } while (--count); + } + else + { + do + { + uint8_t pix = source[frac >> bits]; + if (pix != 0) + { + int r = clamp(GPalette.BaseColors[colormap[pix]].r - GPalette.BaseColors[*dest].r, 0, 255); + int g = clamp(GPalette.BaseColors[colormap[pix]].g - GPalette.BaseColors[*dest].g, 0, 255); + int b = clamp(GPalette.BaseColors[colormap[pix]].b - GPalette.BaseColors[*dest].b, 0, 255); + *dest = RGB256k.RGB[r>>2][g>>2][b>>2]; + } + frac += fracstep; + dest += pitch; + } while (--count); + } } void DrawWallRevSubClamp4PalCommand::Execute(DrawerThread *thread) diff --git a/src/v_video.cpp b/src/v_video.cpp index 9abe13f1b..2b31415a2 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -66,7 +66,7 @@ #include "menu/menu.h" #include "r_data/voxels.h" -EXTERN_CVAR(Bool, r_blendmode) +EXTERN_CVAR(Bool, r_blendmethod) int active_con_scale(); @@ -392,7 +392,7 @@ void DCanvas::Dim (PalEntry color, float damount, int x1, int y1, int w, int h) int dimmedcolor_g = color.g * alpha; int dimmedcolor_b = color.b * alpha; - if (!r_blendmode) + if (!r_blendmethod) { for (y = h; y != 0; y--) {