From f2e7b1d0bf721e371ee58e75a3a628be5e41ae95 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 27 Sep 2026 17:15:19 +0200 Subject: [PATCH] fix "Modulative" blendmode in software forgot to account it when the gamma correction stuff was ported --- src/r_draw.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/r_draw.cpp b/src/r_draw.cpp index 24073a4d4..3746f50a9 100644 --- a/src/r_draw.cpp +++ b/src/r_draw.cpp @@ -174,15 +174,10 @@ static void BlendTab_Translucent(UINT8 *table, int style, UINT8 blendamt) { frontrgba = pGammaCorrectedPalette[fg]; -#if 0 // perfect implementation - result.rgba = ASTBlendPixel(backrgba, frontrgba, style, 0xFF); - result.rgba = ASTBlendPixel(result, frontrgba, AST_TRANSLUCENT, blendamt); - table[((bg * 0x100) + fg)] = GetColorLUT(&transtab_lut, result.s.red, result.s.green, result.s.blue); -#else // performance scrabbler result.rgba = ASTBlendPixel(backrgba, frontrgba, style, 0xFF); result.rgba = ASTBlendPixel(result, frontrgba, AST_TRANSLUCENT, blendamt); + table[((bg * 0x100) + fg)] = GetColorLUT(&transtab_lut_corrected, result.s.red, result.s.green, result.s.blue); // pGammaCorrectedPalette -#endif } } } @@ -190,6 +185,7 @@ static void BlendTab_Translucent(UINT8 *table, int style, UINT8 blendamt) static void BlendTab_Subtractive(UINT8 *table, int style, UINT8 blendamt) { INT16 bg, fg; + RGBA_t backrgba, frontrgba, result; if (table == NULL) I_Error("BlendTab_Subtractive: input table was NULL!"); @@ -202,11 +198,11 @@ static void BlendTab_Subtractive(UINT8 *table, int style, UINT8 blendamt) for (bg = 0; bg < 0x100; bg++) { + backrgba = pLocalPalette[bg]; // intentionally uses pLocalPalette + for (fg = 0; fg < 0x100; fg++) { - RGBA_t backrgba = V_GetColor(bg); - RGBA_t frontrgba = V_GetColor(fg); - RGBA_t result; + frontrgba = pLocalPalette[fg]; result.rgba = ASTBlendPixel(backrgba, frontrgba, style, 0xFF); result.s.red = std::max(0, result.s.red - blendamt); @@ -221,17 +217,19 @@ static void BlendTab_Subtractive(UINT8 *table, int style, UINT8 blendamt) static void BlendTab_Modulative(UINT8 *table) { INT16 bg, fg; + RGBA_t backrgba, frontrgba, result; if (table == NULL) I_Error("BlendTab_Modulative: input table was NULL!"); for (bg = 0; bg < 0x100; bg++) { + backrgba = pGammaCorrectedPalette[bg]; + for (fg = 0; fg < 0x100; fg++) { - RGBA_t backrgba = V_GetColor(bg); - RGBA_t frontrgba = V_GetColor(fg); - RGBA_t result; + frontrgba = pGammaCorrectedPalette[fg]; + result.rgba = ASTBlendPixel(backrgba, frontrgba, AST_MODULATE, 0); table[((bg * 0x100) + fg)] = GetColorLUT(&transtab_lut_corrected, result.s.red, result.s.green, result.s.blue); }