From e650eff100a6648173b09d084b4fc8908bc061f3 Mon Sep 17 00:00:00 2001 From: Denis Pauk Date: Tue, 22 Mar 2022 22:49:13 +0200 Subject: [PATCH] soft: preshift values in lightmap --- src/client/refresh/soft/sw_image.c | 11 +++++++---- src/client/refresh/soft/sw_main.c | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/client/refresh/soft/sw_image.c b/src/client/refresh/soft/sw_image.c index 4ac01b5b..3c37615d 100644 --- a/src/client/refresh/soft/sw_image.c +++ b/src/client/refresh/soft/sw_image.c @@ -363,10 +363,13 @@ R_ApplyLight(pixel_t pix, const light3_t light) b_g = vid_lightmap[light_masked[1] + b_g]; b_b = vid_lightmap[light_masked[2] + b_b]; - /* convert back to indexed color */ - b_r = ( b_r >> 3 ) & 31; - b_g = ( b_g >> 2 ) & 63; - b_b = ( b_b >> 3 ) & 31; + /* + * convert back to indexed color (value reshifted >> 2) + * look to R_Convert32To8bit + */ + b_r = ( b_r >> 1 ); // & 31; + b_g = ( b_g >> 0 ); // & 63; + b_b = ( b_b >> 1 ); // & 31; i_c = b_r | ( b_g << 5 ) | ( b_b << 11 ); diff --git a/src/client/refresh/soft/sw_main.c b/src/client/refresh/soft/sw_main.c index 6008754e..1ce75dd3 100644 --- a/src/client/refresh/soft/sw_main.c +++ b/src/client/refresh/soft/sw_main.c @@ -1811,7 +1811,7 @@ Draw_GetPalette (void) vid_lightthreshold = i * 256; for(j=0; j < 256; j++) - vid_lightmap[i * 256 + j] = (j * scale) / 255; + vid_lightmap[i * 256 + j] = ((j * scale / 255) >> 2) & 63; } }