From ec561070b1ec23da81c475474a11785f38dfea4f Mon Sep 17 00:00:00 2001 From: dP Date: Sun, 17 Mar 2024 02:44:01 +0700 Subject: [PATCH] Fix highlight tinting in 32bpp-anim-sse4 blitter --- src/blitter/32bpp_anim_sse4.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/blitter/32bpp_anim_sse4.cpp b/src/blitter/32bpp_anim_sse4.cpp index 031f0cc985..96ffee8908 100644 --- a/src/blitter/32bpp_anim_sse4.cpp +++ b/src/blitter/32bpp_anim_sse4.cpp @@ -16,6 +16,8 @@ #include "32bpp_anim_sse4.hpp" #include "32bpp_sse_func.hpp" +#include "../citymania/cm_colour.hpp" + #include "../safeguards.h" /** Instantiation of the SSE4 32bpp blitter factory. */ @@ -332,6 +334,23 @@ bmcr_alpha_blend_single: } break; + case CM_BM_TINT_REMAP: + for (uint x = (uint) bp->width; x > 0; x--) { + if (src_mv->m == 0) { + if (src->a != 0) { + *dst = citymania::Remap32RGBA(src->r, src->g, src->b, src->a, *dst, remap); + *anim = 0; + } + } else { + uint r = remap[src_mv->m]; + if (r != 0) *dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(r), src_mv->v), src->a, *dst); + } + src_mv++; + dst++; + src++; + anim++; + } + break; case BM_CRASH_REMAP: for (uint x = (uint) bp->width; x > 0; x--) { @@ -429,6 +448,15 @@ bm_normal: else Draw(bp, zoom); } break; + case CM_BM_TINT_REMAP: + if (bp->skip_left != 0 || bp->width <= MARGIN_REMAP_THRESHOLD) { + if (sprite_flags & SF_NO_ANIM) Draw(bp, zoom); + else Draw(bp, zoom); + } else { + if (sprite_flags & SF_NO_ANIM) Draw(bp, zoom); + else Draw(bp, zoom); + } + break; case BM_TRANSPARENT: Draw(bp, zoom); return; case BM_TRANSPARENT_REMAP: Draw(bp, zoom); return; case BM_CRASH_REMAP: Draw(bp, zoom); return;